Help with a simple script
I'm just trying to make a script that gives Link some items and takes some away when he enters the screen. But the script doesn't work. It compiles fine, but nothing happens. Here's the script:
Code:
ffc script item{
void run() {
Link->Item[17] = true;
Link->Item[18] = false;
Link->Item[91] = false;
Link->Item[143] = true;
}
}
What am I doing wrong?
Re: Help with a simple script
Are those valid items? I strongly suggest you use the constants in std.zh for existing items, and make your own for new ones.
Other than that, the obvious questions:
- is the FFC assigned the correct script?
- does the FFC have a combo greater than 0? (0 == disabled)
- is it at a position greater than (-32, -32)?
Re: Help with a simple script
Yes to all the questions. The Item IDs were taken from the item editor.
Re: Help with a simple script
Oh, I just tried compiling this, and I see the problem: It's not compiling, and you're missing the error.
Quote:
Originally Posted by ZQuest
Pass 1: Parsing
Pass 2: Preprocessing
line 1: syntax error, unexpected ITEM, expecting IDENTIFIER, on token item
tmp, line 1: Error P01 : Failure to parse imported file test.z.
Change the name of the script from "item" to something that isn't reserved (such as "giveitem")
Re: Help with a simple script
That's not the name of it in the quest. I just changed it since it's name is a quest spoiler. :D
Re: Help with a simple script
Ok then...
Well, my original suggestion was to do this:
Code:
ffc script smurf{
void run() {
if(Link->Item[17]) Trace(1); else Trace(0);
Link->Item[17] = true;
if(Link->Item[17]) Trace(1); else Trace(0);
Link->Item[18] = false;
Link->Item[91] = false;
Link->Item[143] = true;
}
}
Go into the room, leave it, then go back in. Then, check allegro.log. You should see a few lines that should look like this, if the script is working:
Quote:
Originally Posted by allegro.log
0
1
1
1
If it isn't, it'll be either four zeroes, or more likely, nothing.