The Daily Click ::. Forums ::. Klik Coding Help ::. Accumulative counter
 

Post Reply  Post Oekaki 
 

Posted By Message

Dave S.



Registered
  26/09/2003
Points
  924
22nd December, 2003 at 12:20:52 -

I'm using a counter for the expression... 'add one to counter everytime a movement key is pressed. This works fine but each level is made of four sub-levels or phases. At each sub level the counter sets to zero. I also need a second counter for the accumulative total of each counter on each sub-level.

eg: lets say phase one (of level one) is completed in 12 moves. The game then continues with phase two (of level one) with the counter set at zero (which is default) and another counter with a minimum value of 12 (the score from the first phase) which will be added to as the game progresses.

In other words I want a score for each phase independently and a total score for all four phases added together... not much to ask is it?

I've tried all the obvious things like set counter '2' to the current value of counter '1' but to no avail as it always sees it as zero.

Thanks, Dave S.

 
n/a

Klikmaster

Master of all things Klik

Registered
  08/07/2002
Points
  2599

Has Donated, Thank You!You've Been Circy'd!VIP MemberPS3 Owner
22nd December, 2003 at 12:40:25 -

Tell the second counter to do exactly the same as the first, but dont set it to zero, or when there is a new phase, add the first counter value to the second counter then reset the first

 
n/a

Dave S.



Registered
  26/09/2003
Points
  924
22nd December, 2003 at 15:41:04 -

Right, I must be thick or something as I don't know how to add the first counter value to the second counter as it resets to zero on each phase.

Thanks, Dave S.

 
n/a

Klikmaster

Master of all things Klik

Registered
  08/07/2002
Points
  2599

Has Donated, Thank You!You've Been Circy'd!VIP MemberPS3 Owner
22nd December, 2003 at 17:25:57 -

In event editor
condition >> add to counter2 >> value of counter 1

 
n/a

cake



Registered
  13/12/2002
Points
  1173
22nd December, 2003 at 22:53:12 -

Double click on the event and make sure your actions are in the correct sequence, ie:

Add value("counter 1") to counter 2
Set counter 1 to 0

An alternative is to use a global value instead of a second counter too, I don't know if the sub-levels are in separate frames or not.

 
n/a

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
23rd December, 2003 at 22:10:24 -

You use an action to reset the counter to 0, right? Can't you add the first counter value to the second counter value just before you set the first counter to 0? Event orders matter, ya know?

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image

Dave S.



Registered
  26/09/2003
Points
  924
24th December, 2003 at 01:13:45 -

Muz, that's the point, on each new frame the counter resets itself to zero every time The current value at the end of each frame is lost. How do I retrieve that information?

Dave.

 
n/a

cake



Registered
  13/12/2002
Points
  1173
24th December, 2003 at 04:54:27 -

Store the value in a global value. Global values are global to all frames, they do not reset unless the entire application restarts.

 
n/a

Dave S.



Registered
  26/09/2003
Points
  924
26th December, 2003 at 07:58:01 -

Dave C, I can't do that either.

Biax, I've looked in Global values but don't understand it. The main title is current value... underneath that is value number (from 0-15) and a global value.

I've given up with it... something that should be so simple to do!

Dave S.

 
n/a

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
26th December, 2003 at 22:31:39 -

Oh, you meant transfer them between frames. I thought it was something on the same frame or so.

Don't worry, it's very simple. What program are you using? I'm not sure if you can tick the global object thing in anything less than MMF 1.5.

If you don't have 1.5, just do the global values thing. It works just like your everyday counter. Except it uses a value number instead of a name.

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image

Dave S.



Registered
  26/09/2003
Points
  924
27th December, 2003 at 02:06:28 -

Muz, I'm using MMF 1.5 but where do I go to tick the global object.

My counters always reset to zero whatever I try, even I press escape to restart the current frame.

Seasons greetings, Dave S.

 
n/a

Shen

Possibly Insane

Registered
  14/05/2002
Points
  3497
27th December, 2003 at 03:24:56 -

It's under 'special'

 
gone fishin'
   

Post Reply



 



Advertisement

Worth A Click