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 → I did it! Its finally been done!
I did it! Its finally been done!
2002-02-24, 9:19 AM #1
Can somebody make me a cog where a elevator moves randomly between 3 floors? like stoping at floors 1, 2, and 3 comletely random. It should have adjustable speed and maximum and minimum wait time too.

------------------
"Does that compute?

Or do I need to draw you a schematic!?"
2002-02-24, 1:17 PM #2
Umm, ok.

Code:
# Simple elavator script - random actions.
#
# 02/2002 GBK
Symbols
Message Startup
Message Arrived
Thing Elev
Flex Movespeed=2.0
Flex Min_wait=0.5		#Min amount of time before moving again.
Flex Max_wait=5.0		#Max ^.
Flex R=0				Local
Int F=0				Local
End
Code
Startup: Call Pick; Stop;
Arrived:  R = Rand() * 10;
While(R < Min_wait || R > Max_wait) { R = Rand() * 10; }
Sleep(R); Call Pick;
Stop;
Pick: F = Rand() * 10;
While(F < 2) { F = Rand() * 10; }
Movetoframe(Elev, F, Movespeed);
Stop;
End



Didnt test it, but it should work.


Credit me. [http://forums.massassi.net/html/smile.gif]

------------------
Success is the inverse relationship between effort, gain, and loss.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.
2002-02-24, 4:27 PM #3
No Worky [http://forums.massassi.net/html/frown.gif] I triple checked everythign too [http://forums.massassi.net/html/frown.gif]

------------------
"Does that compute?

Or do I need to draw you a schematic!?"
2002-02-24, 6:16 PM #4
I am SOO ashamed. [http://forums.massassi.net/html/frown.gif]


Code:
# Simple elavator script - random actions.
#
# 02/2002 GBK
Symbols
Message Startup
Message Arrived
Thing Elev
Flex Movespeed=2.0
Flex Min_wait=0.5		#Min amount of time before moving again.
Flex Max_wait=5.0		#Max ^.
Int Num_frames=2
Flex R=0				Local
Int F=0				Local
End
Code
Startup: Call Pick; Stop;
Arrived:  R = Rand() * 10;
While(R < Min_wait || R > Max_wait) { R = Rand() * 10; }
Sleep(R); Call Pick;
Stop;
Pick: F = Rand() * 10;
While(F > Num_frames) { F = Rand() * 10; }
Movetoframe(Elev, F, Movespeed);
Stop;
End



I did test it. It works now.

------------------
Success is the inverse relationship between effort, gain, and loss.

JK editing resources.
And when the moment is right, I'm gonna fly a kite.

↑ Up to the top!