The Daily Click ::. Forums ::. Klik Coding Help ::. Problems with menu
 

Post Reply  Post Oekaki 
 

Posted By Message

7Soul



Registered
  12/08/2008
Points
  167
24th August, 2008 at 19:49:27 -

Im making a menu controlled by the arrow keys, something like this:

Menu=0
Move Down >>> Set Menu=1

Menu=1
Move Down >>> Set Menu=2

Menu=2
Move Down >>> Set Menu=3

But this isnt working, it jumps straight to Menu=3
Someone knows how to fix this?

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
24th August, 2008 at 19:53:36 -

Ah yes, this darnded thing. What it's doing is reading the button presses every time it runs through the events, which is very fast. You may want to have it set a counter to 0 when the button isn't pressed-- then have it set to 1 when it is pressed. Then do this:

Menu=0 + pressed down+ counter equals 1 >> change menu selection, set counter to 2.

That should work theoretically.

If you hold on a minute I'll try to do more exact events.

Image Edited by the Author.

 

  		
  		

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
24th August, 2008 at 19:58:18 -

Repeat while moving down + counter does not equal 2 >> set counter to 1
(Negate) Repeat while moving down >> Set counter to 0

Menu=0 + Moved down + Counter=1 (May need to be 0 instead of 1, depending on your order of events) >> Set counter to 2 + Set Menu=1

Menu=1 + Moved down + Counter=1 >> Set counter to 2 + Set Menu=2

Menu=2 + Moved down + Counter=1 >> Set counter to 2 + Set Menu=3

I think that should work.

 

  		
  		

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
24th August, 2008 at 20:09:34 -

OR, if you want them to be able to hold down the button, just add an "every such and such seconds" I guess.

 

  		
  		

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
24th August, 2008 at 21:02:13 -

or you could try

upon pressing up + counter is more than 0 >>> subtract 1 from Menu
upon pressing down + counter is less than 2 >>> Add 1 to Menu

Menu = 0 >>> do whatever
Menu = 1 >>> do whatever else
Menu = 2 >>> do stuff

 
.

緑葉



Registered
  24/08/2008
Points
  145
24th August, 2008 at 21:07:07 -

Using counters is the easiest solution in my opinion

When counter = 1, change animation to bla bla, change the others to unactive :S

When animation bla bla is active, upon pressing enter, do bla bla

 
n/a

Eternal Man [EE]

Pitied the FOO

Registered
  18/01/2007
Points
  2955

Game of the Week WinnerHero of TimeLOL SignI am an April Fool
24th August, 2008 at 21:53:43 -

The easiest way IMHO is to use a flag. (You could just use a value for the same purpose but I find flags easier)

ABOVE all menu code have the event: Xmove up + Xmove down (+ any other dir you might need) --> Set flag 0 off.

Then in the menu code add the condition "flag 0 is off".

Ex: flag 0 is off + move down --> Do whatever to menu + set flag 0 on.

Then you can add whatever you want to that as long as you set flag 0 on.

It's important to have the "set flag 0 off" event above the rest or MMF will interpret it "wrong". (Actually MMf wont interpret it wrong, but your code would be contradictory to your purpose thus giving the wrong result)

 
Eternal Entertainment's Code'n'Art Man

E_E = All Indie


...actually Ell Endie, but whatever.
Image
Image

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
24th August, 2008 at 22:37:31 -

the easiest way is the way andy said.
its how i always have done and always will do menus controlled by keystrokes.

now do it!



 
n/a

Eternal Man [EE]

Pitied the FOO

Registered
  18/01/2007
Points
  2955

Game of the Week WinnerHero of TimeLOL SignI am an April Fool
24th August, 2008 at 22:46:17 -

I was so sure that would only yield the same result as the initial, so I made a app to test it, and lo , it worked! It really is the easiest and probably best way to do it. Miraculous really.

 
Eternal Entertainment's Code'n'Art Man

E_E = All Indie


...actually Ell Endie, but whatever.
Image
Image

7Soul



Registered
  12/08/2008
Points
  167
24th August, 2008 at 22:49:21 -


Originally Posted by OldManClayton
Repeat while moving down + counter does not equal 2 >> set counter to 1
(Negate) Repeat while moving down >> Set counter to 0

Menu=0 + Moved down + Counter=1 (May need to be 0 instead of 1, depending on your order of events) >> Set counter to 2 + Set Menu=1

Menu=1 + Moved down + Counter=1 >> Set counter to 2 + Set Menu=2

Menu=2 + Moved down + Counter=1 >> Set counter to 2 + Set Menu=3

I think that should work.




That worked perfectly, thx

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
24th August, 2008 at 23:29:00 -


That worked perfectly, thx



You're quite welcome.


 

  		
  		
   

Post Reply



 



Advertisement

Worth A Click