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 → GBK's thing counter cog
GBK's thing counter cog
2003-01-03, 4:39 PM #1
Could some one (GBK included) post GBK's thing counter cog's code, or tell me where I might get at it. I have a method for counting things already implemented in my mod, but it isn't air tight...I'm not really looking forward to revamping the whole thing with a new method but I demand perfection!

On a related note, GBK: would you be so kind as to allow me to use the code in my little project? I doubt it will be released before your GBK tools, since its a long way from complete.

Also, if GetThingCount() gets the world placed things, would the total things minus GetThingCount get the number of spawned things in a level?

And I know this has been gone over before but I didn't quite get it...what is a max total things in a level (spawned and placed) and what is the max spawned and placed things that can be in a level. I'm pretty sure spawned it 200 but I'm unsure of the others.
2003-01-03, 6:22 PM #2
Here it is, in all its pristine glory.
Code:
# Script to retrieve actual thing count.
#
# 03/2002 GBK - Packman573@aol.com

Symbols

Message Activated
Message Pulse

Int I=0				Local
Int C=0				Local
Int L=0				Local

End
Code

Activated:
If(L==0) { Setpulse(0.05); L=1; }
Else If(L==1) { Setpulse(0); L=0; }
Stop;
Pulse:
For(I=0;I<=640;I=I+1) If(Getthingsignature(I) != -1) C = C + 1;
Printint(C);
C=0;
Stop;
End


Unless I state absolutely otherwise, you can use any cog of mine, any of my code, for any purpose you see fit, just as long as you mention where it came from.

'Getthingcount()' returns the absolute max possible things in the level, which is defined in the JKL. In my levels, I usually manually edit the JKL and up the limit to the max (640). There is no way to get the number of "placed things", unless you run the above code on startup and save the int...
And when the moment is right, I'm gonna fly a kite.
2003-01-04, 8:51 AM #3
Ah! Getthingsigniture...makes sense, a thing that doesn't exist wouldn't have a signiture! So simple its genius.

Thanks GBK, this will allow me to safely implement stuff like bullet holes, corpses and any other spawned junk that hangs around without having to worry about the thing limit. (by modifying their respective cogs)
2003-01-04, 8:59 AM #4
Oh, wait, a few more questions...

Is it save to assume that the number of spawned things would be the total number of things in the game minus the original number of things at startup?

Why not use GetThingCount() in place of the 640? If the max number of things in a particular levels jkl is say 350 then wouldn't it be impossible for values after that to exist? And on your levels it should just return 640 anyway right?

Does this cog cause any discernable slowdown? I should not have any trouble running it constantly is what I'm asking.

[This message has been edited by Wave_Of_Mutilation (edited January 04, 2003).]

[This message has been edited by Wave_Of_Mutilation (edited January 04, 2003).]
2003-01-04, 9:10 AM #5
Nah, Getthingsignature() is a light verb, IE, it doesnt cause slowdown.

Yeah, its safe to assume that the # of things existing - the # of things at startup would be the # of spawned things...
And when the moment is right, I'm gonna fly a kite.
2003-01-04, 9:32 AM #6
Cool thanks, and about getthingcount in the for loop? (sorry I just edited to add that Q)
2003-01-04, 9:57 AM #7
Well, Ive seen levels in whice more objects than the "world thing" limit could be created . . . so I always use 640. And besides, its less to type. [http://forums.massassi.net/html/tongue.gif]
And when the moment is right, I'm gonna fly a kite.

↑ Up to the top!