• More dumb questions

    From Mortifis@VERT/ALLEYCAT to All on Fri Jul 19 11:18:34 2019
    When scripting a commandline utility, console.clear() and other console.* functions are 'undefined' Is there a load(*.js) I need to call at the start of the script to has access to those functions or are they hard coded in sbbs?



    My teachers always said "You can't make a living looking out a window!", they were wrong, I drive truck :-P

    ---
    þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81
  • From Mortifis@VERT/ALLEYCAT to All on Fri Jul 19 11:48:19 2019
    When scripting a commandline utility, console.clear() and other console.* functions are 'undefined' Is there a load(*.js) I need to call at the start of the script to has access to those functions or are they hard coded in sbbs?

    nevermind, I see that there is a conio.clrscr() and should be used with conio.suspend(); to return conio for output/input from local onsole, duh!





    My teachers always said "You can't make a living looking out a window!", they were wrong, I drive truck :-P

    ---
    þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81
  • From echicken@VERT/ECBBS to Mortifis on Fri Jul 19 11:16:58 2019
    Re: More dumb questions
    By: Mortifis to All on Fri Jul 19 2019 11:18:34

    When scripting a commandline utility, console.clear() and other console.* functions are 'undefined' Is there a load(*.js) I need to call at the start of the script to has access to those functions or are they hard coded in sbbs?

    'console' only exists in scripts running in the 'bbs' context, ie. under a telnet/rlogin/ssh session.
    Its methods are strictly for interacting with a remote terminal and they aren't relevant under jsexec,
    the webserver, or other places where Synchronet runs JS.

    There are ways to deal with running scripts either under jsexec or in a BBS session (you seemed to have
    the idea of doing 'if (js.global.console)'). Sometimes it's just easier to pick one or the other. This
    script in particular (generating a report about dupe users) seems like a utility I'd just want to run
    under jsexec and I wouldn't need to run during an ssh session.

    ---
    echicken
    electronic chicken bbs - bbs.electronicchicken.com
    þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.com
  • From Mortifis@VERT/ALLEYCAT to echicken on Fri Jul 19 13:08:27 2019
    Re: More dumb questions
    By: Mortifis to All on Fri Jul 19 2019 11:18:34

    When scripting a commandline utility, console.clear() and other console.* functions are 'undefined' Is there a load(*.js) I need to call at the start of the script to has access to those functions or are they hard coded in sbbs?

    'console' only exists in scripts running in the 'bbs' context, ie. under a telnet/rlogin/ssh session.
    Its methods are strictly for interacting with a remote terminal and they aren't relevant under jsexec,
    the webserver, or other places where Synchronet runs JS.

    There are ways to deal with running scripts either under jsexec or in a BBS session (you seemed to have
    the idea of doing 'if (js.global.console)').

    Ya, I see that now, I found conio.clrscr; and conio.suspend which does what I needed.

    Sometimes it's just easier to
    pick one or the other. This
    script in particular (generating a report about dupe users) seems like a utility I'd just want to run
    under jsexec and I wouldn't need to run during an ssh session.


    I was following the premise under mailall.js LOL but, with your help, I am slowly seeing the error or my ways :-)

    The script has already grown beyond an FYI script and is has menu options

    Thanks, EC



    My teachers always said "You can't make a living looking out a window!", they were wrong, I drive truck :-P

    ---
    þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81
  • From Mortifis@VERT/ALLEYCAT to echicken on Fri Jul 19 14:00:37 2019
    Re: More dumb questions
    By: Mortifis to All on Fri Jul 19 2019 11:18:34


    And yet another one, so when I say 'console' I am referring to running via jsexec in a terminal and optput is stdout ... how does one change font colors and the background color of an input ( readln() ) prompt?

    I'll owe you a case of beer after this ... :)



    My teachers always said "You can't make a living looking out a window!", they were wrong, I drive truck :-P

    ---
    þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81
  • From echicken@VERT/ECBBS to Mortifis on Fri Jul 19 15:04:15 2019
    Re: Re: More dumb questions
    By: Mortifis to echicken on Fri Jul 19 2019 14:00:37

    And yet another one, so when I say 'console' I am referring to running via jsexec in a terminal and optput is stdout ... how does one change font colors and the background color of an input ( readln() ) prompt?

    I don't think any of the basic output methods have any provisions for doing magic colour stuff, so you'd
    probably have to send escape sequences yourself. It's possible that we have some JS libraries that might
    help with that, but I'd have to look (and it's more likely that they rely on stuff that the console
    object already does).

    ---
    echicken
    electronic chicken bbs - bbs.electronicchicken.com
    þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.com
  • From Mortifis@VERT/ALLEYCAT to echicken on Fri Jul 19 16:33:27 2019
    Re: Re: More dumb questions
    By: Mortifis to echicken on Fri Jul 19 2019 14:00:37

    And yet another one, so when I say 'console' I am referring to running via jsexec in a terminal and optput is stdout ... how does one change font colors and the background color of an input ( readln() ) prompt?

    I don't think any of the basic output methods have any provisions for doing magic colour stuff, so you'd
    probably have to send escape sequences yourself. It's possible that we have some JS libraries that might
    help with that, but I'd have to look (and it's more likely that they rely on stuff that the console
    object already does).

    I see conio.textcolor and conio.textbackground but I am unsure how to use it ... I tried conio.textcolor=3 but it displays jibberish and completely hoses the output



    My teachers always said "You can't make a living looking out a window!", they were wrong, I drive truck :-P

    ---
    þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81
  • From Digital Man@VERT to Mortifis on Fri Jul 19 12:54:27 2019
    Re: Re: More dumb questions
    By: Mortifis to echicken on Fri Jul 19 2019 04:33 pm

    Re: Re: More dumb questions
    By: Mortifis to echicken on Fri Jul 19 2019 14:00:37

    And yet another one, so when I say 'console' I am referring to running via jsexec in a terminal and optput is stdout ... how does one change font colors and the background color of an input ( readln() ) prompt?

    I don't think any of the basic output methods have any provisions for doing magic colour stuff, so you'd
    probably have to send escape sequences yourself. It's possible that we have some JS libraries that might
    help with that, but I'd have to look (and it's more likely that they rely on stuff that the console
    object already does).

    I see conio.textcolor and conio.textbackground but I am unsure how to use it ... I tried conio.textcolor=3 but it displays jibberish and completely hoses the output

    The conio stuff is *not* stdio. I would just stick to the basic write/writeln functions for a jsexec utility. See the other utility-like JS scripts for examples.

    digital man

    Synchronet/BBS Terminology Definition #47:
    MUD = Multi-User Dungeon
    Norco, CA WX: 80.8øF, 52.0% humidity, 6 mph E wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From echicken@VERT/ECBBS to Mortifis on Fri Jul 19 15:58:51 2019
    Re: Re: More dumb questions
    By: Mortifis to echicken on Fri Jul 19 2019 16:33:27

    I see conio.textcolor and conio.textbackground but I am unsure how to use it ... I tried conio.textcolor=3 but it displays jibberish and completely hoses the output

    I completely forgot that thing existed. Can't remember ever using it, though.

    I would imagine that if you want to use it for i/o, you should use its methods and no others.

    I just whipped up this quick test and it seemed to do what I expected:

    conio.init();
    conio.clrscr();
    conio.textcolor = 14;
    conio.cputs('hihi');
    conio.getch();

    ---
    echicken
    electronic chicken bbs - bbs.electronicchicken.com
    þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.com
  • From Mortifis@VERT/ALLEYCAT to echicken on Fri Jul 19 17:42:27 2019
    Re: Re: More dumb questions
    By: Mortifis to echicken on Fri Jul 19 2019 16:33:27

    I see conio.textcolor and conio.textbackground but I am unsure how to use it ... I tried conio.textcolor=3 but it displays jibberish and completely hoses the output

    I completely forgot that thing existed. Can't remember ever using it, though.

    I would imagine that if you want to use it for i/o, you should use its methods and no others.

    I just whipped up this quick test and it seemed to do what I expected:

    conio.init();
    conio.clrscr();
    conio.textcolor = 14;
    conio.cputs('hihi');
    conio.getch();

    that hoses the stdout the same, oh well, colors are, technically, unnecessary, thank you, might be a Windows thing.

    I have a basic script dup_user_checker.js that takes argv's and allows user editing ... would it be possible to upload (or have it uploaded) to the cvs / exec/examples directory?




    My teachers always said "You can't make a living looking out a window!", they were wrong, I drive truck :-P

    ---
    þ Synchronet þ AlleyCat! BBS - http://alleycat.synchro.net:81