• bbs.menu vs bbs.menu_exists

    From nolageek@VERT/CAPSHRIL to Digital Man on Monday, January 13, 2020 14:50:50
    Is there a reason why bbs.menu_exist() does not allow using a directory before the file name like bbs.menu()?

    bbs.menu("dir\file_base") works for when I want to specify an ansi outside of the menu directory (I use it with user.command_shell a lot) but bbs.menu_exists("dir\file_base") always comes back negative.

    |01-|03nolageek

    ---
    þ Synchronet þ Capitol Shrill BBS - Washington, DC - capitolshrill.com
  • From Digital Man@VERT to nolageek on Monday, January 13, 2020 14:26:30
    Re: bbs.menu vs bbs.menu_exists
    By: nolageek to Digital Man on Mon Jan 13 2020 02:50 pm

    Is there a reason why bbs.menu_exist() does not allow using a directory before the file name like bbs.menu()?

    bbs.menu("dir\file_base") works for when I want to specify an ansi outside of the menu directory (I use it with user.command_shell a lot) but bbs.menu_exists("dir\file_base") always comes back negative.

    bbs.menu_exists() with a sub-directory specified should work fine. See xtrn_sec.js as an example which check for the existence (and displays) text/menu/xtrn/*.*.

    The correct path-separator to use in JS strings is a forward slash (/) not a backslash (\), so perhaps that's the issue?

    digital man

    Synchronet/BBS Terminology Definition #60:
    SCFG = Synchronet Configuration Utility
    Norco, CA WX: 60.7øF, 57.0% humidity, 2 mph NNW wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From nolageek@VERT/CAPSHRIL to Digital Man on Tuesday, January 14, 2020 09:44:40
    Re: bbs.menu vs bbs.menu_exists
    By: Digital Man to nolageek on Mon Jan 13 2020 02:26 pm

    bbs.menu_exists() with a sub-directory specified should work fine. See xtrn_sec.js as an example which check for the existence (and displays) text/menu/xtrn/*.*.

    I can't figure out why this code doesn't work then:

    function mystMenu(file) {
    // check for 'file' in current command shell menu dir and if not found use
    // 'mystique' menu directory

    if (bbs.menu_exists(user.command_shell + '/' + file)) {
    bbs.menu(user.command_shell + '/' + file);
    } else {
    bbs.menu('mystique/' + file);
    }
    }

    If I then use mystMenu('mainmenu'); in my shell, it always shows the menu from the mystique directoy - even though they exist in both.

    I've tried combinations of testing for !bbs.menu_exists, etc.. it always comes back showing the mystique one. If I take the bbs.menu_exists test out, it works.

    I've been using this for the last couple of years, which works but I want to clean it up a bit cause it's a bit messy:

    function mystMenu(file) {
    var ansiDir = system.text_dir + 'menu/' + user.command_shell + '/';
    if (!file_exists(ansiDir + file + '.ans') && !file_exists(ansiDir + file + '.asc'))
    var ansiDir = system.text_dir + 'menu/mystique/';
    bbs.menu(ansiDir + file);
    }


    Thanks for your assistance, as always!

    ---
    þ Synchronet þ Capitol Shrill BBS - Washington, DC - capitolshrill.com
  • From Digital Man@VERT to nolageek on Tuesday, January 14, 2020 09:55:34
    Re: bbs.menu vs bbs.menu_exists
    By: nolageek to Digital Man on Tue Jan 14 2020 09:44 am

    Re: bbs.menu vs bbs.menu_exists
    By: Digital Man to nolageek on Mon Jan 13 2020 02:26 pm

    bbs.menu_exists() with a sub-directory specified should work fine. See xtrn_sec.js as an example which check for the existence (and displays) text/menu/xtrn/*.*.

    I can't figure out why this code doesn't work then:

    function mystMenu(file) {
    // check for 'file' in current command shell menu dir and if not found use // 'mystique' menu directory

    if (bbs.menu_exists(user.command_shell + '/' + file)) {
    bbs.menu(user.command_shell + '/' + file);
    } else {
    bbs.menu('mystique/' + file);
    }
    }

    If I then use mystMenu('mainmenu'); in my shell, it always shows the menu from the mystique directoy - even though they exist in both.

    Does the file text/menu/<shell>/mainmenu.asc exist? The .msg or .asc version of a menu file must exist for bbs.menu_exists() to return true.



    digital man

    Synchronet/BBS Terminology Definition #18:
    DM = Digital Man (Rob Swindell) or Dungeon Master
    Norco, CA WX: 54.4øF, 82.0% humidity, 0 mph W wind, 0.01 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From nolageek@VERT/CAPSHRIL to Digital Man on Tuesday, January 14, 2020 14:09:15
    Re: bbs.menu vs bbs.menu_exists
    By: Digital Man to nolageek on Tue Jan 14 2020 09:55 am

    Does the file text/menu/<shell>/mainmenu.asc exist? The .msg or .asc version of a menu file must exist for bbs.menu_exists() to return true.

    mainmenu.ans exists - does bbs.menu_exists() test for .msg or .asc but not .ans? That would explain it, but why would it not check for the same file types that bbs.menu() displays?

    |01-|03nolageek

    ---
    þ Synchronet þ Capitol Shrill BBS - Washington, DC - capitolshrill.com
  • From nolageek@VERT/CAPSHRIL to Digital Man on Tuesday, January 14, 2020 14:15:06
    Re: bbs.menu vs bbs.menu_exists
    By: Digital Man to nolageek on Tue Jan 14 2020 09:55 am

    Does the file text/menu/<shell>/mainmenu.asc exist? The .msg or .asc version of a menu file must exist for bbs.menu_exists() to return true.

    mainmenu.ans exists - does bbs.menu_exists() test for .msg or .asc but not .ans? That would explain it, but does it not check for the same file types
    that bbs.menu() displays?

    |01-|03nolageek

    ---
    þ Synchronet þ Capitol Shrill BBS - Washington, DC - capitolshrill.com
  • From Digital Man@VERT to nolageek on Tuesday, January 14, 2020 15:00:00
    Re: bbs.menu vs bbs.menu_exists
    By: nolageek to Digital Man on Tue Jan 14 2020 02:09 pm

    Re: bbs.menu vs bbs.menu_exists
    By: Digital Man to nolageek on Tue Jan 14 2020 09:55 am

    Does the file text/menu/<shell>/mainmenu.asc exist? The .msg or .asc version of a menu file must exist for bbs.menu_exists() to return true.

    mainmenu.ans exists - does bbs.menu_exists() test for .msg or .asc but not .ans? That would explain it, but why would it not check for the same file types that bbs.menu() displays?

    At minimum, a .asc or .msg menu display file is required. bbs.menu() first looks for the *most* applicable file format, not all file formats.

    digital man

    Synchronet/BBS Terminology Definition #84:
    XSDK = Synchronet External Program Software Development Kit for C/C++
    Norco, CA WX: 60.3øF, 63.0% humidity, 2 mph ESE wind, 0.01 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From nolageek@VERT/CAPSHRIL to Digital Man on Tuesday, January 14, 2020 23:12:57
    Re: bbs.menu vs bbs.menu_exists
    By: Digital Man to nolageek on Tue Jan 14 2020 03:00 pm

    At minimum, a .asc or .msg menu display file is required. bbs.menu() first looks for the *most* applicable file format, not all file formats.

    But it will find .ans - I guess I expected bbs.menu() and bbs.menu_exists() to work with the same formats so they could work together.I could convert I gues (but then I'd have to always convert back and forth to edit them.) Are .msg and .asc faster or are they "more native" to synchronet? Just curious.

    nolageek

    ---
    þ Synchronet þ Capitol Shrill BBS - Washington, DC - capitolshrill.com
  • From Rampage@VERT/SESTAR to nolageek on Wednesday, January 15, 2020 08:36:19
    Re: bbs.menu vs bbs.menu_exists
    By: nolageek to Digital Man on Tue Jan 14 2020 23:12:57


    Are .msg and .asc faster or are they "more native" to synchronet? Just curious.

    AFAIK, .msg format can be used for all... use ^A codes for the colors... if a user is mono-only (asc), they will get mono only... if they are color capable, they will get color in the format their terminal can handle...

    AIUI, sbbs handles the colors as needed by sending color codes for color capable terminals or not sending them for mono terminals... i'm pretty sure that user's setting are also taken into account so that a user may be using a color capable terminal but have their settings for ascii only... so they may see color on their initial connect but once logged in, everything will be in mono after that if they have set ascii only...

    i'm slowly moving to all .msg files for all my external display "templates" specifically so i don't have to manage 3 or 4 copies of the same file in different formats...


    )\/(ark

    ---
    þ Synchronet þ The SouthEast Star Mail HUB - SESTAR
  • From Gamgee@VERT/PALANT to nolageek on Wednesday, January 15, 2020 07:49:00
    nolageek wrote to Digital Man <=-

    At minimum, a .asc or .msg menu display file is required. bbs.menu() first looks for the *most* applicable file format, not all file formats.

    But it will find .ans - I guess I expected bbs.menu() and bbs.menu_exists() to work with the same formats so they could
    work together.I could convert I gues (but then I'd have to always
    convert back and forth to edit them.) Are .msg and .asc faster or
    are they "more native" to synchronet? Just curious.

    http://wiki.synchro.net/custom:menu_files



    ... So easy, a child could do it. Child sold separately.
    --- MultiMail/Linux v0.52
    þ Synchronet þ Palantir BBS * palantirbbs.ddns.net * Pensacola, FL
  • From Digital Man@VERT to nolageek on Wednesday, January 15, 2020 09:31:39
    Re: bbs.menu vs bbs.menu_exists
    By: nolageek to Digital Man on Tue Jan 14 2020 11:12 pm

    Re: bbs.menu vs bbs.menu_exists
    By: Digital Man to nolageek on Tue Jan 14 2020 03:00 pm

    At minimum, a .asc or .msg menu display file is required. bbs.menu() first looks for the *most* applicable file format, not all file formats.

    But it will find .ans - I guess I expected bbs.menu() and bbs.menu_exists() to work with the same formats so they could work together.

    They do. That's why menu_exists() is failing, because you're doing it wrong. You *have* to have one of the lowest-common-denominator menu files (*.msg or *.asc).

    I could convert I
    gues (but then I'd have to always convert back and forth to edit them.)

    That or use an editor that supports Ctrl-A format files (e.g. PabloDraw).

    Are
    .msg and .asc faster or are they "more native" to synchronet? Just curious.

    Not faster, but better.

    digital man

    Synchronet "Real Fact" #93:
    Synchronet v3.16c was released in August of 2015 (5 years after v3.15b).
    Norco, CA WX: 44.4øF, 97.0% humidity, 0 mph WSW wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From nolageek@VERT/CAPSHRIL to Gamgee on Wednesday, January 15, 2020 12:06:45
    Re: Re: bbs.menu vs bbs.menu_exists
    By: Gamgee to nolageek on Wed Jan 15 2020 07:49 am

    http://wiki.synchro.net/custom:menu_files

    Well I know that. I was just wondering why bbs.menu_exists() didn't test for the same set of menu types that bbs.menu() can display. It was just unexpected to have it not find my .ans. I really don't want to keep multiple copies in different formats and convert menus back and forth every time I have a new one made or make a change (especially while I'm in the process of making a lot of changes.)

    Either way, I just wanted to ask since it seemed inconsistant at the time, but I'm sure there's a reason so I'm not looking to die on this hill. :) I'm using a slightly less hidious way of accomplishing what I was doing, but not as readable as if I could have used bbs.menu_exists(); It's still down to 3 lines of code as opposed to 6 or 7 like it was before so yay. :)

    |01-|03nolageek

    ---
    þ Synchronet þ Capitol Shrill BBS - Washington, DC - capitolshrill.com
  • From Digital Man@VERT to nolageek on Wednesday, January 15, 2020 13:21:47
    Re: Re: bbs.menu vs bbs.menu_exists
    By: nolageek to Gamgee on Wed Jan 15 2020 12:06 pm

    Re: Re: bbs.menu vs bbs.menu_exists
    By: Gamgee to nolageek on Wed Jan 15 2020 07:49 am

    http://wiki.synchro.net/custom:menu_files

    Well I know that. I was just wondering why bbs.menu_exists() didn't test for the same set of menu types that bbs.menu() can display. It was just unexpected to have it not find my .ans. I really don't want to keep multiple copies in different formats and convert menus back and forth every time I have a new one made or make a change (especially while I'm in the process of making a lot of changes.)

    Either way, I just wanted to ask since it seemed inconsistant at the time, but I'm sure there's a reason so I'm not looking to die on this hill. :) I'm using a slightly less hidious way of accomplishing what I was doing, but not as readable as if I could have used bbs.menu_exists(); It's still down to 3 lines of code as opposed to 6 or 7 like it was before so yay. :)

    You really should use bbs.menu_exists() as it's doing the right thing. If you have a non-ANSI user and call bbs.menu() for a menu file that has no .msg or .asc equivalent, that user is just going to see an error message (no menu). Not a very good user experience.

    digital man

    Synchronet "Real Fact" #83:
    Donations to the Synchronet project are welcome @ http://wiki.synchro.net/donate
    Norco, CA WX: 64.9øF, 52.0% humidity, 0 mph W wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net