Page 1 of 1

can i cancel the thread in scr?

Posted: Tue Feb 24, 2004 5:28 am
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

Posted: Tue Feb 24, 2004 6:58 am
by Random
You might have better luck with this topic in the scripting forum. I will move it over there for you.

Cheers
Random

Posted: Tue Feb 24, 2004 7:31 am
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

f

Posted: Tue Feb 24, 2004 10:34 am
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

this?

Posted: Tue Feb 24, 2004 11:28 am
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.

m

Posted: Wed Feb 25, 2004 2:40 pm
by tsensor
you are my hero , tltrude

i'll try :)

Posted: Thu Feb 26, 2004 4:32 am
by nuggets
lol, well if you'd of asked for that :P

why not just use
while (level.lite_on == 1)
{
}

Posted: Thu Feb 26, 2004 4:48 am
by omniscient
hate to beath this to death, but couldnt u just use break???

df

Posted: Thu Feb 26, 2004 12:17 pm
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

Posted: Fri Feb 27, 2004 1:34 am
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

h

Posted: Fri Feb 27, 2004 5:42 am
by tsensor
thank you nuggets
for teaching me

you so kind~!

Posted: Fri Feb 27, 2004 11:29 am
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".