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 → Need an eleveator cog that handles 4 frames.
Need an eleveator cog that handles 4 frames.
2001-04-21, 12:32 PM #1
Just like the LEC elevator cog, where you step through an adjoin, and it goes down or up, but handles 4 frames.
DO NOT WANT.
2001-04-21, 1:39 PM #2
Please? Anyone? [http://forums.massassi.net/html/frown.gif]
DO NOT WANT.
2001-04-21, 7:18 PM #3
Hope this is what you were looking for [http://forums.massassi.net/html/smile.gif]

Code:
# Jedi Knight Cog Script
#
# modified elevator cog
#

symbols
	message	crossed
	surface	lower_adjoin
	surface upper_adjoin
	
	thing		elevator

	float		wait=0.25
	float		speed=4.0
        int             ready=1       local
end

## Code Section
code
crossed:
	if (IsThingMoving(elevator)) return;
	if ((GetCurFrame(elevator) != 0) || (GetCurFrame(elevator) != 3)) return;
        if (GetCurFrame(elevator) == 0)
	{
        ready=0;
	Sleep(wait);
	MoveToFrame(elevator, 1, speed);
	WaitForStop(elevator);
	MoveToFrame(elevator, 2, speed);
	WaitForStop(elevator);
	MoveToFrame(elevator, 3, speed);
	WaitForStop(elevator);
	}
        if ((GetCurFrame(elevator) == 3) && (ready == 1))
	{
	Sleep(wait);
	MoveToFrame(elevator, 2, speed);
	WaitForStop(elevator);
	MoveToFrame(elevator, 1, speed);
	WaitForStop(elevator);
	MoveToFrame(elevator, 0, speed);
	WaitForStop(elevator);
	}
        ready=1;
	return;

end


-------
dBcLiCk (The Spaman)
2001-04-22, 3:47 AM #4
OH YAH tannk you now I can release my boredom level on the showcase forum as soon as I make it a bit bigger!! [http://forums.massassi.net/html/smile.gif] [http://forums.massassi.net/html/biggrin.gif] [http://forums.massassi.net/html/smile.gif] [http://forums.massassi.net/html/wink.gif] [http://forums.massassi.net/html/smile.gif] [http://forums.massassi.net/html/biggrin.gif]
DO NOT WANT.
2001-04-22, 4:04 AM #5
Hmmm... could you tell me what to do to add a switch to the cog, I mean a call switch on both sides, top or bottom?
DO NOT WANT.
2001-04-23, 10:44 AM #6
This addition to the cog should include a top and bottom call surface that will call the elevator if is at the opposite end.
Note: The call switch surfaces must be textured with a mat that has two cells(ie: first cell=off, second cell=on).
I even made the swithes play a sound when pressed. [http://forums.massassi.net/html/smile.gif]

Code:
# Jedi Knight Cog Script
#
# modified elevator cog with call switches
#
symbols
	message	crossed
	message activate
	surface	lower_adjoin
	surface upper_adjoin
	surface lower_call	linkid=1
	surface upper_call	linkid=2
	thing		elevator
	float		wait=0.25	
	float		speed=4.0       
	int             ready=1       local
	sound		beep=activate02.wav
end
## Code Section
code
crossed:
	if (IsThingMoving(elevator)) return;
	if ((GetCurFrame(elevator) != 0) || (GetCurFrame(elevator) != 3)) return;
        if (GetCurFrame(elevator) == 0)
	{
        ready=0;
	Sleep(wait);
	MoveToFrame(elevator, 1, speed);
	WaitForStop(elevator);
	MoveToFrame(elevator, 2, speed);
	WaitForStop(elevator);
	MoveToFrame(elevator, 3, speed);
	WaitForStop(elevator);
	}
        if ((GetCurFrame(elevator) == 3) && (ready == 1))
	{
	Sleep(wait);
	MoveToFrame(elevator, 2, speed);
	WaitForStop(elevator);
	MoveToFrame(elevator, 1, speed);
	WaitForStop(elevator);
	MoveToFrame(elevator, 0, speed);
	WaitForStop(elevator);
	}
        ready=1;
	return;

activate:
	if (! IsThingMoving(elevator)) return;
	if ((GetCurFrame(elevator) != 0) || (GetCurFrame(elevator) != 3)) return;
	if ((GetSenderId()=1) && (GetWallCell(lower_call)=0))
	{
		SetWallCell(lower_call,1);
		PlaySoundPos(beep, GetSurfaceCenter(lower_call), 1.0, -1, -1, 0);
		MoveToFrame(elevator, 1, speed);
		WaitForStop(elevator);
		MoveToFrame(elevator, 2, speed);
		WaitForStop(elevator);
		MoveToFrame(elevator, 3, speed);
		WaitForStop(elevator);
		SetWallCell(lower_call,0);
		
	}
	if ((GetSenderId()=2) && (GetWallCell(upper_call)=0))
	{
		SetWallCell(upper_call,1);
		PlaySoundPos(beep, GetSurfaceCenter(upper_call), 1.0, -1, -1, 0);
		MoveToFrame(elevator, 2, speed);
		WaitForStop(elevator);
		MoveToFrame(elevator, 1, speed);
		WaitForStop(elevator);
		MoveToFrame(elevator, 0, speed);
		WaitForStop(elevator);
		SetWallCell(upper_call,0);
	}
end


Hope this works. [http://forums.massassi.net/html/wink.gif]

↑ Up to the top!