Mkay, so I'm making a game that needs me to be able to have people use different buttons as getkeys but i don't know how to do it. When i run it the way i do, it makes me do each getkey individually instead of letting me do them all at once.


Help?
If you are using basic, you cannot do more than one key press per loop. Just the limitations of BASIC. I do think there is an asm program out there that allows for more than one key to be detected at once, but I don't remember what it was. =/
tifreak8x wrote:
If you are using basic, you cannot do more than one key press per loop. Just the limitations of BASIC. I do think there is an asm program out there that allows for more than one key to be detected at once, but I don't remember what it was. =/


K. There goes that plan...
tifreak8x wrote:
If you are using basic, you cannot do more than one key press per loop. Just the limitations of BASIC. I do think there is an asm program out there that allows for more than one key to be detected at once, but I don't remember what it was. =/
Indeed there is, and if we can't find it, that's pretty straightforward to replicate. Just an input var for the group to enable and an output var of the keymask returned.

PS - moved this to TI-BASIC.
I strongly recommend you use xLIB...
ZagorNBK wrote:
I strongly recommend you use xLIB...


seconded
I would third that, but I would recommend Celtic III instead, it's much better
Eeems wrote:
I would third that, but I would recommend Celtic III instead, it's much better


I've had no luck with Celtic so far, and I'm just gonna do this project the way it is for now, but i'll work on learning Celtic later.
If you use Celtic, then don't use the app, it's much too buggy, especially with the xLIB routines... Use the program version instead.
ZagorNBK wrote:
If you use Celtic, then don't use the app, it's much too buggy, especially with the xLIB routines... Use the program version instead.


K
ZagorNBK wrote:
If you use Celtic, then don't use the app, it's much too buggy, especially with the xLIB routines... Use the program version instead.
actually the app isn't that bad now, there are some bugs, and it doesn't have full compatability, but it still is superior to xLib in what it can do
xLib does NOT support true multiple key presses. It merrily supports multiple key presses on the arrow keys.

However, I whipped up the code below for a simple asm program that takes the key group as input from Ans and outputs the status of the keys in that group to Ans.


Code:
b_call(_rclans)            ;copy the data from Ans to OP1
   b_call(_ConvOP1)         ;convert this to a two byte integer in DE
   ld a,e
   out (1),a
   in a,(1)
   ld h,0
   ld l,a
   b_call(_setxxxxop2)         ;copy the two byte in hl to op2
   ld hl,op2
   rst 20h               ;this is just a faster version of _op2toop1, copying the 9 bytes at hl to op1, the first byte of data is now in Ans
   b_call(_stoans)            ;put the result in Ans
   ret


The above code appeared to work when I tested it, but I didn't test it incredibly thoroughly. If you want a compiled version, let me know and I can upload the actual program somewhere.
Can't you try storing multiple keypresses in a list?
Reapex wrote:
Can't you try storing multiple keypresses in a list?


I'm pretty sure that would be much slower. Plus, b-flats way lets you get only the keypresses you need, which I hope translates into faster speeds.
Reapex wrote:
Can't you try storing multiple keypresses in a list?


This is different than what the original poster wanted (as far as I can tell) and doesn't provide for true simultaneous keypresses. What you are describing is creating a key buffer that stores past keypresses and plays them back to the software as they are needed (much like how computers do it). I'm pretty sure the original poster only wanted to be able to tell if the user was pressing both [2ND] and [ALPHA] at the same time.
b-flat wrote:
Reapex wrote:
Can't you try storing multiple keypresses in a list?


This is different than what the original poster wanted (as far as I can tell) and doesn't provide for true simultaneous keypresses. What you are describing is creating a key buffer that stores past keypresses and plays them back to the software as they are needed (much like how computers do it). I'm pretty sure the original poster only wanted to be able to tell if the user was pressing both [2<sup>nd</sup>] and [ALPHA] at the same time.



No, actually. What I'm trying to do is make it so that if the user presses Y=, it does thing 1. if the user presses window, it does thing 2, etc.

Sorry for the inconvienence.
OH; in that case, then you want something like this:


Code:
:While K!=45 (45 is the key code for Clear)
:GetKey -> K
:End
:If K=11 (11 is the key code for Y=)
:Then
:Do stuff here
:End
:If K=12 (12 is the key code for Windows)
:Then
:Do stuff here
:End


You can determine the key code by making the two-digit number that has the first digit the row that the key is in and the second digit the column that the key is in.

This isn't exactly simultaneous key presses, however...
b-flat wrote:
OH; in that case, then you want something like this:


Code:
:While K!=45 (45 is the key code for Clear)
:GetKey -> K
:End
:If K=11 (11 is the key code for Y=)
:Then
:Do stuff here
:End
:If K=12 (12 is the key code for Windows)
:Then
:Do stuff here
:End


You can determine the key code by making the two-digit number that has the first digit the row that the key is in and the second digit the column that the key is in.

This isn't exactly simultaneous key presses, however...



First, where it says K!=45, whats with the !?

Second, I Didn't name the topic Kerm did. I called it "Help" when i started it. :/
OK; I guess I'll blame Kerm then.

Anyway, != is used to stand for the does not equal symbol on the calculator because I do not know how to type that on my keyboard. It is located on the same menu as equals (2nd + math to get to the test menu, I think != is 2nd). It is a standard substitution in computer programming.
b-flat wrote:
OK; I guess I'll blame Kerm then.

Anyway, != is used to stand for the does not equal symbol on the calculator because I do not know how to type that on my keyboard. It is located on the same menu as equals (2<sup>nd</sup> + math to get to the test menu, I think != is 2<sup>nd</sup>). It is a standard substitution in computer programming.


So what does it do if it doesn't equal 45? Does that mean that it can be equal to anything else? and how does it make K=21 and such????
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement