Author Topic: Wait For Keys  (Read 22675 times)

0 Members and 2 Guests are viewing this topic.

SirCmpwn

  • Guest
Wait For Keys
« on: September 19, 2010, 01:20:22 pm »
Hello,
What is a good Axe routine to wait for all keys to be released?

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Wait For Keys
« Reply #1 on: September 19, 2010, 01:21:26 pm »
While getKey(0)
End
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Wait For Keys
« Reply #2 on: September 19, 2010, 01:27:57 pm »
While getKey(0)
End

^++ This.
No better way to my knowledge ;D
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

SirCmpwn

  • Guest
Re: Wait For Keys
« Reply #3 on: September 19, 2010, 01:28:53 pm »
Ah, I was using While getKey:End

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Wait For Keys
« Reply #4 on: September 19, 2010, 01:30:15 pm »
You could add a DispGraphr inside that loop, so that if you're using grayscale or something, it'll still be smooth.
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

SirCmpwn

  • Guest
Re: Wait For Keys
« Reply #5 on: September 19, 2010, 01:31:06 pm »
Right, that much I know.  And I usually use 4 level, so DispGraphrr would be more appropriate :)

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Wait For Keys
« Reply #6 on: September 19, 2010, 01:39:52 pm »
While getKey(0)
End

That doesn't work in Doors CS, though. I believe I had issues with Mirage as well as WabbitEmu. but again maybe Axe Tunnel was using a slightly different code.
« Last Edit: September 19, 2010, 01:40:14 pm by DJ Omnimaga »

_player1537

  • Guest
Re: Wait For Keys
« Reply #7 on: September 19, 2010, 07:18:22 pm »
I have to do this in my code:
Code: [Select]
while getKey(0)
Pause 50
End
Otherwise it exits the loop randomly :O

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Wait For Keys
« Reply #8 on: September 19, 2010, 07:57:25 pm »
I have to do this in my code:
Code: [Select]
while getKey(0)
Pause 50
End
Otherwise it exits the loop randomly :O

Really?
The loop is suppose to exit only when you release the key - are you sure you aren't accidentally letting go of a button?
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Wait For Keys
« Reply #9 on: September 19, 2010, 08:19:00 pm »
Maybe you're not holding down a button when it starts. Try

Code: (Axe) [Select]
:Repeat getKey(0)
:End
:While getKey(0)
:End

and see if it works.




Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: Wait For Keys
« Reply #10 on: September 19, 2010, 08:53:31 pm »
I have to do this in my code:
Code: [Select]
while getKey(0)
Pause 50
End
Otherwise it exits the loop randomly :O

dittoes(i was getting a bit frustrated about it last night)...

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Wait For Keys
« Reply #11 on: September 19, 2010, 09:03:46 pm »
getKey(0) is just really fast.. so without any pause between checking getKey(0) will mess things up. you should be okay with this:
Code: [Select]
While getKey(0)
Pause 3
End


Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Wait For Keys
« Reply #12 on: September 19, 2010, 09:58:53 pm »
I generally add a Pause(50) also.

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Wait For Keys
« Reply #13 on: September 19, 2010, 10:54:31 pm »
If you're in Full mode then the delay in the key routine is too quick to register the key-group switch.  Make sure you're in Normal mode when using direct key detection.
« Last Edit: September 19, 2010, 10:54:49 pm by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Wait For Keys
« Reply #14 on: September 19, 2010, 11:24:05 pm »
Oh I see why there are issues now. Key delay was too short. Gonna have to fix Axe Tunnel at one point then...