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 → How can I do this in cog?
How can I do this in cog?
2001-08-09, 7:29 AM #1
First, how can I tell if a thing is destroyed? And second, how can I use brackets in cog. I want to do something like this:

thing[flex] = GetSenderRef();

The flex could be 1 - 5, and there are 5 things(thing1, thing2, etc) the flex and the thing can equal. Would it work?

------------------
*Rrrring* Microsoft has advanced to the Imperial Age.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2001-08-09, 9:42 AM #2
You can use arrays in cog, it's no problem...
--
You are all just jealous because you can't hear the small voices!!
2001-08-10, 12:27 AM #3
Thanks, Raze. But I still need to know how to tell if a thing is destroyed. -A projectile in this case.

------------------
*Rrrring* Microsoft has advanced to the Imperial Age.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2001-08-11, 3:18 AM #4
What exactly do you want to do with it?
I mean, you could probably do:

startup:
setpulse(0.2);
return

pulse:
if(GetThingPos(thing) == 0) call destroyed;
return;

destroyed:
do whatever here
return;
--
You are all just jealous because you can't hear the small voices!!
2001-08-11, 8:16 AM #5
So, if(Getthingpos(proj) == 0) will tell me if the projectile has been removed? Here's what I want to do with it:

created:

if proj1 is destroyed, assign getsenderref to proj 1. Then set a looping timer with an id of 1 to control the projectile.

else if proj2 is destroyed, etc.

That continues till the created message finds a projectile that's not in use. When it finds one getsenderref becomes one of the projectiles that are controlled by this template cog.

Return;
#===========#
Timer:

id=Getsenderid();

if(id == 1)
{
control proj1 and set timer again.
}
if(id == 2) etc...

Return;
#============#
Removed:

find out which missile was destroyed and clear its variables.

Return;

I'm using looping timers instead of a pulse to control the actions of the projes because I can have more than one timer in a cog.


------------------
*Rrrring* Microsoft has advanced to the Imperial Age.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2001-08-11, 8:18 AM #6
I'll try using getthingpos, and post again when I'm done. Thanks, Raze.

------------------
*Rrrring* Microsoft has advanced to the Imperial Age.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2001-08-11, 1:06 PM #7
Sabermaster , attatch a cog to the weapon and then in it put

message removed

removed:

//do stuff

return;
2001-08-12, 1:16 AM #8
See, there was an easier way to it lol and hey Seifer, go over to my SyncThingState thread and help me please =) .

-Raze
--
You are all just jealous because you can't hear the small voices!!
2001-08-12, 9:55 AM #9
I'm using a removed message already. What I want is something to see if the proj is destroyed. IE, if(proj is destroyed). I don't want to rely on the removed message because the removed message may not be called. Is there a something that can do this, or do I have to check whether it has position, speed, etc?

------------------
*Rrrring* Microsoft has advanced to the Imperial Age.
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2001-08-12, 5:54 PM #10
Ahhh , yes indeed , i suggest you use if(IsThingMoving(proj) == 0)

Because a projectile never stops unless it's destoryed ...... unless it attatches it self to something.
2001-08-13, 11:33 AM #11
Isthingmoving works fine. Thanks *_Seifer_* [http://forums.massassi.net/html/smile.gif]

------------------
Truth is in the eye of the beholder
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.

↑ Up to the top!