• console.inkey()

    From MCMLXXIX@MDJ to Deuce on Tuesday, May 20, 2008 15:32:13
    Hey man.. seeing as how you love that my script processes one key at a time, I'm using inkey() even more.... except I've run into a problem!

    does that surprise you?! I didn't think so

    I'm trying to use a switch statement to catch arrow keys from console.inkey()

    It doesn't seem to be working.. it is passing some fancy ansi thru instead, and not catch them. do the K_<mode> bits work with console.inkey()?

    here's how I wrote it, ... and none of the cases pick up the keys:

    var key=console.inkey();
    switch(key) {

    case KEY_DOWN:
    case KEY_UP:
    case KEY_LEFT:
    case KEY_RIGHT:
    case '\x1e':
    case '\x0a':
    case '\x06':
    case '\x1d':
    write("die");
    break;

    }

    there are other cases, and such, but that was the problem area.

    ---
    ■ Synchronet ■ The BRoKEN BuBBLE (MDJ.ATH.CX)
  • From Deuce@SYNCNIX to MCMLXXIX on Tuesday, May 20, 2008 14:26:26
    Re: console.inkey()
    By: MCMLXXIX to Deuce on Tue May 20 2008 03:32 pm

    It doesn't seem to be working.. it is passing some fancy ansi thru instead, and not catch them. do the K_<mode> bits work with console.inkey()?

    You appear to have CTRL-[ or ESC set in console.ctrlkey_passthru. I'm not sure how you're setting the value of this variable, but adding the line: console.ctrlkey_passthru="-[";
    will clear the offending bit.

    ---
    Synchronet - Jump on the Web 0.2 bandwagon!

    ---
    ■ Synchronet ■ My Brand-New BBS (All the cool SysOps run STOCK!)