Page 1 of 1
script ignore line 1st time only
Posted: Tue Apr 06, 2004 10:31 pm
by fuhrer
how do i make my script skip out a section of a thread the first time it is run, but have it read every other time it is run.
Posted: Tue Apr 06, 2004 11:21 pm
by Bjarne BZR
Can you explain better what you want o acieve?
What do you mean by first time? First time after beeing loaded in server rotation? First time in the server? What are you wanting to be the effect of this?
Posted: Wed Apr 07, 2004 12:22 am
by fuhrer
the thread is set by a trigger, it does some stuff and close some doors then opens them later on
but because the game starts with teh doors closed they dont need to close the first time the thread is run, i.e. push a button runs thread.
so i was lookin for a way to tell the script "do not close the doors the 1st time the thread is triggered".
in short, i want this part of my thread ignored the 1st time around, then included in the thread every other time it is triggered
Code: Select all
if(level.pos != self.floor)
{
$("doors_" + $lift.floor) playsound lift_gate
$("doors_" + $lift.floor) doclose
$left_door moveEast 78
$right_door moveWest 78
$left_door move
$right_door waitmove
level.doorpos = 0
}
Posted: Wed Apr 07, 2004 12:58 am
by blue60007
maybe you could do:
Code: Select all
level.skip1sttime = 1
thing:
if(level.pos != self.floor)
{
if(level.skip1sttime == 1)
{
level.skip1sttime = 0
goto thing
end
}
else
{
$("doors_" + $lift.floor) playsound lift_gate
$("doors_" + $lift.floor) doclose
$left_door moveEast 78
$right_door moveWest 78
$left_door move
$right_door waitmove
level.doorpos = 0
}
}
I don't know if that would work, but try it...
Posted: Wed Apr 07, 2004 1:19 pm
by Bjarne BZR
Something like that would work... or you can open the doors the first thing you do when the level starts....
Posted: Wed Apr 07, 2004 10:32 pm
by M&M
but wait,if the doors are closed ,then u command them to close then they shouldnt do anything .am i right?
or would that cause an error?
Posted: Wed Apr 07, 2004 11:28 pm
by Bjarne BZR
Yes M&M it will cause an error if you are using the moveEast/moveWest commands. Well not an error as such, but the doors would move too far and become dislaced. If you instead use
moveto command you would not have this problem in the first place and the doors would only move to the correct positions.
Posted: Wed Apr 07, 2004 11:32 pm
by M&M
well,there u go.another way to fix it

Posted: Thu Apr 08, 2004 12:54 am
by blue60007
wooo a script I made might actually work

! the moveto command would work much better.