can i cancel the thread in scr?

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
tsensor
Sergeant
Posts: 52
Joined: Wed Feb 11, 2004 1:25 pm

can i cancel the thread in scr?

Post by tsensor »

i making dancing room
i want make blink very fast white light
i want blink light can switch on/off

my whole idea(i know little scr commands),

1st - put trigger_multiple(named 'light1sensor') in whole map area, and make switch($blink_light1_sw) and switch trigger($blink_light1_tri) ,

2nd - on/off blink light by using triggerable and nottriggerable by switch in scr:


//----
// blink_light1_on
//----
blink_light1_on:
$blink_light1_tri waittill trigger
$blink_light1_sw time 0.14
$blink_light1_sw movedown 1
$blink_light1_sw playsound click
$blink_light1_sw waitmove
$blink_light1_sw moveup 1
$blink_light1_sw move

$light1sensor triggerable

goto blink_light1_off

end

//

blink_light1_off:
$blink_light1_tri waittill trigger
$blink_light1_sw time 0.14
$blink_light1_sw movedown 1
$blink_light1_sw playsound click
$blink_light1_sw waitmove
$blink_light1_sw moveup 1
$blink_light1_sw move

$light1sensor nottriggerable

goto blink_light1_on

end

//----
// light1sensor
//----
light1sensor:
$light1sensor waittill trigger
$blink_light1 light 1 1 1 700
$blink_light1 angles 90 0 0
$blink_light1 spot_angle 35
$blink_light1 lighton
wait 0.05
$blink_light1 lightoff
wait 0.1

goto light1sensor

end



!!!!PROBLEM!!!!! i want 'very fast blink light' but it cant be by this method
because '$light1sensor waittill trigger'(beling 'light1sensor:')

computer light slow because he check 'trigger_multiple'

i tried below:

//----
// light1sensor
//----
light1sensor:
//$light1sensor waittill trigger
$blink_light1 light 1 1 1 700
$blink_light1 angles 90 0 0
$blink_light1 spot_angle 35
$blink_light1 lighton
wait 0.05
$blink_light1 lightoff
wait 0.1

goto light1sensor

end

above method was better then before
but......but i cant on/off it!!!!

I need another method can on/off blink light
Random
Moderator
Posts: 401
Joined: Sun Jun 01, 2003 11:00 pm

Post by Random »

You might have better luck with this topic in the scripting forum. I will move it over there for you.

Cheers
Random
Moderator
Image
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 »

put a setthread command in radiant
key: setthread
value: lights

key: wait
value: .4
then in the script

main:

level waittill spawn

$blink_light1_sw time 0.14
$blink_light1 light 1 1 1 700
$blink_light1 angles 90 0 0
$blink_light1 spot_angle 35
end

lights:
$blink_light1 lightOn
$blink_light1_sw playsound click
$blink_light1_sw moveDown 1
$blink_light1_sw waitmove
$blink_light1 lightOff
$blink_light1_sw moveUp 1
$blink_light1_sw waitmove
end

//this will then leave the lights off up noone is in the trigger
hope this helps, prob not cos it's all foreign 2 me :-/
tsensor
Sergeant
Posts: 52
Joined: Wed Feb 11, 2004 1:25 pm

f

Post by tsensor »

i tried
it is not i want

i said

once puse the switch , light blink infinitely
puse the switch once more, light stop blink
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

this?

Post by tltrude »

How about this???


------------------------------------

main:

level waittill prespawn

$blink_light1_sw time 0.14
$blink_light1 light 1 1 1 700
$blink_light1 angles 90 0 0
$blink_light1 spot_angle 35
level.lite_on = 0
level.blink_time = .14 // adjust blinking here
thread light_switch

level waittill spawn

end

light_switch:

$blink_light1_tri waittill trigger
$blink_light1_sw playsound click
$blink_light1_sw moveup 1
$blink_light1_sw waitmove
level.lite_on = 1
thread blinker

$blink_light1_tri waittill trigger
$blink_light1_sw playsound click
$blink_light1_sw moveDown 1
$blink_light1_sw waitmove
level.lite_on = 0
goto light_switch

end

blinker:

while (level.lite_on == 1)
{
$blink_light1 lightOn
wait (level.blink_time)
$blink_light1 lightOff
wait (level.blink_time)
}
waitframe

end

------------------------------------

It probably wont be smooth because the framerate is always changing in the game.
Last edited by tltrude on Fri Feb 27, 2004 11:32 am, edited 3 times in total.
Tom Trude,

Image
tsensor
Sergeant
Posts: 52
Joined: Wed Feb 11, 2004 1:25 pm

m

Post by tsensor »

you are my hero , tltrude

i'll try :)
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 »

lol, well if you'd of asked for that :P

why not just use
while (level.lite_on == 1)
{
}
hope this helps, prob not cos it's all foreign 2 me :-/
omniscient
Major General
Posts: 694
Joined: Tue Sep 16, 2003 12:02 am

Post by omniscient »

hate to beath this to death, but couldnt u just use break???
Image
tsensor
Sergeant
Posts: 52
Joined: Wed Feb 11, 2004 1:25 pm

df

Post by tsensor »

i...
i suffered
because just 'l'

waittil ->waittill

yeah....when i changed it, it worked
yeah.......thank you..





i need to know what these commands mean

while (1)

it worked fine. i changed it to:

while (level.light_on == 1)

it also worked fine. i am anxious






and i am anxious about

waitframe








thank you for reading
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 »

while means as it says while something is happening
1 means always true

so while (1) will always run

while (level.light_on == 1)
will only run while level.light_on equals 1

waitframe... hmmm...
scripting is ran as fast as possible and if their are no wait commands you will get a command overflow error as you CPU is trying to do too much

you may of heard of FPS (frames per second) these are how many times the image will change in a second, so waitframe will only run the command, when the next frame is loaded, therefore not flooding it with commands

if fps = 24
the command will be ran 24 times in one second
hope this helps, prob not cos it's all foreign 2 me :-/
tsensor
Sergeant
Posts: 52
Joined: Wed Feb 11, 2004 1:25 pm

h

Post by tsensor »

thank you nuggets
for teaching me

you so kind~!
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Post by tltrude »

If you are going to use "while (level.lite_on == 1)", you don't need this anymore.

if (level.lite_on == 0)
{
end
}


And yes, it could of used "break" instead of "end".
Tom Trude,

Image
Post Reply