script ignore line 1st time only

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
fuhrer
Captain
Posts: 253
Joined: Sun Mar 14, 2004 3:36 am

script ignore line 1st time only

Post 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.
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post 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?
Admin .MAP Forums
Image
Head above heels.
fuhrer
Captain
Posts: 253
Joined: Sun Mar 14, 2004 3:36 am

Post 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
	}
blue60007
General
Posts: 1247
Joined: Sun Mar 07, 2004 11:44 pm

Post 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...
Image
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Something like that would work... or you can open the doors the first thing you do when the level starts....
Admin .MAP Forums
Image
Head above heels.
M&M
General
Posts: 1427
Joined: Sun Sep 14, 2003 1:03 am
Location: egypt
Contact:

Post 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?
Image
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post 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.
Admin .MAP Forums
Image
Head above heels.
M&M
General
Posts: 1427
Joined: Sun Sep 14, 2003 1:03 am
Location: egypt
Contact:

Post by M&M »

well,there u go.another way to fix it :D
Image
blue60007
General
Posts: 1247
Joined: Sun Mar 07, 2004 11:44 pm

Post by blue60007 »

wooo a script I made might actually work :lol: ! the moveto command would work much better.
Image
Post Reply