The Daily Click ::. Forums ::. Klik Coding Help ::. Selection count
 

Post Reply  Post Oekaki 
 

Posted By Message

Don Luciano

Heavy combat pancake

Registered
  25/10/2006
Points
  380

VIP Member
18th March, 2007 at 17:08:47 -

i have made a mouse drag rectangle selection for units.
It works fine and all that.

But i want to count how many units are currently selected.

I v made several flags and animation changes while they are selected.
And they are mostly all duplicates, and all of them belong to group.keys, so i want a counter to tell me how much units are selected at that moment.

 
Code me a sausage!

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
18th March, 2007 at 17:46:19 -

There was an object for MMF 1.5 called Selected Object Counter, which could do something like that. Not sure if it's been ported yet though.

But I'm pretty sure you could do it with fastloop/spread a value.

 
n/a

Deleted User
18th March, 2007 at 18:27:53 -

Exactly, use a fastloop to cycle through the objects to check if they are selected or not.
Pretty simple.

 

Don Luciano

Heavy combat pancake

Registered
  25/10/2006
Points
  380

VIP Member
19th March, 2007 at 07:19:42 -

I don't get it, how do i set up the loop? can u please explain me.
I just want to count how many units have flag 1.

 
Code me a sausage!

Don Luciano

Heavy combat pancake

Registered
  25/10/2006
Points
  380

VIP Member
20th March, 2007 at 09:13:43 -

Well i figured it out, haven't even seen the pick all objects with flag

 
Code me a sausage!

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
20th March, 2007 at 19:26:00 -

Spread value, start loop for number of loops equal to the number of objects of this type, when the spread'd alt value = loop step -1 AND flag is on, add 1 to counter.

 
n/a

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
20th March, 2007 at 23:33:03 -


flag 0 of Active is on
---counter: set value to 0
---Active: spread value 0 in alterable value A
---start loop "test" for count("Active") loops

on loop "test"
+Active: alterable value A is equal to LoopIndex("test")
+flag 0 of Active is on
---counter: add 1 to counter

 
n/a
   

Post Reply



 



Advertisement

Worth A Click