• Enter key and quit

    From Night_Flyer@VERT to All on Sun Mar 18 06:48:00 2007
    Im venturing into my first real foray into Baja outside of binding keys on my main menu...

    so far so good, but I cant seem to find where to bind the enter key to a default action.

    basically I want it to behave like a quit. hit enter and the program defaults to the end.

    what Im working on is a one liner (actually Im butchering anothers previous work) and I want it to say "Want to add a quote?" Y[N] where N is the default key and it exits the program at that point.

    thanks for any pointers

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ telnet://vert.synchro.net
  • From Angus McLeod@VERT/ANJO to Night_Flyer on Sun Mar 18 12:17:00 2007
    Re: Enter key and quit
    By: Night_Flyer to All on Sun Mar 18 2007 05:48:00

    so far so good, but I cant seem to find where to bind the enter key to a default action.

    basically I want it to behave like a quit. hit enter and the program default to the end.

    what Im working on is a one liner (actually Im butchering anothers previous work) and I want it to say "Want to add a quote?" Y[N] where N is the defaul key and it exits the program at that point.

    This isn't exactly the answer to your question but have a look at BAJA's useful "NO_YES" verb.
    ---
    Playing: "Star" by "Elysian Fields" from the "Bleed Your Cedar" album
    ■ Synchronet ■ Where we BAJA Rob into writing our modules. The ANJO BBS
  • From Digital Man@VERT to Night_Flyer on Sun Mar 18 11:03:00 2007
    Re: Enter key and quit
    By: Night_Flyer to All on Sun Mar 18 2007 06:48 am

    Im venturing into my first real foray into Baja outside of binding keys on m main menu...

    so far so good, but I cant seem to find where to bind the enter key to a default action.

    basically I want it to behave like a quit. hit enter and the program default to the end.

    Enter in response to what? GETSTR or GETKEY or GETCMD?

    GETSTR will return a blank (empty) string in response to the user just hitting the enter key, where as GETKEY/CMD will set the current command key to '\r'.

    See http://synchro.net/docs/baja.html#CommandKeyConstants for more details.

    digital man (xbox-live: digitlman)

    Snapple "Real Fact" #120:
    The only continent without native reptiles or snakes is Antarctica.
    Norco, CA WX: 58.1°F, 71% humidity, 0 mph ENE wind, 0.00 inches rain/24hrs

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ telnet://vert.synchro.net
  • From The Millionaire@VERT/PARKAVE to Digital Man on Sun Mar 18 11:26:00 2007
    Re: Enter key and quit
    By: Digital Man to Night_Flyer on Sun Mar 18 2007 11:03 am

    Enter in response to what? GETSTR or GETKEY or GETCMD?

    GETSTR will return a blank (empty) string in response to the user just hitti the enter key, where as GETKEY/CMD will set the current command key to '\r'.

    See http://synchro.net/docs/baja.html#CommandKeyConstants for more details.

    digital man (xbox-live: digitlman)

    Snapple "Real Fact" #120:
    The only continent without native reptiles or snakes is Antarctica.
    Norco, CA WX: 58.1°F, 71% humidity, 0 mph ENE wind, 0.00 inches rain/24hrs

    "\r" means return key right?

    ---
    ■ Synchronet ■ Watch "24" Monday Nights On Fox!
  • From Night_Flyer@VERT to Digital Man on Sun Mar 18 13:05:00 2007
    Enter in response to what? GETSTR or GETKEY or GETCMD?

    the current code is for a GETCMD
    -----
    getcmd YN\r?
    logkey

    cmdkey N
    goto theend
    end_cmd

    cmdkey Y
    goto write
    end_cmd
    -----
    hitting the return key sends me to "Y"

    all I want it to do is behave the same as "N"



    GETSTR will return a blank (empty) string in response to the user just hitting the enter key, where as GETKEY/CMD will set the current command key to '\r'.

    so how do you set the current command key? The Yes_no works fine, but Yes is highlighted :/


    See http://synchro.net/docs/baja.html#CommandKeyConstants for more details.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ telnet://vert.synchro.net
  • From Night_Flyer@VERT to Night_Flyer on Sun Mar 18 14:27:00 2007
    Enter in response to what? GETSTR or GETKEY or GETCMD?

    here's what I did to get it to work, but I have a feeling that it was a hack job

    getcmd NY\r?
    logkey

    cmdkey N
    goto theend
    end_cmd

    cmdkey Y
    goto write
    end_cmd

    compare_str ""
    if_true
    goto theend
    end_if

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ telnet://vert.synchro.net
  • From Digital Man@VERT to Night_Flyer on Mon Mar 19 15:34:00 2007
    Re: Re: Enter key and quit
    By: Night_Flyer to Digital Man on Sun Mar 18 2007 01:05 pm

    Enter in response to what? GETSTR or GETKEY or GETCMD?

    the current code is for a GETCMD
    -----
    getcmd YN\r?
    logkey

    cmdkey N
    goto theend
    end_cmd

    cmdkey Y
    goto write
    end_cmd

    From baja.html:

    If a RETURN or GOTO function will be
    executed before the END_CMD function, then a CMD_POP function must be executed to tell the interpreter to "forget" the previous CMD_HOME function.

    So looks like you're missing some CMD_POP calls in there.

    -----
    hitting the return key sends me to "Y"

    Interesting. I don't see why it would.

    all I want it to do is behave the same as "N"

    So create a cmdkey \r block.

    GETSTR will return a blank (empty) string in response to the user just hitting the enter key, where as GETKEY/CMD will set the current command k to '\r'.

    so how do you set the current command key?

    UNGETKEY

    The Yes_no works fine, but Yes is highlighted :/

    So use the NO_YES function instead.

    digital man (xbox-live: digitlman)

    Snapple "Real Fact" #85:
    The Mona Lisa has no eyebrows.
    Norco, CA WX: 79.3°F, 42% humidity, 0 mph SE wind, 0.00 inches rain/24hrs

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ telnet://vert.synchro.net
  • From Night_Flyer@VERT to Digital Man on Mon Mar 19 16:36:00 2007
    Re: Re: Enter key and quit
    By: Night_Flyer to Digital Man on Sun Mar 18 2007 01:05 pm

    Enter in response to what? GETSTR or GETKEY or GETCMD?

    the current code is for a GETCMD
    -----
    getcmd YN\r?
    logkey

    cmdkey N
    goto theend
    end_cmd

    cmdkey Y
    goto write
    end_cmd

    From baja.html:

    If a RETURN or GOTO function will be
    executed before the END_CMD function, then a CMD_POP function must be executed to tell the interpreter to "forget" the previous CMD_HOME function.

    So looks like you're missing some CMD_POP calls in there.

    all the examples I looked at didnt have that in there (that I noticed any way) the "cmdkey \r" call worked so ill leave that in... Thanks.

    dont know how much more of this I want to play with considering its mosly doing what I want.

    Since this is for a one liner wall, is there a way to get the length of the _useron.alias?

    and with that info cut off the number of characters available in the get line?

    X = 50
    getline line1 X K_UPPER|K_ALPHA|NOCRLF

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ telnet://vert.synchro.net
  • From Digital Man@VERT to Night_Flyer on Mon Mar 19 16:45:00 2007
    Re: Re: Enter key and quit
    By: Night_Flyer to Digital Man on Mon Mar 19 2007 04:36 pm

    From baja.html:

    If a RETURN or GOTO function will be
    executed before the END_CMD function, then a CMD_POP function must be executed to tell the interpreter to "forget" the previous CMD_HOME function.

    So looks like you're missing some CMD_POP calls in there.

    all the examples I looked at didnt have that in there (that I noticed any wa

    If you're not using CMD_HOME, then you don't need it.

    the "cmdkey \r" call worked so ill leave that in... Thanks.

    dont know how much more of this I want to play with considering its mosly doing what I want.

    Since this is for a one liner wall, is there a way to get the length of the _useron.alias?

    Use STRLEN

    and with that info cut off the number of characters available in the get lin

    X = 50
    getline line1 X K_UPPER|K_ALPHA|NOCRLF

    If you want to know the *maximum* length of _useron.alias, use the LEN_ALIAS constant (defined in userdefs.inc).

    digital man (xbox-live: digitlman)

    Snapple "Real Fact" #123:
    Beavers were once the size of bears.
    Norco, CA WX: 92.3°F, 30% humidity, 0 mph ESE wind, 0.00 inches rain/24hrs

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ telnet://vert.synchro.net
  • From Night_Flyer@VERT to Digital Man on Mon Mar 19 19:00:00 2007

    Use STRLEN

    when I compile I get an error stating that _useron.alias is an INT?!?

    heres what Im trying to do

    80 characters - overhead (7 characters) - username length = input box size

    the above should be simple... but for some reason it isnt...

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ telnet://vert.synchro.net
  • From Digital Man@VERT to Night_Flyer on Mon Mar 19 21:19:00 2007
    Re: Re: Enter key and quit
    By: Night_Flyer to Digital Man on Mon Mar 19 2007 07:00 pm


    Use STRLEN

    when I compile I get an error stating that _useron.alias is an INT?!?

    heres what Im trying to do

    80 characters - overhead (7 characters) - username length = input box size

    the above should be simple... but for some reason it isnt...

    Past the code you're trying to compile and the error message.

    digital man (xbox-live: digitlman)

    Snapple "Real Fact" #51:
    There are 63,360 inches in a mile.
    Norco, CA WX: 57.0°F, 66% humidity, 0 mph SSE wind, 0.00 inches rain/24hrs

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ telnet://vert.synchro.net
  • From Night_Flyer@VERT to Digital Man on Thu Mar 22 20:00:00 2007
    Re: Re: Enter key and quit
    By: Night_Flyer to Digital Man on Mon Mar 19 2007 07:00 pm


    Use STRLEN

    when I compile I get an error stating that _useron.alias is an INT?!?

    heres what Im trying to do

    80 characters - overhead (7 characters) - username length = input box size

    the above should be simple... but for some reason it isnt...

    Past the code you're trying to compile and the error message.

    I played with it a bit more and got it to work, not sure what I was doing wrong, but now it does the equasion I was trying to accomplish, so users message + users name wont go over 80 characters together

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ telnet://vert.synchro.net
  • From MRoblivious1bmf@VERT to Night_Flyer on Mon Mar 19 22:03:00 2007
    To: Night_Flyer
    .,: This is something about Re: Enter key and quit,
    Night_Flyer said it to Digital Man on Mon Mar 19 2007 04:36 pm --──────────────────────-────---───────────────---─────────--────────
    and with that info cut off the number of characters available in the get lin

    X = 50 getline line1 X K_UPPER|K_ALPHA|NOCRLF

    --- Synchronet 3.14b-Win32 NNTP Service 1.101 * Vertrauen - Riverside County, California - telnet://vert.synchro.net



    there's more than one way to skin a cat.

    look at the baja mods on vert.synchro.net

    --- Synchronet 3.14a-Win32 NewsLink 1.85
    * eob - Racine, WisconSIN - telnet://eob.darktech.org
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ telnet://vert.synchro.net