Counters
#1

I want to make a counter, where if you say..place an object, it gives it an id of 1, then the next one gives it an id of 2 etc etc. How is this done?
Reply
#2

This is just about the counter?

Use a global variable, like "new ObjectCount = 0;" in the beginning of your script.

Then do something like:

Код:
ObjectID = ObjectCount; // Assign ObjectCount to the variable saving the ID

ObjectCount ++; // Increment ObjectCount by 1.
Or do both in one line:

Код:
ObjectID = ObjectCount ++; // Assign ObjectCount to the variable saving the ID AND Increment ObjectCount by 1 afterwards (++ behind variable name).
Reply
#3

well now...that makes too much sense to actually work!

thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)