The Daily Click ::. Forums ::. Klik Coding Help ::. A little counter problem
 

Post Reply  Post Oekaki 
 

Posted By Message

Robbert



Registered
  19/06/2003
Points
  420
21st October, 2006 at 06:22:59 -

Hi,

I have worked with MMF for some years now, but there's still a little thing I find anoying. It's about counters.
I am making a version of "Lingo" (the game in which you are to guess the right word).

So I have this code:

If Counter = 0
+ Upon Pressing "A" :

Set String1 to "A"
& Add 1 to Counter


Then the counter goes to 1, which is the second letter of the word you want to type.

If Counter = 1
+ Upon Pressing "A":

Set String2 to "A"
& Add 1 to Counter

"A" is just the letter. It can be anything from A to Z. The problem is that when you type "A" for the first letter, it will do it for the second as well (and probably the other 4 letters too, which I did not code yet). So, the counter is "too fast". Does anyone recognize this problem and has a simple solution to this?

 
Hey mates, I'm Iglo yeah =P!

Joe.H

Evil Faker

Registered
  19/08/2002
Points
  3305
21st October, 2006 at 06:28:40 -

add a condition which is "Only one action when event loops"

 
My signature is never too big!!!

Robbert



Registered
  19/06/2003
Points
  420
21st October, 2006 at 06:31:55 -

That does not work unfortunately

 
Hey mates, I'm Iglo yeah =P!

Peblo

Custom ratings must be 50 characters or less

Registered
  05/07/2002
Points
  185

Game of the Week WinnerVIP MemberI'm on a Boat360 OwnerAttention GetterThe Cake is a LieCardboard BoxHero of TimePS3 OwnerIt's-a me, Mario!
I'm a Storm TrooperSonic SpeedStrawberryI like Aliens!Wii OwnerMushroomGhostbuster!
21st October, 2006 at 07:18:28 -

Huh, you do your events stupidly. The order the conditions go in matters. Try this, it works for me. There's more ways to do it though, this is just the easiest.

*Only one action when event loops
*Upon Pressing "M"
*If Counter = 0
-Events

Alternativly, you can put in another counter and change the event list to this...

*Only one action when event loops
*Upon Pressing "M"
*If Counter = 0
*If CounterB = 0
-Set CounterB to 10
-Other events

*Always
-Sub 1 from Counter B

Maybe, I'm too lazy to test if it actually works.

Image Edited by the Author.

 
"Isn't it always amazing how we characterize a person's intelligence by how closely their thinking matches ours?"
~Belgarath

Robbert



Registered
  19/06/2003
Points
  420
21st October, 2006 at 07:29:28 -

Thank you. Your alternative version did the job

 
Hey mates, I'm Iglo yeah =P!

Peblo

Custom ratings must be 50 characters or less

Registered
  05/07/2002
Points
  185

Game of the Week WinnerVIP MemberI'm on a Boat360 OwnerAttention GetterThe Cake is a LieCardboard BoxHero of TimePS3 OwnerIt's-a me, Mario!
I'm a Storm TrooperSonic SpeedStrawberryI like Aliens!Wii OwnerMushroomGhostbuster!
21st October, 2006 at 07:40:08 -

MMF has to run through the event list 50 times a second. So, MMF looks at each line one at a time. It'll run through all the conditionals on that line until it hits one that negates the line (and moves on to the next) or fufils the conditionals and does the events. So, put conditionals that are negated easily (like if the player presses a button) near the top. Totally irrevelant, it's just good habbits.

 
"Isn't it always amazing how we characterize a person's intelligence by how closely their thinking matches ours?"
~Belgarath

Klikmaster

Master of all things Klik

Registered
  08/07/2002
Points
  2599

Has Donated, Thank You!You've Been Circy'd!VIP MemberPS3 Owner
21st October, 2006 at 08:07:14 -

Instead of having a second counter, you could have a flag that needs to be off to run the event. Then when you press a key, it becomes true, thus stopping it using the next event.

 
n/a

Werbad



Registered
  18/09/2002
Points
  235
21st October, 2006 at 16:26:23 -

Or, you could just reverse the event order, checking the last letter first etc.
Should solve the problem...

 
n/a
   

Post Reply



 



Advertisement

Worth A Click