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 → One pesky procedure...
One pesky procedure...
2004-04-14, 3:50 PM #1
...that has effectively killed an otherwise operational COG.

I originally had this cutscene send a user0 message to a different cog that contained only this code, but the cog refused to work. I thought that there might have been some mistake in the cog-to-cog message, so I integrated the code into my 02_halldash cog, and now that doesn't work, either. I've isolated the problem to this code:

Code:
activated:
If(GetSenderRef()==book && pulled==0) {
 pulled=1;
 SetTimer(0);
 StopSound(music, 1.0);
player=GetLocalPlayerThing();
SetActorFlags(player, 0xa00000);
StopThing(player);
Print("-[INITIATING LOCKDOWN PROCEDURE]-");
PlaySoundLocal(alarm, 1, 0, 0x0);
MoveToFrame(dcam0, 0, 4);
Sleep(0.25);
SetCameraFocus(0, dcam0);
Sleep(2.0);
CreateThing(lockdoor, leftdoor);
PlaySoundLocal(crash, 1, 0, 0x0);
Sleep(0.75);
SetCameraFocus(0, libcam);
Sleep(0.5);
CreateThing(lockdoor, fardoor);
PlaySoundLocal(crash, 1, 0, 0x0);
Sleep(0.5);
MoveToFrame(dcam0, 1, 4);
Sleep(0.25);
SetCameraFocus(0, dcam0);
Sleep(2.0);
CreateThing(lockdoor, rightdoor);
PlaySoundLocal(crash, 1, 0, 0x0);
Sleep(0.75);
SetCameraFocus(0, backcam);
PlaySoundLocal(break, 1, 0, 0x0);
#CreateThing(sparks, window);
Sleep(2.0);
ClearActorFlags(player, 0xa00000);
SetCameraFocus(0, libcam);
}
return;


Any help would be GREATLY appreciated.
Cordially,
Lord Tiberius Grismath
1473 for '1337' posts.
2004-04-14, 6:27 PM #2
Taking a quick look at it, it looks like the probable cause of the cog-killing is all those "sleep()" s. Try changing it into a timer system.

------------------
Bond, Power, CA, The Force, Saber, IC, Epic, Oily Mexican Food, BG, /\ |> /\ /\/\, Sentences.
Now you know where I've been.
May the mass times acceleration be with you.
2004-04-14, 11:07 PM #3
Just out of curiosity, what's happening in your timer message before you try and kill it - at least I'm assuming you're trying to do that with the "SetTimer(0)" statement. Baring in mind that the "SetTimer()" verb takes two parameters (and you can't treat it like you would to nullify a pulse (eg: "SetPulse(0)" kills a "pulse" message), I think the problem may lie in that line...

Anyways - give it a try (either comment-out the line or use "KillTimer()") and let us know [http://forums.massassi.net/html/smile.gif] Hope this info helps [http://forums.massassi.net/html/biggrin.gif]

-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" - by Adam Lindsay Gordon)
"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 ||
2004-04-15, 7:56 AM #4
*cough*
Ummmm... you must still be tired LJ... [http://forums.massassi.net/html/wink.gif]

KillTimer() isn't a verb, but KillTimerEx() is though. SetTimer() only has one param. Also, you do stop "regular" timers by SetTimer(0). SetTimerEx(0,...) will not stop an extended timer.

Here's a snippet...
Quote:
<font face="Verdana, Arial" size="2">From the Datamaster, VERB = SetTimer:
Calls the timer message after the delay has ended. Syntax:
SetTimer(flex_delay);

To stop the timer, use:

SetTimer(0);
</font>

Quote:
<font face="Verdana, Arial" size="2">From the Datamaster, VERB = SetTimerEx:
Calls the timer message after the given delay and gives an ID and two parameters to the timer message. With SetTimerEx(), you can set a timer with a delay of zero. KillTimerEx() is used to stop an IDed timer. Syntax:
SetTimerEx(flex_delay, ID, param0, param1);

ID: The ID of the timer is retrieved in the timer message with GetSenderID(). It is also used by KillTimerEx() to stop the timer before the message is called.

paramX: These parameters become the first and second parameters of the timer message.
</font>

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

My suspicion, Jackpot, is that you were thinking Extended Timers (or maybe SetTningTimer() ) instead of "Regular" timers.

But yeah, what is in the timer message, Grismath? I hadn't considered that that might be the problem.

------------------
Bond, Power, CA, The Force, Saber, IC, Epic, Oily Mexican Food, BG, /\ |> /\ /\/\, Sentences.
Now you know where I've been.

[This message has been edited by Darth Slaw (edited April 15, 2004).]
May the mass times acceleration be with you.
2004-04-15, 12:30 PM #5
Well I do have a confession to make - I didn't have the DataMaster at hand (being at work and all) [http://forums.massassi.net/html/wink.gif] Either that or the old memory's wearing out - far too much Java recently - too tell the truth, it's been a while since I did any COG [http://forums.massassi.net/html/redface.gif]. However, as you say, without the DM to hand, I think I may well have been thinking of extended timers [http://forums.massassi.net/html/rolleyes.gif].

I still stand by my question of what lies in the timer message though [http://forums.massassi.net/html/wink.gif] [http://forums.massassi.net/html/biggrin.gif]

-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" - by Adam Lindsay Gordon)
"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!