• Help using gettext.js

    From vela025@VERT to ALL on Sun Oct 13 14:20:12 2024
    Hey all,

    A while ago I was creating BeeBS II the successor to BeeBS (beebs.ddns.net) a BBS which supports Acorn mode 7 (teletext graphics) as well as ANSI and ASCII running on my BBC Micro. I've recently found my backup of BeeBSII (the synchronet successor) and would like to complete the project but this time "legally" i.e. still keeping a 40 col ascii mode rather than sending teletext control codes via that. Instead I've decided to create a localisation language (bbcmicro) and store the menu files in /text/menu/bbcmicro. Using text.bbcmicro.ini will allow me to create the Mode 7 prompts, but I'm struggling to use gettext.js to customise yesnobar.js I would like to replace "\x01h\x014\x01w\x01e[\x01~%s]\x01n\x01b\x01h \x01~%s" with "\x82(%s)\x81%s".

    To yesnobar.js I have added/amended:
    load("gettext.js");
    str = format(gettext("\x01h\x014\x01w\x01e[\x01~%s]\x01n\x01b\x01h \x01~%s"), yes_str, no_str);

    To the end of text.bbcmicro.ini I have added:
    [JS]
    \x01h\x014\x01w\x01e[\x01~%s]\x01n\x01b\x01h \x01~%s = \x82(%s)\x81%s

    I get no errors, however the prompts appear as they originally did.

    I can replace the string in yesnobar.js which works fine, but then (understandably) doesn't look great in ASCII/ANSI clients.

    There is also a small typo in the example given here: http://wiki.synchro.net/custom:javascript:lib:gettext.js

    print(getttext - should be - print(gettext

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Digital Man@VERT to vela025 on Sun Oct 13 14:53:07 2024
    Re: Help using gettext.js
    By: vela025 to ALL on Sun Oct 13 2024 02:20 pm

    Hey all,

    A while ago I was creating BeeBS II the successor to BeeBS (beebs.ddns.net) a BBS which supports Acorn mode 7 (teletext graphics) as well as ANSI and ASCII running on my BBC Micro. I've recently found my backup of BeeBSII (the synchronet successor) and would like to complete the project but this time "legally" i.e. still keeping a 40 col ascii mode rather than sending teletext control codes via that. Instead I've decided to create a localisation language (bbcmicro) and store the menu files in /text/menu/bbcmicro. Using text.bbcmicro.ini will allow me to create the Mode 7 prompts, but I'm struggling to use gettext.js to customise yesnobar.js I would like to replace "\x01h\x014\x01w\x01e[\x01~%s]\x01n\x01b\x01h \x01~%s" with "\x82(%s)\x81%s".

    To yesnobar.js I have added/amended:
    load("gettext.js");
    str = format(gettext("\x01h\x014\x01w\x01e[\x01~%s]\x01n\x01b\x01h \x01~%s"), yes_str, no_str);

    To the end of text.bbcmicro.ini I have added:
    [JS]
    \x01h\x014\x01w\x01e[\x01~%s]\x01n\x01b\x01h \x01~%s = \x82(%s)\x81%s

    I get no errors, however the prompts appear as they originally did.

    I'm not surprised, honestly. The Ctrl-A escape sequences are likely going to cause issues. You *might* have be better luck using a string literal assignment (colon instead of equals), but probably not.

    I can replace the string in yesnobar.js which works fine, but then (understandably) doesn't look great in ASCII/ANSI clients.

    There's probably a better solution, like just using a custom replacment for the yesnobar/noyesbar mods when in this teletextmode.

    There is also a small typo in the example given here: http://wiki.synchro.net/custom:javascript:lib:gettext.js

    print(getttext - should be - print(gettext

    Fixed, thanks.
    --
    digital man (rob)

    Synchronet/BBS Terminology Definition #12:
    C128 = Commodore 128 (personal computer)
    Norco, CA WX: 79.7°F, 34.0% humidity, 9 mph W wind, 0.00 inches rain/24hrs

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Digital Man@VERT to vela025 on Sun Oct 13 15:00:39 2024
    Re: Help using gettext.js
    By: Digital Man to vela025 on Sun Oct 13 2024 02:53 pm

    There's probably a better solution, like just using a custom replacment for the yesnobar/noyesbar mods when in this teletextmode.

    To elaborate, in your text.bbcmicro.ini (root section, not [JS]):
    YesNoQuestion = @exec:bbcyesno@
    NoYesQuestion = @exec:bbsnoyes@

    (but the "exec" must be uppercase). Then you can create your mods/bbcyesno.js and bbcnoyes.js to do your thing. No change to yesnobar.js or noyesbar.js should be needed.
    --
    digital man (rob)

    Breaking Bad quote #32:
    Don't think so hard it's gonna hurt your brain! - Hank Schrader
    Norco, CA WX: 80.3°F, 36.0% humidity, 9 mph WSW wind, 0.00 inches rain/24hrs

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From vela025@VERT to Digital Man on Mon Oct 14 12:37:15 2024
    To elaborate, in your text.bbcmicro.ini (root section, not [JS]): YesNoQuestion = @exec:bbcyesno@
    NoYesQuestion = @exec:bbsnoyes@

    (but the "exec" must be uppercase). Then you can create your mods/bbcyesno.js and bbcnoyes.js to do your thing. No change to yesnobar.js or noyesbar.js should be needed.

    Brilliant thank you, that has worked great. Is it possible to do something similar with the main prompt in default.js?

    "\x01-\x01c\xfe \x01b\x01h" + gettext("Main") + " \x01n\x01c\xfe \x01h" + time_code +
    " \x01n\x01c[\x01h@GN@\x01n\x01c] @GRP@\x01\\ [\x01h@SN@\x01n\x01c] @SUB@: \x01n",

    I can't see an exec for it in text.dat so assuming not quite as simple to customise?

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From MRO@VERT/BBSESINF to vela025 on Mon Oct 14 15:29:17 2024
    Re: Help using gettext.js
    By: vela025 to Digital Man on Mon Oct 14 2024 12:37 pm


    "\x01-\x01c\xfe \x01b\x01h" + gettext("Main") + " \x01n\x01c\xfe \x01h" + time_code +
    " \x01n\x01c[\x01h@GN@\x01n\x01c] @GRP@\x01\\ [\x01h@SN@\x01n\x01c] @SUB@: \x01n",

    I can't see an exec for it in text.dat so assuming not quite as simple to customise?

    just use @codes to print the time
    you can do an exec code in your text.dat or in your command shell.

    i have an animated script i wrote for my prompt.
    ---
    ■ Synchronet ■ ::: BBSES.info - free BBS services :::
  • From vela025@VERT to MRO on Mon Oct 14 13:45:37 2024
    just use @codes to print the time
    you can do an exec code in your text.dat or in your command shell.

    i have an animated script i wrote for my prompt.

    I think you may have misunderstood what I'm trying to do. I would like the main menu prompt located in default.js to use Acorn Mode 7 control codes if the user has their language set to BBC Micro, but continue to use the default control codes if not. In the same way the yesnobar now displays (thanks to Rob) \x01h\x014\x01w\x01e[\x01~%s]\x01n\x01b\x01h \x01~%s by default but \x82(%s)\x81%s on a Mode 7 terminal.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From MRO@VERT/BBSESINF to vela025 on Mon Oct 14 16:24:34 2024
    Re: Help using gettext.js
    By: vela025 to MRO on Mon Oct 14 2024 01:45 pm

    just use @codes to print the time
    you can do an exec code in your text.dat or in your command shell.

    i have an animated script i wrote for my prompt.

    I think you may have misunderstood what I'm trying to do. I would like

    the
    main menu prompt located in default.js to use Acorn Mode 7 control codes if the user has their language set to BBC Micro, but continue to use the default control codes if not. In the same way the yesnobar now displays (thanks to Rob) \x01h\x014\x01w\x01e[\x01~%s]\x01n\x01b\x01h \x01~%s by default but \x82(%s)\x81%s on a Mode 7 terminal.

    almost anything is possible. just put in a check for it and switch it for the user if they meet the requirement.

    or, you can just ask the user if they want those control codes and give them a command shell and text.dat for their terminal. i would use a user flag for keeping track.

    ---
    ■ Synchronet ■ ::: BBSES.info - free BBS services :::
  • From Digital Man@VERT to vela025 on Mon Oct 14 17:10:19 2024
    Re: Help using gettext.js
    By: vela025 to Digital Man on Mon Oct 14 2024 12:37 pm

    To elaborate, in your text.bbcmicro.ini (root section, not [JS]): YesNoQuestion = @exec:bbcyesno@
    NoYesQuestion = @exec:bbsnoyes@

    (but the "exec" must be uppercase). Then you can create your mods/bbcyesno.js and bbcnoyes.js to do your thing. No change to yesnobar.js or noyesbar.js should be needed.

    Brilliant thank you, that has worked great. Is it possible to do something similar with the main prompt in default.js?

    "\x01-\x01c\xfe \x01b\x01h" + gettext("Main") + " \x01n\x01c\xfe \x01h" + time_code +
    " \x01n\x01c[\x01h@GN@\x01n\x01c] @GRP@\x01\\ [\x01h@SN@\x01n\x01c] @SUB@: \x01n",

    I can't see an exec for it in text.dat so assuming not quite as simple to customise?

    There's no text.dat string for a specific command shell prompt, no. We could possibly pull that prompt from a JSON file as using a .ini file (e.g. modopts.ini) is likely a pain (or likely impossible, currently) due to all the escape sequences and extra quotes. JSON would likely work better for that case.
    --
    digital man (rob)

    Breaking Bad quote #18:
    All right, Operation: TBD, thanks for nothing Gomey. - Hank Schrader
    Norco, CA WX: 73.1°F, 58.0% humidity, 10 mph SW wind, 0.00 inches rain/24hrs

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Digital Man@VERT to vela025 on Mon Oct 14 19:35:51 2024
    Re: Help using gettext.js
    By: Digital Man to vela025 on Mon Oct 14 2024 05:10 pm

    There's no text.dat string for a specific command shell prompt, no. We could possibly pull that prompt from a JSON file as using a .ini file (e.g. modopts.ini) is likely a pain (or likely impossible, currently) due to all the escape sequences and extra quotes. JSON would likely work better for that case.

    I ended up doing something different/better, still using the text[.lang].ini file. See my commits and wiki updates for details. Let me know if you have any questions.
    --
    digital man (rob)

    This Is Spinal Tap quote #40:
    Morty the Mime: Come on, don't talk back, mime is money, come on, move it. Norco, CA WX: 64.1°F, 77.0% humidity, 4 mph WNW wind, 0.00 inches rain/24hrs

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From vela025@VERT to Digital Man on Tue Oct 15 01:46:52 2024
    I ended up doing something different/better, still using the text[.lang].ini file.

    Thanks so much for taking the time to do that Rob, I gave it a quick test this morning before work and my prompt now has glorious teletext colours and graphics!

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Vela025@VERT/BEEBS2 to Digital Man on Thu Oct 17 14:40:31 2024
    Re: Help using gettext.js
    By: Digital Man to vela025 on Mon Oct 14 2024 19:35:51

    I ended up doing something
    different/better, still using the
    text[.lang].ini file. See my commits > and wiki updates for details. Let me > know if you have any questions.

    Sorry to bother you again (again). I
    have no js knowledge but would it be
    possible to add a prompt just post
    the password entry during the logon
    process (but pre-loading logon.*)
    asking the user for their language
    preferences. A bit of a hack I know,
    but that would allow me to store the
    different menus in their own respectivefolders:
    /menu/ansi
    /menu/ascii
    /menu/mode7
    So that when swapping from a Mode 7
    terminal to a 40 Col ASCII terminal theuser doesn't need to go through a few screens of Mode 7 control codes before
    they can access D from the Main Menu tochange their Language preferences back to English (or in this case ASCII).

    Thanks again,
    Ed

    ---
    ■ Synchronet ■ My Brand-New BBS
  • From Digital Man@VERT to Vela025 on Thu Oct 17 12:04:31 2024
    Re: Help using gettext.js
    By: Vela025 to Digital Man on Thu Oct 17 2024 02:40 pm

    Re: Help using gettext.js
    By: Digital Man to vela025 on Mon Oct 14 2024 19:35:51

    I ended up doing something different/better, still using the text[.lang].ini file. See my commits > and wiki updates for details. Let me > know if you have any questions.

    Sorry to bother you again (again). I have no js knowledge but would it be possible to add a prompt just post
    the password entry during the logon process (but pre-loading logon.*) asking the user for their language preferences. A bit of a hack I know, but that would allow me to store the different menus in their own respectivefolders: /menu/ansi
    /menu/ascii
    /menu/mode7
    So that when swapping from a Mode 7 terminal to a 40 Col ASCII terminal theuser doesn't need to go through a few
    screens of Mode 7 control codes before they can access D from the Main Menu tochange their Language preferences back
    to English (or in this case ASCII).

    This sounds like something you could add to the top of your logon.js file.

    if(confirm("Are you using a BBC Micro Mode 7 terminal"))
    user.lang = "bbcmicro";
    else
    user.lang = "";
    --
    digital man (rob)

    Synchronet "Real Fact" #22:
    The second ever Synchronet BBS was the Mid-Nite Hacker BBS (sysop: The Zapper) Norco, CA WX: 66.3°F, 71.0% humidity, 4 mph WSW wind, 0.00 inches rain/24hrs

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From vela025@VERT to Digital Man on Thu Oct 17 14:53:56 2024
    This sounds like something you could add to the top of your logon.js file.

    if(confirm("Are you using a BBC Micro Mode 7 terminal"))
    user.lang = "bbcmicro";
    else
    user.lang = "";

    Thanks Rob that works well for moving from one UFT-8/ANSI disabled terminal setting to BBC Mode7 (but not if moving from ANSI or something with UTF-8 enabled). Would changing the contents of user.setting allow me to change the terminal type settings to
    auto off, UTF-8 off, ANSI off, CBM/PETSCII off, EXASCII on

    Would something similar to this work:

    if(confirm("Are you using a BBC Micro Mode 7 terminal"))
    user.lang = "bbcmicro";
    user.settings &= ~USER_AUTOTERM | USER_ANSI | USER_RIP | USER_WIP | USER_HTML | USER_PETSCII | USER_UTF8;
    user.settings &= ~USER_EXASCII;
    else
    user.lang = "";

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Digital Man@VERT to vela025 on Thu Oct 17 16:20:36 2024
    Re: Help using gettext.js
    By: vela025 to Digital Man on Thu Oct 17 2024 02:53 pm

    Would something similar to this work:

    if(confirm("Are you using a BBC Micro Mode 7 terminal"))
    user.lang = "bbcmicro";
    user.settings &= ~USER_AUTOTERM | USER_ANSI | USER_RIP | USER_WIP | USER_HTML | USER_PETSCII | USER_UTF8;
    user.settings &= ~USER_EXASCII;
    else
    user.lang = "";

    Yup, I think so. Did you try it?
    --
    digital man (rob)

    This Is Spinal Tap quote #31:
    Viv Savage: Quite exciting, this computer magic!
    Norco, CA WX: 68.5°F, 68.0% humidity, 6 mph W wind, 0.00 inches rain/24hrs

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From vela025@VERT to Digital Man on Fri Oct 18 01:14:34 2024
    Yup, I think so. Did you try it?
    --
    digital man (rob)

    No I was a little worried it would corrupt a settings file somewhere. But I've backed up everything now and this:

    if(confirm("Are you using a BBC Micro Mode 7 terminal"))
    user.lang = "bbcmicro";
    user.settings &= ~USER_AUTOTERM | USER_ANSI | USER_RIP | USER_WIP | USER_HTML | USER_PETSCII | USER_UTF8;
    user.settings &= ~USER_EXASCII;
    else
    user.lang = "";

    Gives line 16:SyntaxError (which is the else line). Else is not indented and at the margin inline with IF. Indenting also give the same error. In the console it displays:

    logon.js line 16: SyntaxError: syntax error
    10/18 08:44:04 term Node 1 <Vela025> !ERROR 2 (No such file or directory) in exec.cpp line 644 (js_execfile) compiling "/home/ed/sbbs/exec/logon.js" access=0

    Desperate times = desperate measures so I used ChatGTP to help which recommended the following structure:

    if (confirm("Are you using a BBC Micro Mode 7 terminal")) {
    user.lang = "bbcmicro";
    user.settings &= ~(USER_AUTOTERM | USER_ANSI | USER_RIP | USER_WIP | USER_HTML | USER_PETSCII | USER_UTF8);
    user.settings &= ~USER_EXASCII;
    } else {
    user.lang = "";
    }

    This does get to displaying the question and no error message but then hangs, with the console displaying:

    logon.js line 15: ReferenceError: USER_EXASCII is not defined, after double checking I realised it should be USER_NO_EXASCII:

    if (confirm("Are you using a BBC Micro Mode 7 terminal")) {
    user.lang = "bbcmicro";
    user.settings &= ~(USER_AUTOTERM | USER_ANSI | USER_RIP | USER_WIP | USER_HTML | USER_PETSCII | USER_UTF8);
    user.settings &= ~USER_EXASCII;
    } else {
    user.lang = "";
    }

    Which worked!! So now I'm going to look at CASE (I think?) so that the user will initially get:

    Please select terminal type:
    (4) 0 Column ASCII
    Acorn Mode (7)
    (8) 0 Column ANSI
    Enter 4, 7 or 8:

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From vela025@VERT to Digital Man on Fri Oct 18 02:53:13 2024
    Which worked!! So now I'm going to look at CASE (I think?) so that the user will initially get:

    Please select terminal type:
    (4) 0 Column ASCII
    Acorn Mode (7)
    (8) 0 Column ANSI
    Enter 4, 7 or 8:

    Quick update got it all working, I'm super please with the outcome thanks for your help!

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Nightfox@VERT/DIGDIST to vela025 on Fri Oct 18 09:16:23 2024
    Re: Help using gettext.js
    By: vela025 to Digital Man on Fri Oct 18 2024 01:14 am

    No I was a little worried it would corrupt a settings file somewhere. But I've backed up everything now and this:

    if(confirm("Are you using a BBC Micro Mode 7 terminal"))
    user.lang = "bbcmicro";
    user.settings &= ~USER_AUTOTERM | USER_ANSI | USER_RIP | USER_WIP |
    USER_HTML | USER_PETSCII | USER_UTF8;
    user.settings &= ~USER_EXASCII;
    else
    user.lang = "";

    Gives line 16:SyntaxError (which is the else line). Else is not indented and at the margin inline with IF. Indenting also give the same error. In

    If you have more than one line in an 'if', 'while', etc., they need to be within curly braces, which may explain that error. For example:

    if(confirm("Are you using a BBC Micro Mode 7 terminal"))
    {
    user.lang = "bbcmicro";
    user.settings &= ~USER_AUTOTERM | USER_ANSI | USER_RIP | USER_WIP |
    USER_HTML | USER_PETSCII | USER_UTF8;
    user.settings &= ~USER_EXASCII;
    }
    else
    user.lang = "";

    Nightfox

    ---
    ■ Synchronet ■ Digital Distortion: digitaldistortionbbs.com
  • From vela025@VERT to Digital Man on Sun Oct 20 12:55:11 2024
    I thought I was doing so well! but there's now an odd issue occurring when swapping from one terminal type to another.

    Scenario 1: Log in a Mode 7 terminal everything's fine, Next login using an ANSI terminal, message summary screen overlays some text over avatar, Log out, Log in again using ANSI terminal everything is fine.
    Scenario 2: Login to Mode 7 after having previously used ANSI terminal and some prompts are not using the BBC "language.ini" customisation (but some are, and some are, but ignoring the colour codes). The main menu is shifted after the first row, log out, log back in using Mode 7 and everything is fine.

    I've put screenshots here: http://beebs.ddns.net/BeeBS/My_Albums/Pages/Synchronet.html which probably make more sense.

    Previously before I added the terminal type selection at logon when the user used to have to change the terminal settings manually (using D from the main menu) this also required the user to log out and back in for all settings to take effect. Is there a command that will "refresh" the settings to ensure they're all being used?

    This is the terminal selection script I've cobbled together:

    switch (userChoice) {
    case "4":
    user.lang = "ascii";
    user.settings &= ~(USER_AUTOTERM | USER_ANSI | USER_RIP | USER_WIP | USER_HTML | USER_PETSCII | USER_UTF8);
    user.settings &= ~USER_NO_EXASCII;
    user.screen_columns = 40;
    user.screen_rows = 25;
    break;
    case "7":
    user.lang = "bbcmicro";
    user.settings &= ~(USER_AUTOTERM | USER_ANSI | USER_RIP | USER_WIP | USER_HTML | USER_PETSCII | USER_UTF8);
    user.settings &= ~USER_NO_EXASCII;
    user.screen_columns = 40;
    user.screen_rows = 25;
    break;
    case "8":
    user.lang = "ansi";
    user.settings &= ~(USER_AUTOTERM | USER_RIP | USER_WIP | USER_HTML | USER_PETSCII | USER_UTF8);
    user.settings &= ~USER_NO_EXASCII;
    user.settings |= USER_ANSI;
    user.screen_columns = 80;
    user.screen_rows = 25;
    break;
    default:
    user.lang = "ascii";
    user.settings &= ~(USER_AUTOTERM | USER_ANSI | USER_RIP | USER_WIP | USER_HTML | USER_PETSCII | USER_UTF8);
    user.settings &= ~USER_NO_EXASCII;
    user.screen_columns = 40;
    user.screen_rows = 25;
    break;
    }

    Thanks again,
    Ed

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Digital Man@VERT to vela025 on Sun Oct 20 14:18:39 2024
    Re: Help using gettext.js
    By: vela025 to Digital Man on Sun Oct 20 2024 12:55 pm


    I thought I was doing so well! but there's now an odd issue occurring when swapping from one terminal type to another.

    Scenario 1: Log in a Mode 7 terminal everything's fine, Next login using an ANSI terminal, message summary screen overlays some text over avatar, Log out, Log in again using ANSI terminal everything is fine.

    "next login" as the same user or a different user? Is either user a "guest" account (have the 'G' restriction)?

    Scenario 2: Login to Mode 7 after having previously used ANSI terminal and some prompts are not using the BBC "language.ini" customisation (but some are, and some are, but ignoring the colour codes). The main menu is shifted after the first row, log out, log back in using Mode 7 and everything is fine.

    console.term_supports() is the function used to normally determine what the user's console's terminal type/capabilties are (compare the return values with the USER_* bit definitions for terminal types/caps in sbbsdefs.js). You're doing something unique/different using a language file to control terminal type. I'm not surprised it's a challenge.

    I've put screenshots here: http://beebs.ddns.net/BeeBS/My_Albums/Pages/Synchronet.html which probably make more sense.

    I looked at it, but doesn't tell me any specific cause.

    Previously before I added the terminal type selection at logon when the user used to have to change the terminal settings manually (using D from the main menu) this also required the user to log out and back in for all settings to take effect. Is there a command that will "refresh" the settings to ensure they're all being used?

    Which "settings" are you referring to? A current client/user's terminal type is normally detected during initial connection/answer and then can be overridden by a user's terminal settings once they login. Most users's use auto-terminal type detection, so they can automatically switch between CP437/ANSI, UTF-8/ANSI and PETSCII clients without having to reconfigure anything. You're doing something unique and different with your BBS.

    This is the terminal selection script I've cobbled together:

    switch (userChoice) {
    case "4":
    user.lang = "ascii";
    user.settings &= ~(USER_AUTOTERM | USER_ANSI | USER_RIP | USER_WIP | USER_HTML | USER_PETSCII | USER_UTF8);
    user.settings &= ~USER_NO_EXASCII;
    user.screen_columns = 40;
    user.screen_rows = 25;
    break;

    I would think an "ascii" terminal would want no extended ASCII (IBM CP437) characters, so that USER_NO_EXASCII flag should be set (not cleared).
    I'm not clear why you're assuming an "ascii" terminal is only 40 columns wide and 25 lines long. That seems wrong.

    case "7":
    user.lang = "bbcmicro";
    user.settings &= ~(USER_AUTOTERM | USER_ANSI | USER_RIP | USER_WIP | USER_HTML | USER_PETSCII | USER_UTF8);
    user.settings &= ~USER_NO_EXASCII;
    user.screen_columns = 40;
    user.screen_rows = 25;
    break;
    case "8":
    user.lang = "ansi";
    user.settings &= ~(USER_AUTOTERM | USER_RIP | USER_WIP | USER_HTML | USER_PETSCII | USER_UTF8);
    user.settings &= ~USER_NO_EXASCII;
    user.settings |= USER_ANSI;
    user.screen_columns = 80;
    user.screen_rows = 25;
    break;

    Why assume that ANSI terminals are 80x25? Why assume ANSI terminals are using CP437 (IBM extended ASCII) and not UTF-8? Why is "ansi" a different language than "ascii"?

    You don't need to bother clearing/worrying about USER_HTML or USER_WIP flags. Those flags are deprecated and unused.

    default:
    user.lang = "ascii";
    user.settings &= ~(USER_AUTOTERM | USER_ANSI | USER_RIP | USER_WIP | USER_HTML | USER_PETSCII | USER_UTF8);
    user.settings &= ~USER_NO_EXASCII;
    user.screen_columns = 40;
    user.screen_rows = 25;
    break;
    }

    If JS, you can just put "default:" on the line before the "case" statement you want to be the default. You don't need to copy/past blocks of code if the default is the same as another case.

    Anyway, you can call console.term_supports() and log/check the return value (e.g. in hexadecimal) against the terminal-related bits you just set in user.settings. This will reflect the current flags used internally in SBBS to determine the user's terminal type.
    --
    digital man (rob)

    Synchronet/BBS Terminology Definition #22:
    DOCSIS = Data Over Cable Service Interface Specification
    Norco, CA WX: 84.3°F, 20.0% humidity, 4 mph WSW wind, 0.00 inches rain/24hrs

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From vela025@VERT to Digital Man on Mon Oct 21 00:27:48 2024
    Hi Rob, sorry for not being more specific/explaining seemingly odd choices :D >"next login" as the same user or a different user?
    Same user

    using a language file to control terminal type
    I'm using the language file to use different control codes for the user prompts, but the script above to change the users terminal type settings is in logon.js.

    Which "settings" are you referring to?
    Changing manually from one terminal type to another. i.e. changing from an ansi supported terminal to soley cp437 used to require the user to log out and back in again (same user account) for all the settings to take effect (this was before adding the terminal prompt at logon and before using the language files to customize prompts). After changing to terminal settings to just cp437 the Mode 7 menus did not display correctly, however when the same user logged out and back in the menus displayed as they should.

    I looked at it, but doesn't tell me any specific cause.
    Yeah I'm not sure what the specific cause is. I think it might be column related as the Mode 7 screens corrupt just after @ANODE|L13@ and the ANSI screen is displaying the avatar too far left. Maybe there is something at logoff that re-confirms the users terminal settings and update a flag I've missed.

    I would think an "ascii" terminal would want no extended ASCII (IBM CP437) characters, so that USER_NO_EXASCII flag should be set (not cleared)

    Oh yes thank you, you're absolutely correct, I'll get that updated.

    The odd terminal choices are because it's primarily designed for a BBC Micro to use, so if you're using ASCII you're most likely in Mode 7 (which leaves the most amount of free memory and displays best on a TV, which is 40 columns), if you're using an ANSI client (of which I think there are only 2 and only one of those supports a *massive* 4 colours) then that is 80 columns and does not support UTF-8

    If JS, you can just put "default:" on the line before the "case" statement you want to be the default.
    Great thanks JS is still very new to me I'll implement this.

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Digital Man@VERT to vela025 on Mon Oct 21 12:26:16 2024
    Re: Help using gettext.js
    By: vela025 to Digital Man on Mon Oct 21 2024 12:27 am

    Hi Rob, sorry for not being more specific/explaining seemingly odd choices :D >"next login" as the same user or a different user?
    Same user

    Okay, did you try a different user and see what happens?

    using a language file to control terminal type
    I'm using the language file to use different control codes for the user prompts, but the script above to change the users terminal type settings is in logon.js.

    Which "settings" are you referring to?
    Changing manually from one terminal type to another. i.e. changing from an ansi supported terminal to soley cp437 used to require the user to log out and back in again (same user account) for all the settings to take effect (this was before adding the terminal prompt at logon and before using the language files to customize prompts). After changing to terminal settings to just cp437 the Mode 7 menus did not display correctly, however when the same user logged out and back in the menus displayed as they should.

    So I think you're referring to the 'lang' user property (not something I think of as a "terminal type setting"). But anyway, after making a change to the current user's 'lang' property, call bbs.load_user_text() to re-load the ctrl/text.<lang>.ini file.

    The odd terminal choices are because it's primarily designed for a BBC Micro to use, so if you're using ASCII you're most likely in Mode 7 (which leaves the most amount of free memory and displays best on a TV, which is 40 columns), if you're using an ANSI client (of which I think there are only 2 and only one of those supports a *massive* 4 colours) then that is 80 columns and does not support UTF-8

    I still can't can't think of a reason why "ansi" and "ascii" would require different language files.
    --
    digital man (rob)

    This Is Spinal Tap quote #40:
    Morty the Mime: Come on, don't talk back, mime is money, come on, move it. Norco, CA WX: 84.0°F, 21.0% humidity, 0 mph W wind, 0.00 inches rain/24hrs

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From vela025@VERT to Digital Man on Tue Oct 22 00:19:14 2024
    Okay, did you try a different user and see what happens?
    Yeah it happens to all users.

    call bbs.load_user_text() to re-load the ctrl/text.<lang>.ini file.
    This has definaetly fixed mode 7 not using control codes after an ANSI login and ANSI using text.bbc.ini after a Mode 7 login! Thanks!

    I still can't can't think of a reason why "ansi" and "ascii" would require different language files.
    Some prompts are >40 characters which looks a bit messy when it goes on to a seperate line. And some use [ ] which in mode 7 displays as a left and right arrow. Having each as their own lang is a simple way for me to detect which terminal type the client is using so that custom modules can be loaded for each terminal type. For example msglist.js now is a script detecting the terminal type (via checking the lang setting) and then branches off in to msglistbbc.js/msglist.js

    So now the only issue seems to be that all terminal types for the first logon after a change of terminal type between Mode 7 and ANSI causes ANSI to scroll at row 13 and *Press any key to continue*. In terms of columns it is either adding or taking away 40 columns from the column width for both ANSI and Mode 7. Examples of how this manifests itself here: http://beebs.ddns.net/BeeBS/My_Albums/Pages/Term_Dim.html Is there something similar to bbs.load_user_text() for terminal row and height?

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From Digital Man@VERT to vela025 on Tue Oct 22 12:06:58 2024
    Re: Help using gettext.js
    By: vela025 to Digital Man on Tue Oct 22 2024 12:19 am

    Okay, did you try a different user and see what happens?
    Yeah it happens to all users.

    call bbs.load_user_text() to re-load the ctrl/text.<lang>.ini file.
    This has definaetly fixed mode 7 not using control codes after an ANSI login and ANSI using text.bbc.ini after a Mode 7 login! Thanks!

    You're welcome.

    I still can't can't think of a reason why "ansi" and "ascii" would require different language files.
    Some prompts are >40 characters which looks a bit messy when it goes on to a seperate line.

    Try using the Ctrl-A\ (conditional new-line) sequence to add line breaks where you'd want them for 40 column terminals. You can see a lot of these in the stock ctrl/text.dat file for this reason.

    But that's 40 versus 80 colum, not ANSI for ASCII. ASCII terminals are not always 40 columns.

    And some use [ ] which in mode 7 displays as a left and right
    arrow.

    Sure, that's an argument for a "BBC" lang file and then a non-BBC lang file. I still don't see why you'd need a separate lang file for ASCII versus ANSI.

    Having each as their own lang is a simple way for me to detect which terminal type the client is using so that custom modules can be loaded for each terminal type. For example msglist.js now is a script detecting the terminal type (via checking the lang setting) and then branches off in to msglistbbc.js/msglist.js

    Again, that'd be BBC versus non-BBC.

    So now the only issue seems to be that all terminal types for the first logon after a change of terminal type between Mode 7 and ANSI causes ANSI to scroll at row 13 and *Press any key to continue*. In terms of columns it is either adding or taking away 40 columns from the column width for both ANSI and Mode 7. Examples of how this manifests itself here: http://beebs.ddns.net/BeeBS/My_Albums/Pages/Term_Dim.html Is there something similar to bbs.load_user_text() for terminal row and height?

    There's console.screen_rows and screen_columns, both are writable.

    There's also console.getdimensions() that will query the terminal (if it's ANSI) and auto-detect the user's screen height and width, but only if one or both are set (by the user) to 0 (auto), and only for ANSI-capable terminals.
    --
    digital man (rob)

    Synchronet/BBS Terminology Definition #73:
    SMB = Synchronet Message Base (e.g. smblib)
    Norco, CA WX: 84.2°F, 27.0% humidity, 0 mph WNW wind, 0.00 inches rain/24hrs

    ---
    ■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net
  • From vela025@VERT to Digital Man on Tue Oct 22 13:38:39 2024
    There's console.screen_rows and screen_columns, both are writable.

    YES!! Thanks Rob that has completely fixed the issue!

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