Post your scripting questions / solutions here
Moderator: Moderators
fuhrer
Captain
Posts: 253 Joined: Sun Mar 14, 2004 3:36 am
Post
by fuhrer » Fri Apr 02, 2004 12:51 am
In my lift i have a display which tells u which floor the lift is on, however it only shows u the floor once the lift has stopped, i want it to show me which floor it is on as the lift passes thru it
i.e. if its moving from floor 1 to floor 4 the display will show 2 as it passes thru floor 2, then 3 as it moves thru floor 3.
script:
Code: Select all
call:
$inner_triggers nottriggerable // turns off the triggers
$outer_triggers nottriggerable
$call_buttons playsound click
$call_buttons moveNorth 1 // moves buttons
$call_buttons move
wait .2
$call_buttons moveSouth 1
$call_buttons move
if(level.doorpos == 1)
{
$left_door moveEast 78
$right_door moveWest 78
$left_door move
$right_door move
level.doorpos = 0
}
$("pos_" + $lift.floor) moveNorth 2
$("pos_" + $lift.floor) move
$("doors_" + $lift.floor) playsound lift_gate
$("doors_" + $lift.floor) doclose
$lift moveto $("floor_" + self.floor)
$lift loopsound lift_sound
$lift waitmove // moves the lift to that destination
$lift.floor = self.floor
$lift loopsound lift_sound wait
$left_door moveWest 78
$right_door moveEast 78
$left_door move
$right_door move
level.doorpos = 1
$("pos_" + self.floor) moveSouth 2
$("pos_" + self.floor) move
$("doors_" + self.floor) doopen
$("doors_" + self.floor) playsound lift_gate
level.doors = $("doors_" + self.floor)
wait 1.5
$inner_triggers triggerable // turns triggers on
$outer_triggers triggerable
end
fuhrer
Captain
Posts: 253 Joined: Sun Mar 14, 2004 3:36 am
Post
by fuhrer » Fri Apr 02, 2004 12:53 am
forgot to mention, pos_ is the name of the display, 1 thru 4... they move out thru the wall.
$("pos_" + $lift.floor) moveNorth 2
nuggets
General
Posts: 1006 Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:
Post
by nuggets » Fri Apr 02, 2004 2:20 am
explain why you have more than one indicator and your using
$("pos_" + $lift.floor)
i don't understand why you want different targetnames again for your indicator?
hope this helps, prob not cos it's all foreign 2 me :-/
fuhrer
Captain
Posts: 253 Joined: Sun Mar 14, 2004 3:36 am
Post
by fuhrer » Fri Apr 02, 2004 4:05 am
i have roman numerals that move out thru the wall when the lift is on a certain floor, all the number ones are named pos_1, 2 2 etc etc...
so when the lift is on floor 1, the numeral 1 will show up thru the wall on every floor.
i couldnt figure out with the script as it is, how to get a rotating dial to work.
nuggets
General
Posts: 1006 Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:
Post
by nuggets » Sun Apr 04, 2004 3:40 am
the only way i can think without revamping your script a lot is to add a 2nd thread that checks which waypoint is closest,
you'll need
Code: Select all
floor_check:
if (vector_length ($lift.origin - $("floor_" + $lift.floor).origin) > (vector_length ($lift.origin - $("floor_" self.floor + ($lift.floor + 1).origin)
{
//change indicator for going up
}
if (vector_length ($lift.origin - $("floor_" + $lift.floor).origin > (vector_length ($lift.origin - $("floor_" self.floor + ($lift.floor - 1).origin)
{
//change indicator for going down
}
if ($lift.moving == 1)
{
wait 1
goto floor_check
}
end
call:
thread floor_check
$lift.moving = 1
$inner_triggers nottriggerable // turns off the triggers
$outer_triggers nottriggerable
$call_buttons playsound click
$call_buttons moveNorth 1 // moves buttons
$call_buttons move
wait .2
$call_buttons moveSouth 1
$call_buttons move
if(level.doorpos == 1)
{
$left_door moveEast 78
$right_door moveWest 78
$left_door move
$right_door move
level.doorpos = 0
}
$("pos_" + $lift.floor) moveNorth 2
$("pos_" + $lift.floor) move
$("doors_" + $lift.floor) playsound lift_gate
$("doors_" + $lift.floor) doclose
$lift moveto $("floor_" + self.floor)
$lift loopsound lift_sound
$lift waitmove // moves the lift to that destination
$lift.floor = self.floor
$lift.moving = 0
$lift loopsound lift_sound wait
$left_door moveWest 78
$right_door moveEast 78
$left_door move
$right_door move
level.doorpos = 1
$("pos_" + self.floor) moveSouth 2
$("pos_" + self.floor) move
$("doors_" + self.floor) doopen
$("doors_" + self.floor) playsound lift_gate
level.doors = $("doors_" + self.floor)
wait 1.5
$inner_triggers triggerable // turns triggers on
$outer_triggers triggerable
end
hope this helps, prob not cos it's all foreign 2 me :-/
fuhrer
Captain
Posts: 253 Joined: Sun Mar 14, 2004 3:36 am
Post
by fuhrer » Tue Apr 06, 2004 2:29 am
so how do i know which indicator to show? i went thru some calculations of ur thread, and the statement is always true for starters. (intended)
for this example the lift is on the 2nd floor, and is being called to the 4th.
Code: Select all
if (vector_length ($lift.origin - $("floor_" + $lift.floor).origin) > (vector_length ($lift.origin - $("floor_" self.floor + ($lift.floor + 1).origin)
{
//change indicator for going up
}
if (vector_length (2 - (2)) > (vector_length (2 - (4 + (2 + 1))
if 0 > -5
{
//sorry im lost
}
not sure which indicators to move, i have to move one in and one out...