scripting - number value increase?
Moderator: Moderators
- HDL_CinC_Dragon
- Brigadier General
- Posts: 574
- Joined: Mon Dec 22, 2003 8:32 pm
@dragon, regarding the relevant parts of ur script:
btw, congrats! ur post had #77777! I'd say, u get one free!!
$fan1 rotateY local.rotationdegree++
This line isn't working at all, I assume u want to do both in one command: do the rotation and substract 1 from local.rotationdegree. This isn't working unfortunately, u need two commands, $fan1 rotateY local.rotationdegree and local.rotationdegree--
wait 360
This line makes the thread wait for 360 seconds, nothing less nothing more. I assume, u want it to make the thread repeat the line above 360 times, but for this u need a loop, using the for() or the while() command
$fan1 rotateY 0
This will make the fan stop, and will not stop the increase of the fan's speed.
$fan1 rotateY 360
like u wanted it to do, this will make the fan rotate at 360, but because the lines above don't work, well it's obsolete.
btw, congrats! ur post had #77777! I'd say, u get one free!!
$fan1 rotateY local.rotationdegree++
This line isn't working at all, I assume u want to do both in one command: do the rotation and substract 1 from local.rotationdegree. This isn't working unfortunately, u need two commands, $fan1 rotateY local.rotationdegree and local.rotationdegree--
wait 360
This line makes the thread wait for 360 seconds, nothing less nothing more. I assume, u want it to make the thread repeat the line above 360 times, but for this u need a loop, using the for() or the while() command
$fan1 rotateY 0
This will make the fan stop, and will not stop the increase of the fan's speed.
$fan1 rotateY 360
like u wanted it to do, this will make the fan rotate at 360, but because the lines above don't work, well it's obsolete.
Last edited by wacko on Wed Apr 13, 2005 8:02 pm, edited 1 time in total.
- HDL_CinC_Dragon
- Brigadier General
- Posts: 574
- Joined: Mon Dec 22, 2003 8:32 pm
Yeah like wacko said.....
And I guess it's my fault too, I eventually understood what you wanted, then wrote it but didnt explain why it looks so different to your example.. But to increment something using ++ or -- you need a loop, in my example it is basically just three loops.
One main loop for the whole thread, with two smaller nested loops that are set up to run only one or the other depending on the state of the fan.
You can compair it to this small thread that contols a switch, only difference here is the animation of a different object is done once and not looped to increment a value.
One main loop for the whole thread, with two smaller nested loops that are set up to run only one or the other depending on the state of the fan.
You can compair it to this small thread that contols a switch, only difference here is the animation of a different object is done once and not looped to increment a value.
Code: Select all
//------------------------
//red alarm switch anim routine
//------------------------
switch_move:
while(1)
{
$swtrig waittill trigger
if (level.switch_pos==0) // 0=up 1=down
{
$swtrig anim turnon
$swtrig playsound subpen_lever
$swtrig anim waittill animdone
level.switch_pos = 1
}
else
{
$swtrig anim turnoff
$swtrig playsound subpen_lever
$swtrig anim waittill animdone
level.switch_pos = 0
}
waitframe
}
endAn ambiguous question will get a similar answer...
