Forum

> > Stranded II > General > A bit of help (script) would be much appreciated!
Forums overviewStranded II overviewGeneral overviewLog in to reply

English A bit of help (script) would be much appreciated!

2 replies
To the start Previous 1 Next To the start

old closed A bit of help (script) would be much appreciated!

Guest

Quote
Hi...

I'm mod'ing my stranded a bit for my own amusement.
I'm not really good at it but I'm getting better.
Have implemented some new items/combinations etc.
Inspired by the Realism Mod, I'm trying to implement brewing atm.

I've run into a bit of a problem. I'm getting 'script error' but I'm not really good at doing debugs.
I've searched the forum and google et al. but cant find anything.

Debug is giving me this info:
SCRIPT ERROR:
Item 8808 (juice type 47)
Mismatched brackets.
Event changeday
Row 10
Col 1
Script }

Thats it...

My script is looking like this:

script=start
on:create {
local $age;
$age=1;
}
on:use {
msg "Aged for $age days",3;
}
on:eat {
          process "drinking",2000;
          drink 0,0,40,0;
          find 106;
}
on:changeday {
          if ($age>=0){
               $age++;
               if ($age>=2){
                msg "This should work",3; //debug
      alterobject "self",611;
                event "iskill_brewing","global";
           }
}
}
script=end


..

I figured (because of the debug message) that the problem had to be in the changeday section. And a // edit confirmed that the above was working. I fiddled around with the changeday part and couldnt get it to work.
Now I get the (exact same) error message even if I //-out the entire script.
This has me believing that the error must be somewhere else. But I cant figure it out, as I dont know how to decifer the debug error-message.
I edit in INF-editer - and the numbers given from debug dont really make sense in regards to line-count etc.

Can you guys (/girls) spot the problem - explain to me how to locate the error, or maybe just give me link to a site explaining how understand the debug-messages?

I would very much appreciate it, as it has now wasted many hours of my mod-time, and I'm starting to feel really discouraged.

Thanks in advance (and fingers crossed)

Rasmus

old Re: A bit of help (script) would be much appreciated!

Gradir
User Off Offline

Quote
I'm not sure if it's the problem, but I think that local variables are cleared after the event, try just removing the
1
local $age;
line
Then it will act like a global variable (afaik)
It will use your memory all the time, but after all it is something you want here

oh, and it seems that it is an item, so also in place of alterobject use s2 cmd alteritem - thats probably the problem

oh and remember to freevar the variable after you don't need it!

old Re: A bit of help (script) would be much appreciated!

Flying Lizard
User Off Offline

Quote
Gradir has written
I'm not sure if it's the problem, but I think that local variables are cleared after the event, try just removing the
1
local $age;
line
Then it will act like a global variable (afaik)
It will use your memory all the time, but after all it is something you want here


Your wrong, local Variables are threatened the same way as global variables, except the fact that thei're local

Gradir has written
oh, and it seems that it is an item, so also in place of alterobject use s2 cmd alteritem - thats probably the problem


Well, that would be right but:

As far as I understood this scripted is supposed to react even while the player is carying the item. That won't work due to the way S2 stores items. After they're stacked in your inventar, you can't specify a single item of the several dozens you carry. The according variables are destroyed.


And by the way, there's a spezial thread thread for such questions, you are even promted to use it when attempting to create a new one.
http://unrealsoftware.de/forum_posts.php?post=53302#lastpost
To the start Previous 1 Next To the start
Log in to replyGeneral overviewStranded II overviewForums overview