• Question on "onekey" python function

    From lemonlime@21:4/162 to All on Fri Oct 25 03:51:02 2019
    Hi All,

    I'm trying to modify a .mpy python script to also 'break' when enter is
    pressed instead of just Q.

    The script just gets user input into the "char" variable as below:

    char = bbs.onekey("AVQ",True)

    And then there are if statements to make the A, V and Q keys do stuff. I know that enter is considered chr(13) in mystic python, but I don't know if the onekey function can accept special keys (enter, escape etc). I also tried the getkey function but that doesn't seem to work for me either.

    Any tips or suggestions?

    Thanks,
    Mike

    --- Mystic BBS v1.12 A43 2019/03/02 (Linux/64)
    * Origin: Stellar Darkness BBS (21:4/162)
  • From lemonlime@21:4/162 to All on Fri Oct 25 04:25:19 2019
    char = bbs.onekey("AVQ",True)

    And then there are if statements to make the A, V and Q keys do stuff. I know that enter is considered chr(13) in mystic python, but I don't know if the onekey function can accept special keys (enter, escape etc). I
    also tried the getkey function but that doesn't seem to work for me either.

    Figured it out. Was just the syntax/formatting that was throwing me off :)

    char = bbs.onekey(chr(13) + 'AQV', True)

    The above did the trick.

    --- Mystic BBS v1.12 A43 2019/03/02 (Linux/64)
    * Origin: Stellar Darkness BBS (21:4/162)
  • From maskreet@21:1/114 to lemonlime on Fri Oct 25 18:06:27 2019
    On 25 Oct 2019, lemonlime said the following...

    Figured it out. Was just the syntax/formatting that was throwing me off
    :)

    char = bbs.onekey(chr(13) + 'AQV', True)

    I was actually in the middle of replying to you about this last night before
    I went to sleep. Was dog-tired, though. Glad you got it figure out!

    --- Mystic BBS v1.12 A43 2019/03/02 (Linux/64)
    * Origin: throwbackbbs.com -\- meriden, ct -\- (21:1/114)
  • From g00r00@21:1/120 to lemonlime on Sat Oct 26 02:24:06 2019

    char = bbs.onekey("AVQ",True)

    ch = onekey(chr(13) + 'AVQ', True);

    Thats all you have to do for ENTER. 27 for ESCAPE etc. It all works.

    --- Mystic BBS v1.12 A43 2019/03/02 (Linux/64)
    * Origin: Cyberia BBS | cyberiabbs.zapto.org | San Jose, CA (21:1/120)
  • From lemonlime@21:4/162 to g00r00 on Tue Oct 29 16:45:03 2019
    ch = onekey(chr(13) + 'AVQ', True);

    Thats all you have to do for ENTER. 27 for ESCAPE etc. It all works.

    Thanks g00r00 - I wound up finding it earlier in one of the example mpy
    scripts and it works perfectly.

    --- Mystic BBS v1.12 A43 2019/03/02 (Linux/64)
    * Origin: Stellar Darkness BBS (21:4/162)