wildheart354 Posted September 23, 2013 I am writing a script to open a door when the player crosses a line, but only if they possess the yellow skull key. I want it to repeatedly check whether the player possesses the yellow skull key every time they cross the line, and open the door if so, but only if the door has not been opened using the script before. I came up with this: script 4 (void) { for ( int i = 0; i < 1; i++ && CheckInventory("YellowSkull") >0) { Ceiling_RaiseByValue(16,16,112); } } The script editor says that I am missing a semicolon on the line beginning with 'for' but I have no idea where to put it. If you know what I could change to make it work, then that would be great, whether that's knowing where the semicolon should be, or telling me how to change the script so it works but still has the same effect. Thanks in advance. 0 Share this post Link to post
gggmork Posted September 23, 2013 Probably something like this, rusty pseudocode w/ wrong syntax. Your for structure had too much stuff after i++ which caused the error probably. And you don't need a for I think (that's a loop). You just need a single if check because that line is repeatably crossable probably. This might be wrong, didn't try it at all: dooropened=0 script 4(void) { if dooropened==0 and checkinventory(yellow bla): { dooropened=1 ceiling raise(bla) } } 0 Share this post Link to post
Alteus Posted September 24, 2013 How about this: Script 1 (void) { if(CheckInventory("YellowSkull") == TRUE) { Ceiling_RaiseByValue(16,16,112); } } Edit: oh, I didn't read that second instruction... hrm, thinking:) Edit2: If your intention is that anyone not having yellow skull cannot pass that door, how about doing a normal YS-door and before that one placing this script? Script 9 (void) //Thrust away from yellow door if no skull { if(CheckInventory("YellowSkull") == FALSE) { ThrustThing(X,Y); } } X is the angle, (0-east,64-north,128-west,192-south) Y is the force. That should thrust anyone without skull away ._. 0 Share this post Link to post
wildheart354 Posted September 24, 2013 I want the door opening to be a monster closet that only opens if the player has the yellow skull key when the line is crossed. Because if the door opens without the player having the key then it will ruin the surprise because a labyrinth rises up when the player gets the key. EDIT: I think I've sorted it, I've changed the script to: script 4 (void) { if (CheckInventory("YellowSkull") >0) { Door_Open (16, 16, 0); } } because that seems to make the door open only if it was closed to start with. (Instead of the door going further up the wall every time the line is crossed.) 0 Share this post Link to post
fraggle Posted September 30, 2013 Looks like you confused if() and for() statements, then. They do completely different things. 0 Share this post Link to post