• AnsiTerm.Js

    From Uatu13@DARKSIDE to All on Saturday, July 07, 2018 22:18:49
    I just started messing around with JS, so this might be really simple, but I'm just not getting it.

    I'm running a test.js as an external Logon event.

    var ansi = load({}, 'ansiterm_lib.js');
    ansi.send('attributes','set', ansi.BROWN);
    console.print("testing");

    The text prints in SyncTerm as yellow instead of brown.

    So then I tried this:

    var ansi = load({}, 'ansiterm_lib.js');
    ansi.send('ext_mode', 'set', 'no_bright_intensity'); ansi.send('attributes','set', ansi.BROWN);
    console.print("testing");

    The text shows up as brown, but then every .ans file on the BBS that should have yellow in it shows as brown.

    I hope this makes sense. I'm guessing that I need to somehow reset the attributes or something after my code runs.

    Aside from that, is there a better way to print colored text? Seems like a lot of code and what if I wanted different colored words in the same print statement?

    Thanks.

    -=U13=-

    ---
    ■ Synchronet ■ The DarkSide of the Moon - telnet://darkside.synchro.net
  • From Digital Man to Uatu13 on Sunday, July 08, 2018 15:16:44
    Re: AnsiTerm.Js
    By: Uatu13 to All on Sat Jul 07 2018 10:18 pm

    I just started messing around with JS, so this might be really simple, but I'm just not getting it.

    I'm running a test.js as an external Logon event.

    var ansi = load({}, 'ansiterm_lib.js');
    ansi.send('attributes','set', ansi.BROWN);
    console.print("testing");

    The text prints in SyncTerm as yellow instead of brown.

    High intensity brown is yellow - this is just how IBM-CGA worked.

    Anyway, the easiest way to change attributes is with color/attribute codes we call "Ctrl-A codes" (http://wiki.synchro.net/custom:ctrl-a_codes), like so in JS:
    print("\1nThis is normal. \1rThis is red. \1hThis is bright-red.");

    So then I tried this:

    var ansi = load({}, 'ansiterm_lib.js');
    ansi.send('ext_mode', 'set', 'no_bright_intensity');

    Yeah, you probably don't want to do that. 1. It would only work in CTerm/SyncTERM termiantes and 2. it's going to disable high-intensity attributes for the entire session. :-)

    digital man

    Synchronet "Real Fact" #24:
    1584 Synchronet BBS Software registrations were sold between 1992 and 1996. Norco, CA WX: 98.3°F, 22.0% humidity, 10 mph E wind, 0.00 inches rain/24hrs
  • From Uatu13@DARKSIDE to Digital Man on Monday, July 09, 2018 00:30:09
    Re: AnsiTerm.Js
    By: Digital Man to Uatu13 on Sun Jul 08 2018 15:16:44

    Re: AnsiTerm.Js
    By: Uatu13 to All on Sat Jul 07 2018 10:18 pm

    var ansi = load({}, 'ansiterm_lib.js');
    ansi.send('ext_mode', 'set', 'no_bright_intensity');

    Yeah, you probably don't want to do that. 1. It would only work in CTerm/SyncTERM termiantes and 2. it's going to disable high-intensity attributes for the entire session. :-)

    digital man

    Thanks for the info. In what scenario would you use those commands / ansiterm_lib.js?

    Also, I noticed an ANSI.JS file in xtrn/druglord/ that might be useful for text color without using @-Codes. Any thoughts on that?

    -=U13=-

    ---
    ■ Synchronet ■ The DarkSide of the Moon - telnet://darkside.synchro.net
  • From Uatu13@DARKSIDE to Digital Man on Monday, July 09, 2018 00:37:47
    Re: AnsiTerm.Js
    By: Digital Man to Uatu13 on Sun Jul 08 2018 15:16:44

    Re: AnsiTerm.Js
    By: Uatu13 to All on Sat Jul 07 2018 10:18 pm

    var ansi = load({}, 'ansiterm_lib.js');
    ansi.send('ext_mode', 'set', 'no_bright_intensity');

    Yeah, you probably don't want to do that. 1. It would only work in CTerm/SyncTERM termiantes and 2. it's going to disable high-intensity attributes for the entire session. :-)

    digital man

    Thanks for the info. In what scenario would you use those commands / ansiterm_lib.js?

    Also, I noticed an ANSI.JS file in xtrn/druglord/ that might be useful for text color without using ctrl-a Codes. Any thoughts on that?

    -=U13=-

    ---
    ■ Synchronet ■ The DarkSide of the Moon - telnet://darkside.synchro.net
  • From Digital Man to Uatu13 on Tuesday, July 10, 2018 00:14:42
    Re: AnsiTerm.Js
    By: Uatu13 to Digital Man on Mon Jul 09 2018 12:30 am

    Re: AnsiTerm.Js
    By: Digital Man to Uatu13 on Sun Jul 08 2018 15:16:44

    Re: AnsiTerm.Js
    By: Uatu13 to All on Sat Jul 07 2018 10:18 pm

    var ansi = load({}, 'ansiterm_lib.js');
    ansi.send('ext_mode', 'set', 'no_bright_intensity');

    Yeah, you probably don't want to do that. 1. It would only work in CTerm/SyncTERM termiantes and 2. it's going to disable high-intensity attributes for the entire session. :-)

    Thanks for the info. In what scenario would you use those commands / ansiterm_lib.js?

    If you want to do custom palletes are advanced ANSI-BBS 2.0 type stuff (e.g. enable ICE-colors).

    Also, I noticed an ANSI.JS file in xtrn/druglord/ that might be useful for text color without using @-Codes. Any thoughts on that?

    I don't know why that would be easier. Ctrl-A codes automatically expand based on the user's terminal capabilities (not all terminals support ANSI sequences).

    digital man

    This Is Spinal Tap quote #26:
    David St. Hubbins: They were still booing him when we came on stage.
    Norco, CA WX: 75.4°F, 62.0% humidity, 0 mph SSW wind, 0.00 inches rain/24hrs
  • From Uatu13@DARKSIDE to Digital Man on Tuesday, July 10, 2018 19:30:17
    Re: AnsiTerm.Js
    By: Digital Man to Uatu13 on Tue Jul 10 2018 00:14:42


    var ansi = load({}, 'ansiterm_lib.js');
    ansi.send('ext_mode', 'set', 'no_bright_intensity');

    Thanks for the info. In what scenario would you use those commands /
    ansiterm_lib.js?

    If you want to do custom palletes are advanced ANSI-BBS 2.0 type stuff (e.g. enable ICE-colors).

    Oh, cool, I might have to look into that some day..

    I don't know why that would be easier. Ctrl-A codes automatically expand based on the user's terminal capabilities (not all terminals support ANSI sequences).

    I feel silly now. I was thinking the opposite; that terminals would be more compatible with ANSI than BBS Codes.. but clearly I need to read up on this more. lol

    Thanks for the help.

    -=U13=-

    ---
    ■ Synchronet ■ The DarkSide of the Moon - telnet://darkside.synchro.net
  • From Nightfox@DIGDIST to Uatu13 on Wednesday, July 11, 2018 09:41:37
    Re: AnsiTerm.Js
    By: Uatu13 to Digital Man on Tue Jul 10 2018 07:30 pm

    I don't know why that would be easier. Ctrl-A codes automatically
    expand based on the user's terminal capabilities (not all terminals
    support ANSI sequences).

    I feel silly now. I was thinking the opposite; that terminals would be more compatible with ANSI than BBS Codes.. but clearly I need to read up on this more. lol

    That's actually true, terminals are more compatible with ANSI than BBS codes. Synchronet automatically translates the Ctrl-A codes to ANSI if the terminal supports ANSI. And if the terminal doesn't support ANSI, then Synchronet
    does not include any color codes for the terminal client. The terminal isn't actually displaying the Ctrl-A codes.

    Nightfox

    ---
    ■ Synchronet ■ Digital Distortion: digitaldistortionbbs.com
  • From MRO@BBSESINF to Uatu13 on Wednesday, July 11, 2018 15:53:20
    Re: AnsiTerm.Js
    By: Uatu13 to Digital Man on Tue Jul 10 2018 07:30 pm


    I feel silly now. I was thinking the opposite; that terminals would be more compatible with ANSI than BBS Codes.. but clearly I need to read up on this more. lol

    Thanks for the help.


    The terminal doesnt know bbs codes.
    ---
    ■ Synchronet ■ ::: BBSES.info - free BBS services :::
  • From Uatu13@DARKSIDE to Nightfox on Wednesday, July 11, 2018 19:49:17
    Re: AnsiTerm.Js
    By: Nightfox to Uatu13 on Wed Jul 11 2018 09:41:37

    Re: AnsiTerm.Js
    By: Uatu13 to Digital Man on Tue Jul 10 2018 07:30 pm

    I don't know why that would be easier. Ctrl-A codes automatically
    expand based on the user's terminal capabilities (not all terminals
    support ANSI sequences).

    I feel silly now. I was thinking the opposite; that terminals would
    be more compatible with ANSI than BBS Codes.. but clearly I need to
    read up on this more. lol

    That's actually true, terminals are more compatible with ANSI than BBS codes. Synchronet automatically translates the Ctrl-A codes to ANSI if the terminal supports ANSI. And if the terminal doesn't support ANSI, then Synchronet does not include any color codes for the terminal client. The terminal isn't actually displaying the Ctrl-A codes.

    Nightfox

    Oh I see now, DM was saying Synchronet expands the Ctrl-A codes, not the terminal. Thanks for expaning on this Nightfox! lol

    I still need to brush up on this stuff. So is it best to use the .asc files for menus etc. instead of .ans files?

    -=U13=-

    ---
    ■ Synchronet ■ The DarkSide of the Moon - telnet://darkside.synchro.net
  • From Nightfox@DIGDIST to Uatu13 on Thursday, July 12, 2018 09:16:07
    Re: AnsiTerm.Js
    By: Uatu13 to Nightfox on Wed Jul 11 2018 07:49 pm

    Oh I see now, DM was saying Synchronet expands the Ctrl-A codes, not the terminal. Thanks for expaning on this Nightfox! lol

    I still need to brush up on this stuff. So is it best to use the .asc files for menus etc. instead of .ans files?

    I like to keep just .asc files, but whether or not you want to do that is up to you. You can sill keep separate .ans files for ANSI and .asc files that don't have any color coding, if you want to do it that way.

    Nightfox

    ---
    ■ Synchronet ■ Digital Distortion: digitaldistortionbbs.com