scripting - number value increase?

Post your scripting questions / solutions here

Moderator: Moderators

User avatar
HDL_CinC_Dragon
Brigadier General
Posts: 574
Joined: Mon Dec 22, 2003 8:32 pm

Post by HDL_CinC_Dragon »

of course you think its simple, you wrote it lol. yea im gunna try it out and stuff like that. Thnx for your patience and time :D
Image
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

@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.
Last edited by wacko on Wed Apr 13, 2005 8:02 pm, edited 1 time in total.
User avatar
HDL_CinC_Dragon
Brigadier General
Posts: 574
Joined: Mon Dec 22, 2003 8:32 pm

Post by HDL_CinC_Dragon »

well yeah i wasnt sure if that would work or not, that was kinda just ther for an exmaple to those who knew how to do that ++ and +=# stuff to fix it or what ever was needed for this to happen. Thnx though :D
Image
Grassy
First Lieutenant
Posts: 221
Joined: Sun Aug 22, 2004 11:36 am

Post by Grassy »

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.

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
}

end
An ambiguous question will get a similar answer...
Post Reply