Problem with Script

Started by Squinky, Fri 26/12/2003 07:40:29

Previous topic - Next topic

Squinky


Okay, so I've got a character that moves around to different areas when you interact with him, and I keep tabs on him with globalint 2 and time it with timer 2...

it works the first time the roomes rep ex is run (when Gint ==1) but then when it comes time for the char to pop up again (when Gint ==3) it dosen't work. Now, I've tested the valuse of the int to make sure thats right and it is, but when I test the timer I get funny results. It seems like the timer never runs out the second time...anybody see what I'm doing wrong?


 // script for character6: Pick up character
if (GetGlobalInt (2)==0){
 
MoveCharacterBlocking (STAN,175,100,0);
Wait (10);
Display ("Animate bending down");
SetCharacterSpeed (SHELL,10);
MoveCharacterBlocking (SHELL,237, 90,0);
Wait (10);
PlaySound (2);
character[SHELL].room=-1;
SetTimer(2,150);
SetGlobalInt (2,1);

}
 
if (GetGlobalInt (2)==2){
 MoveCharacterBlocking (STAN,116, 97,0);
Wait (10);
Display ("Animate bending down");
PlaySound (2);
character[SHELL].room=-1;
SetTimer(2,150);
SetGlobalInt (2,3);
}


// the room rep ex

if ((IsTimerExpired (2)==1)&&(GetGlobalInt (2)==1)){
 character [SHELL].x=108;
 character[SHELL].y=88;
 PlaySound (2);
 character [SHELL].room=4;
 SetGlobalInt (2,2);
 }
 
if ((IsTimerExpired (2)==1)&&(GetGlobalInt (2)==3)){
 character [SHELL].x=222;
 character[SHELL].y=101;
 PlaySound (2);
 character [SHELL].room=4;
 SetGlobalInt (2,4);
 }


MrColossal

am i missing it or is there no code for changing the global int to 2 or 3, i take it that's in the character interaction?
"This must be a good time to live in, since Eric bothers to stay here at all"-CJ also: ACHTUNG FRANZ!

Squinky

Damn, I wish it was that easy (probably is though) but no, I've got the character code followed by the room code, and the setting of that int to 3 is in the bottomest portion of the character code....


a-v-o

QuoteNote that this function will only return 1 once - after that, the timer is placed into an OFF state where it will always return 0 until restarted.

Change rep exec:

if (IsTimerExpired (2)==1){
if (GetGlobalInt (2)==1){
character [SHELL].x=108;
character[SHELL].y=88;
PlaySound (2);
character [SHELL].room=4;
SetGlobalInt (2,2);
}

else if (GetGlobalInt (2)==3){
character [SHELL].x=222;
character[SHELL].y=101;
PlaySound (2);
character [SHELL].room=4;
SetGlobalInt (2,4);
}
}

IsTimerExpired can't be called twice.

Squinky

That did it, thank you. I probably never would have figured that out...

SMF spam blocked by CleanTalk