• Issue with MPL script

    From LEE WESTLAKE@2:250/6 to All on Fri Jan 7 19:34:25 2022
    Hi all,

    I'm currently having a play around with MPL scripts (A46 Win32) and appear to have run into an issue regarding the 'KeyPressed/ReadKey' functions in the following code:

    ----------

    var gExitFlag : boolean;
    var gCount : integer;

    begin
    gExitFlag := false;
    repeat
    write('|[X00|[Y00' + int2str(gCount));
    gCount := gCount + 1;
    if (keypressed()) then
    begin
    if ('q' = readkey()) then
    gExitFlag := true;
    end
    until gExitFlag = true;
    end.

    ----------

    The code appears to run as expected when I connect via syncterm, but the netrunner client appears to send a periodic heartbeat code which forces
    the KeyPressed function to return 'true'. I'm not sure which code netrunner
    is sendind, but it appears to stall the subsequent call to ReadKey - pressing
    a key allows the script to continue until the next heartbeat code is sent.

    Most of this is largely supposition, but perhaps the heartbeat code is
    fooling ReadKey into waiting for a multi-byte sequence? Failing that, perhaps there's an error in the script somewhere?

    Any help and/or advice would be greatly appreciated.

    o-----------o------------o-------------------------o
    TALIADON | 2:250/6 | 21:3/138 | TALIADON-BBS@MAIL.COM | o-----------o-----------o------------o-------------------------o
    | "Error is a great teacher, and humility its hardest lesson." | o--------------------------------------------------------------o
    --- Mystic BBS v1.12 A46 2020/08/26 (Windows/32)
    * Origin: TALIADON BBS (2:250/6)
  • From g00r00@1:129/215 to LEE WESTLAKE on Fri Jan 7 15:29:26 2022
    I'm currently having a play around with MPL scripts (A46 Win32) and
    appear to have run into an issue regarding the 'KeyPressed/ReadKey' functions in the following code:

    My first suggestion would be to update to the A47 release since I no longer have the A46 code to make a fix if we do determine a bug exists. It could be something fixed in A47 as well.

    gExitFlag := false;
    repeat
    write('|[X00|[Y00' + int2str(gCount));
    gCount := gCount + 1;
    if (keypressed()) then
    begin
    if ('q' = readkey()) then
    gExitFlag := true;
    end
    until gExitFlag = true;

    Assuming you're not trying to do more than what you're showing here you could simplify this with a single line like:

    Repeat Until OneKey('Q') = 'Q';

    Or

    Repeat Until UpCase(ReadKey) = 'Q';

    In any case, if you are going to loop like you are there I would suggest putting some minor delay in there so as to not blow up your CPU usage. Maybe a delay(10) at the bottom of the repeat loop.

    ... Some people have no idea what they're doing, and are really good at it!

    --- Mystic BBS v1.12 A47 2021/12/25 (Windows/64)
    * Origin: Sector 7 * Mystic WHQ (1:129/215)
  • From LEE WESTLAKE@2:250/6 to g00r00 on Fri Jan 7 21:04:46 2022
    My first suggestion would be to update to the A47 release since I no longer have the A46 code to make a fix if we do determine a bug exists. It could be something fixed in A47 as well.

    OK, this is in the pipeline for me.

    Assuming you're not trying to do more than what you're showing here you could simplify this with a single line like:

    Repeat Until OneKey('Q') = 'Q';

    Or

    Repeat Until UpCase(ReadKey) = 'Q';

    This was a stripped down piece of code which contained multiple exit
    criteria, hence the exit bool.

    In any case, if you are going to loop like you are there I would suggest putting some minor delay in there so as to not blow up your CPU usage. Maybe a delay(10) at the bottom of the repeat loop.

    Agreed: the original code did indeed have a delay to cycle the thread.

    Once i get A47 up, I'll test and let you know.

    o-----------o------------o-------------------------o
    TALIADON | 2:250/6 | 21:3/138 | TALIADON-BBS@MAIL.COM | o-----------o-----------o------------o-------------------------o
    | "Error is a great teacher, and humility its hardest lesson." | o--------------------------------------------------------------o

    --- Mystic BBS v1.12 A46 2020/08/26 (Windows/32)
    * Origin: TALIADON BBS (2:250/6)
  • From g00r00@1:129/215 to LEE WESTLAKE on Fri Jan 7 17:37:36 2022
    This was a stripped down piece of code which contained multiple exit criteria, hence the exit bool.

    Yep I figured as much!

    Once i get A47 up, I'll test and let you know.

    Great thanks! We'll get it doing what you want one way or another!

    ... Read messages, not taglines

    --- Mystic BBS v1.12 A48 2022/01/07 (Windows/32)
    * Origin: Sector 7 * Mystic WHQ (1:129/215)
  • From LEE WESTLAKE@2:250/6 to g00r00 on Sat Jan 8 00:14:03 2022
    Great thanks! We'll get it doing what you want one way or another!

    Well sir, you've never let us down before. I'll spend tomorrow setting up a bare bones A47 system and testing said script.

    o-----------o------------o-------------------------o
    TALIADON | 2:250/6 | 21:3/138 | TALIADON-BBS@MAIL.COM | o-----------o-----------o------------o-------------------------o
    | "Error is a great teacher, and humility its hardest lesson." | o--------------------------------------------------------------o
    --- Mystic BBS v1.12 A46 2020/08/26 (Windows/32)
    * Origin: TALIADON BBS (2:250/6)
  • From LEE WESTLAKE@2:250/6 to g00r00 on Sat Jan 8 15:13:47 2022
    Great thanks! We'll get it doing what you want one way or another!

    Hi g00r00,

    Having now tested the script on A47, I'm able to confirm that the issue continues to persist.

    From what I'm able to observe: Netrunner is periodically sending the two
    byte hex sequence "FF F1", which is validating 'KeyPressed' and sending 'ReadKey' into a wait state. Again, this is mere supposition on my part.

    o-----------o------------o-------------------------o
    TALIADON | 2:250/6 | 21:3/138 | TALIADON-BBS@MAIL.COM | o-----------o-----------o------------o-------------------------o
    | "Error is a great teacher, and humility its hardest lesson." | o--------------------------------------------------------------o
    --- Mystic BBS v1.12 A46 2020/08/26 (Windows/32)
    * Origin: TALIADON BBS (2:250/6)
  • From g00r00@1:129/215 to LEE WESTLAKE on Mon Jan 10 11:19:06 2022
    From what I'm able to observe: Netrunner is periodically sending the two byte hex sequence "FF F1", which is validating 'KeyPressed' and sending 'ReadKey' into a wait state. Again, this is mere supposition on my part.

    Are you using the latest NetRunner? (from URL below):

    www.mysticbbs.com/downloads/prealpha

    And is this in Windows or Linux? I'll set up the identical test here.

    ... Back up my hard drive? I can't find the reverse switch!
    --- Mystic BBS v1.12 A48 2022/01/07 (Windows/32)
    * Origin: Sector 7 * Mystic WHQ (1:129/215)
  • From LEE WESTLAKE@2:250/6 to g00r00 on Tue Jan 11 15:17:21 2022
    Are you using the latest NetRunner? (from URL below):

    www.mysticbbs.com/downloads/prealpha

    And is this in Windows or Linux? I'll set up the identical test here.

    I am currently using Netrunner Beta 21, but confirm that Beta 22 also exhibits the same behaviour.

    The Mystic test sever is A47 (Win32), and Netrunner has been tested on both Windows (x64) and linux (x64).

    o-----------o------------o-------------------------o
    TALIADON | 2:250/6 | 21:3/138 | TALIADON-BBS@MAIL.COM | o-----------o-----------o------------o-------------------------o
    | "Error is a great teacher, and humility its hardest lesson." | o--------------------------------------------------------------o
    --- Mystic BBS v1.12 A46 2020/08/26 (Windows/32)
    * Origin: TALIADON BBS (2:250/6)
  • From LEE WESTLAKE@2:250/6 to g00r00 on Sun Jan 16 12:11:19 2022
    Having now tested the script on A47, I'm able to confirm that the
    issue continues to persist.

    From what I'm able to observe: Netrunner is periodically sending the two byte hex sequence "FF F1", which is validating 'KeyPressed' and sending 'ReadKey' into a wait state. Again, this is mere supposition on my part.

    Hi g00r00,

    Quick update:

    After further digging, it appears netrunner is employing the telnet NOP
    command ($FF $F1) as a periodic "keep alive" signal.

    o-----------o------------o-------------------------o
    TALIADON | 2:250/6 | 21:3/138 | TALIADON-BBS@MAIL.COM | o-----------o-----------o------------o-------------------------o
    | "Error is a great teacher, and humility its hardest lesson." | o--------------------------------------------------------------o
    --- Mystic BBS v1.12 A46 2020/08/26 (Windows/32)
    * Origin: TALIADON BBS (2:250/6)
  • From g00r00@1:129/215 to LEE WESTLAKE on Tue Jan 18 12:53:29 2022
    Quick update:

    After further digging, it appears netrunner is employing the telnet NOP command ($FF $F1) as a periodic "keep alive" signal.

    Thanks I haven't had a chance to look at it yet but I will try to remember to take a look soon.

    Yes NetRunner does send a NOOP when using Telnet in order to allow people to idle without the network interface card timing out the connection (this does not "fool" Mystic's inactivity counter but keeps the OS from disconnecting).

    ... Error, no Keyboard - Press F1 to Continue.

    --- Mystic BBS v1.12 A48 2022/01/14 (Windows/64)
    * Origin: Sector 7 * Mystic WHQ (1:129/215)
  • From LEE WESTLAKE@2:250/6 to g00r00 on Tue Jan 18 20:26:20 2022
    Thanks I haven't had a chance to look at it yet but I will try to
    remember to take a look soon.

    Thanks g00r00, much appreciated.

    FYI: After further testing, this issue doesn't appear to affect the linux builds of Mystic.

    o-----------o------------o-------------------------o
    TALIADON | 2:250/6 | 21:3/138 | TALIADON-BBS@MAIL.COM | o-----------o-----------o------------o-------------------------o
    | "Error is a great teacher, and humility its hardest lesson." | o--------------------------------------------------------------o
    --- Mystic BBS v1.12 A46 2020/08/26 (Windows/32)
    * Origin: TALIADON BBS (2:250/6)