object counter?

hello, i just made a pointless game where all you do is look around with the mouse and spawn pistols… yeah. well i have the mouse button sensor and a random sensor tied togethor so it spawns alot of them really fast. I just want to know if there was a way to have a counter that counts how many objects were spawned. Even though this game is pointless and it cant even be called a game, i would like to know this for future projects.

and also, i have it set up so that the c key on the keyboard will remove all of the objects, because the frame rate reallly drops with too many physics calculations. so i would like the number to return to zero when i do this. im sure thats the easiest part to do.

anyone know how to do this?

Have the object that spawns set up like this:

. . . . .\
. . . . . \______o(And)o----------o(Prop (Add 1))

And for the Removing of objects, have the logic of the spawned object as

(Keyboard ("C"))o----------o(And)o----------o(Edit Object (Remove))

If you use a python script instead of an “and” controller, you can have a GameLogic property that gets added every time the script is called. Like:

import GameLogic
GameLogic.totalObjects = GameLogic.totalObjects + 1
(rest of script)

thats the kind of idea i was looking for chaser, but im using the latest build of blender that erwin included in the last preview number 11. and for some reason you can see the debug info while the game is running. its odd. so i have it all set up, but i was wondering if maybe i could use the texture with the letters and numbers on it and use that to make a counter with.

If you know python, you could use the output widow. Actually, you could use this code:

import GameLogic as gl
con = gl.getCurrentController()
own = con.getOwner()

print own.prop #Change "prop" to the property name of the objects counted

Link the python script to an always sensor with positive pulse at frequency 25