PDA

View Full Version : Help with a simple script



Russ
11-19-2008, 12:46 AM
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:


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?

pkmnfrk
11-19-2008, 02:52 AM
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)?

Russ
11-19-2008, 11:40 AM
Yes to all the questions. The Item IDs were taken from the item editor.

pkmnfrk
11-19-2008, 09:13 PM
Oh, I just tried compiling this, and I see the problem: It's not compiling, and you're missing the error.


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")

Russ
11-20-2008, 01:11 AM
That's not the name of it in the quest. I just changed it since it's name is a quest spoiler. :D

pkmnfrk
11-20-2008, 03:11 AM
Ok then...

Well, my original suggestion was to do this:


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:


0
1
1
1

If it isn't, it'll be either four zeroes, or more likely, nothing.