Two questions about inkey() instruction

Posted By: CyberGhost

Two questions about inkey() instruction - 06/24/14 18:49

I read about inkey() function in the manual and two questions came to my mind:

1) Does inkey() instruction "freezes" the function calling it till Enter or Esc ,for example, is pressed ,then scan code is returned? I am just curious about what happens to functions order and stuff ( I already know that game_save/load and on_ functions are not executed)

2) The manual says that Enter or Tab confirms string change while Esc, Up, Down, PageUp and PageDown abort it. What if I want Enter and Esc ONLY for confirmation/abort? How to do it?

Greets!
Posted By: Ch40zzC0d3r

Re: Two questions about inkey() instruction - 06/24/14 19:18

Code your own input function if you need more dynamic things.
I believe this function is just for helping starters getting in programming without the need of coding too much theirself.
Ah, it should freeze the function its called from, but Im not sure since I dont use it at all laugh
Posted By: Superku

Re: Two questions about inkey() instruction - 06/24/14 19:32

I think approaches like the following could work, too:

var inkey_result = -1;
while(inkey_result != esc code && inkey_result != enter code) inkey(my_str); // wait should not be necessary here
Posted By: CyberGhost

Re: Two questions about inkey() instruction - 06/24/14 20:01

@Ch40zzC0d3r I think it's a good idea but too difficult for me grin . The main issue would be testing all keys ,and I can't use str_for_key().

@Superku You mean if I put it in a while loop it won't respond to keys of confirmation/aborting?
Posted By: Superku

Re: Two questions about inkey() instruction - 06/24/14 20:23

Test it!
Posted By: CyberGhost

Re: Two questions about inkey() instruction - 06/25/14 00:23

Sorry, I had to close my laptop and post by mobile grin ...
Posted By: CyberGhost

Re: Two questions about inkey() instruction - 06/25/14 21:00

Ok. Thread closed.
Posted By: Superku

Re: Two questions about inkey() instruction - 06/26/14 06:33

Yet I'm still posting in this thread. (^.^)
Posted By: CyberGhost

Re: Two questions about inkey() instruction - 06/26/14 10:48

It's closed for me :X ....
© 2024 lite-C Forums