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 → startup, timers, the hecks going on?
startup, timers, the hecks going on?
2002-03-01, 7:49 AM #1
This cog takes a 3do object and starts spinning it irradicately,...too irradicately. I keep changing it but it still doesnt wait for the timer to attach the thing and pivot the 3do. Could someone help me with some insight on what this code is actually doing?

symbols

sector sec1
thing ghost0
thing ghost1
thing ghost2
thing ghost3
thing walkway
int curtemplate=-1 local
flex time desc=speed
flex countdown = 30.0
message startup
message arrived
message timer

end
# ============================================================
code

arrived:
JumptoFrame(walkway, 0, sec1);

startup:

curtemplate=ghost0[rand()*4];
AttachThingtoThingex(walkway, curtemplate, 0x8);
RotatePivot(curtemplate, 0, Time);
SetTimer(countdown);
return;

timer:

WaitForStop(walkway);
DetachThing(walkway);
curtemplate=ghost0[rand()*4];
AttachThingtoThingex(walkway, ghost0[rand()*4], 0x8);
RotatePivot(curtemplate, 0, Time);
SetTimer(countdown);
return;
end
#=============================================================



[This message has been edited by Gelatinous_Drool (edited March 01, 2002).]
2002-03-01, 12:50 PM #2
Without actully dissecting the code, the only thing I see that might cause a problem is this:

 

timer:
WaitForStop(walkway);
DetachThing(walkway);

curtemplate=ghost0[rand()*4];
AttachThingtoThingex(walkway, ghost0[rand()*4], 0x8);
RotatePivot(curtemplate, 0, Time);

 

You attached the object to a random ghost instead of the previously chosen 'curtemplate'.

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

JK editing resources.

[This message has been edited by GBK (edited March 01, 2002).]
And when the moment is right, I'm gonna fly a kite.
2002-03-01, 12:56 PM #3
Code:
symbols

sector sec1
thing ghost0
thing ghost1
thing ghost2
thing ghost3
thing walkway 
int curtemplate=-1 local 
flex time desc=speed
flex countdown = 30.0 
message startup 
message arrived 
message pulse
message timer

end 
# ============================================================
code

arrived:
JumptoFrame(walkway, 0, sec1);

startup:

curtemplate=ghost0[rand()*4];
AttachThingtoThingex(walkway, curtemplate, 0x8);
RotatePivot(curtemplate, 0, Time); 
SetTimer(countdown);
return;

timer: 

WaitForStop(walkway);
DetachThing(walkway);
curtemplate=ghost0[rand()*4];
AttachThingtoThingex(walkway, ghost0[rand()*4], 0x8);
RotatePivot(curtemplate, 0, Time);
SetPulse(countdown);
return;

pulse:
curtemplate=ghost0[rand()*4];
AttachThingtoThingex(walkway, ghost0[rand()*4], 0x8);
RotatePivot(curtemplate, 0, Time);
return;
end
#=============================================================


and i guess if the WaitForStop doesn't work you could use some conditionals along with IsThingMoving, or even simpler put a sleep in there it does the same thing as waitforstop except you define the variable
roses are red, violets are blue, I am schizophrenic, and I am too!
2002-03-01, 3:19 PM #4
I didnt notice that i called the random ghost again instead of using the curtemplate.
It still moves irradicatly however.
I tried the pulse message and, even though there is irradict movement it seems its following the countdown timer...almost.
I count off the timer when it changes.
First the 3do moves strangley to orient itself for the pivot then it moves that way. The time for both movements to finish is accurate with the timer.
Thank you cog-Gods for the help. [http://forums.massassi.net/html/smile.gif] Ill keep tweaking the cog and frames to see if i can smooth out the motion.
2002-03-02, 3:16 PM #5
So this is what i find. With the arrived message listed before startup the cog creates an endless loop WITHOUT pulse or timer. So, Han, your suggestion works but just adds a bunch of unnecessary code.

arrived:
JumptoFrame(walkway,0 ,sec1);
DetachThing(walkway);

startup:
curtemplate=ghost0[rand()*4];
AttachThingtoEx(walkway, curtemplate, 0x8);
RotatePivot(curtemplate, 0 Time);
return;

end

[This message has been edited by Gelatinous_Drool (edited March 02, 2002).]
2002-03-02, 4:16 PM #6
How can i make this run on every machine separately?
I put flags = 0x240 at the top and it doesnt work. It dispalys some text instead that says messageEx is disabled

↑ Up to the top!