• Working on new command shell in javascript

    From nolageek@CAPSHRIL to All on Sunday, March 20, 2016 01:51:34
    Hey there!

    I'm working on converting my command shell from Baja to JavaScript and I'm running into a few bugs that I can't figure out. I'm running the command shell to test it, so if I make any changes I have to switch to another command shell and then back to the one I'm testing .. no problem, I've done that when I've done my last few shells. HOWEVER, the problem I'm seeing is that when I switch from my new shell to one of the others it the one I switch to appears in my defaults and if I use 'console.putmsg(user.command_shell) it says my current shell is the one I switched to but the BBS is still using my new one. The commands are all the new shell.

    In fact, my new shell uses user.command_shell in the paths to the menus and it'll say c:\sbbs\text\menu\*oldshell*\main.asc is not found for some items...

    I figure it has to be something about the way I'm calling the defaults menu... Honestly I know just enought JavaScript to be dangerous. :) Here is my 'systemMenu' function.... any suggestions?


    function systemMenu() {
    while (bbs.online) {
    bbs.node_action = 'NODE_DFLT';
    console.clear();
    bbs.menu(user.command_shell + '/system');
    console.putmsg(' \1h\1m ' + user.alias + '\1k@\1bSystem Menu\1w:\1n\1w ');

    var key = console.getkey(K_NOECHO).toUpperCase();
    bbs.log_key(key);
    switch (key) {
    //options and commands to perform
    case 'S':
    console.clear();
    bbs.sys_info();
    break;
    case 'U':
    console.clear();
    bbs.list_users();
    console.line_counter = 1;
    break;
    case 'W':
    bbs.menu(user.command_shell + '/nodeltop');
    break;
    case 'L':
    showLastCallers(10);
    break;
    case 'D':
    bbs.user_config();
    break;
    // for /D
    case '/':
    console.putmsg('/');
    slashMenu(console.getkey().toUpperCase());
    break;
    case ':':
    console.putmsg(':');
    colonMenu(console.getstr('', 4).toUpperCase());
    break;
    case 'Y':
    console.clear();
    bbs.user_info();
    break;
    case 'I':
    console.clear();
    bbs.ver();
    break;
    case 'M':
    console.clear();
    bbs.sub_info();
    break;
    case 'Q':
    mainMenu();
    return;
    default:
    return;
    } // end switch
    } // while online
    //hangUp();
    } // end system



    Any help would be much appreciated!

    |01-|03nolageek

    ---
    ■ Synchronet ■ Capitol Shrill BBS - Washington, DC - capitolshrill.com
  • From Digital Man to nolageek on Sunday, March 20, 2016 16:45:47
    Re: Working on new command shell in javascript
    By: nolageek to All on Sun Mar 20 2016 01:51 am

    Hey there!

    I'm working on converting my command shell from Baja to JavaScript and I'm running into a few bugs that I can't figure out. I'm running the command shell to test it, so if I make any changes I have to switch to another command shell and then back to the one I'm testing .. no problem,

    Or you could log-off and back on. That'd probably be easier.

    I've done
    that when I've done my last few shells. HOWEVER, the problem I'm seeing is that when I switch from my new shell to one of the others it the one I switch to appears in my defaults and if I use 'console.putmsg(user.command_shell) it says my current shell is the one I switched to but the BBS is still using my new one. The commands are all the new shell.

    Look at lbshell.js or classic_shell.js for working example of a JS shell that allows switching the current shell back to a Baja shell (and back again). That might help ya.

    digital man

    Synchronet "Real Fact" #56:
    Synchronet introduced Telnet, FTP, SMTP and POP3 support w/v3.00a-Win32 in 2000.
    Norco, CA WX: 74.1°F, 47.0% humidity, 9 mph SSE wind, 0.00 inches rain/24hrs
  • From nolageek@CAPSHRIL to Digital Man on Monday, March 21, 2016 01:29:54
    Re: Working on new command shell in javascript
    By: Digital Man to nolageek on Sun Mar 20 2016 04:45 pm

    Look at lbshell.js or classic_shell.js for working example of a JS shell that allows switching the current shell back to a Baja shell (and back

    Deuce pointed me in the right direction on IRC - I wasn't exiting the shell in the case of the shell changing.

    I added this to the top of the file:

    var thisShell = user.command_shell;


    Then in both main.Menu() and systemMenu() I added:

    if (thisShell.toUpperCase() != user.command_shell) {
    return;
    }

    Those are the only two menus that contain an option for 'defaults' so if the user changes their shell it will exit the new one when they go back to where they came from. This mimics the behaviour I see in other shells.

    |01-|03nolageek

    ---
    ■ Synchronet ■ Capitol Shrill BBS - Washington, DC - capitolshrill.com
  • From tracker1@TRNTEST to nolageek on Saturday, March 26, 2016 14:02:05
    case 'S':
    console.clear();
    bbs.sys_info();
    break;

    Check your shell before and after, if it's changed, exit the entire script,
    and the new shell will take hold...

    --
    Michael J. Ryan
    tracker1(at)gmail.com
    +o Roughneck BBS

    ---
    ■ Synchronet ■ RoughneckBBS - http://www.roughneckbbs.com/