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 → Elevator cog
Elevator cog
2004-10-05, 3:46 PM #1
Trying to make my own dandy little elevator cog. Each surface is linkid'ed to the next frame the lift should move to. i.e., when the down6 button is pressed, doora0 and doorb0 close, it moves to frame 1, and then doora1 and doorb1 open.

Code:
# Jedi Knight Cog Script
#
# filename.cog
#
# Description
# 
#
# This Cog is Not supported by LucasArts Entertainment Co

symbols

message	activated

thing		lift

thing		doora0				// 6th-floor door
thing		doorb0				// 6th-floor door
thing		doora1				// 5th-floor door
thing		doorb1				// 5th-floor door

surface	call6		linkid=0	// 6th-floor call button
surface	call5		linkid=1	// 5th-floor call button

surface	down6		linkid=1	// 6th-floor down button
surface	down5		linkid=2	// 5th-floor down button

surface	up5		linkid=0	// 5th-floor up button

sound		elev_stop=df_elev2-3.wav	local

int		idgetr=0			local
int		previd=0			local

end

#=======================================

code

activated:

	idgetr=GetSenderID();
	previd=idgetr-1;
	if (GetCurFrame(lift) == idgetr) {
		PlaySoundThing(elev_stop, lift, 1.0, -1, -1, 0x0);
		return;
		}
	else {
		Sleep(3.0);
		MoveToFrame(doora0[previd], 0, 2);
		MoveToFrame(doorb0[previd], 0, 2);
		WaitForStop(doora0[previd]);
		Sleep(1.75);
		MoveToFrame(lift, idgetr, 3);
		WaitForStop(lift);
		Sleep(1.75);
		MoveToFrame(doora0[idgetr], 1, 2);
		MoveToFrame(doorb0[idgetr], 1, 2);
		return; 
		}
		
		


# ........................................................................................

end


Everything works fine until I get to frame 1. Then doora1 opens, doorb0 opens, and doorb1 remains closed. What am I doing wrong here?
the idiot is the person who follows the idiot and your not following me your insulting me your following the path of a idiot so that makes you the idiot - LC Tusken
2004-10-09, 2:55 AM #2
Just in case you're still having problems Wolfy, I have a couple of thoughts that might help (although I make no promises...)

1.) Include a "return" statement at the end of your activated function and remove the "return" statements you have in your "if-else" comparative clauses.

2.) Be careful when using linkid - one of the things I think could be causing a hiccup in your cog could be where you use "previd" to equal "GetSenderID()-1" as part of a frame movement check: what if your linkid=0 :o - you then end up with a -1 number for an (invalid) frame target.

Anyways, t'is early here (and as such, could be mistaken), but it's at least a couple of options to look into...

Hope this info helps :D

-Jackpot
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||

↑ Up to the top!