Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → rand() problems
rand() problems
2001-07-06, 5:18 PM #1
first time using rand(), requested cog by spiral:

Code:
symbols

message	startup
message	timer
message	pulse

thing	soundlocation=

sound	thundersound=

flex	volume=
flex	mindistance=
flex	maxdistance=

flex	random		local

end

code

startup:

  random = Rand() * 30;
  SetPulse(0.1);

 return;

timer:

  if(GetSenderID() == 5678)
  {
   PlaySoundPos(thundersound, GetThingPos(soundlocation), volume, mindistance, maxdistance, 0x40);
   random = Rand() * 30;
   SetPulse(0.1);
  }

 return;

pulse:

  if(random < 10)
  {
   random = Rand() * 30;
  }

  else
  if(random >= 10)
  {
   SetTimerEx(random, 5678, 0, 0);
   SetPulse(0.0);
  }

 return;

end


Thanks to Greven who helped out with the multiply-by-30 deal.. it took me a few minutes to understand how to use rand effectively - I don't think my brain functions well late at night.

Edit: Had outdated version posted..

[This message has been edited by Jipe (edited July 06, 2001).]
2001-07-06, 5:31 PM #2
Ok whats the prob ?

↑ Up to the top!