Subj : Changing SyncTerm Display speed, and...
To   : Android8675
From : echicken
Date : Thu Mar 29 2018 05:47 pm

 Re: Changing SyncTerm Display speed, and...
 By: Android8675 to All on Thu Mar 29 2018 09:24:59

An> So, trying to slow down my BBS from spitting out ANSI screens too quickly.
An> I noticed eChicken has it setup to slow down SyncTerm during long draws
An> and reset for menus. So I guess I'm wondering how he did it. I read that

An> SyncTerm uses a VT500 ansi code to change speeds, but where do you insert
An> that code?
An> Tried using console.putmsg('\e[0;8*r');, no luck.
An> Code is <esc>[0;8*r where first number is 0, 1 or blank, and second number

There are .js libraries to make this easier. This might work:

var Ansi = load({}, "ansiterm_lib.js");
var cterm = load({}, "cterm_lib.js");

// If the terminal is any version of SyncTERM
if (typeof console.cterm_version != 'undefined') {
 Ansi.send("speed", "set", 7);
 // 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
 // 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 76800, 115200
}

console.printfile('poop.ans');

// Reset to normal speed
if (typeof console.cterm_version != 'undefined') {
 Ansi.send("speed", "clear");
}

An> I want to make it so when players exit a door game it will ask the user if
An> they want to display a high-score file.

An> Wondering how I should build this so it can be easily added to any
An> doorgame with a score file?

I would make a JS module that accepts the internal code of an external program
to execute as a command-line parameter. It would launch that xtrn, then prompt
the user and display the appropriate file if desired.  I would modify my shell
/ xtrn_sec.js so that it calls bbs.exec('?door-launcher.js [code]') instead of
bbs.exec_xtrn('[code]').  A mapping of internal codes to score files could be
kept in a config file as you described.

If the 'clean-up command line' for a door could be hijacked for this purpose
instead, that would be an easier option (I haven't tried that and I'm
doubtful).

An> I'd also like to be able to see the score file on the website using
An> something like ansilove.js. If the door has a score file, link it next to
An> the game.

We have a 'handler' script that converts ANSI graphics into HTML. See
'ctrl/web_handler.ini'. The [JavaScript] section should have an entry like:

ans = asc_handler.js

When a '.ans' file is requested by a web client, the server passes the request
to 'asc_handler.js', which formats and sends output to the client. You would
need to do something like this to cause the file to be loaded directly from the
server:

<iframe src="/scores/lord.ans"></iframe>

The file would need to exist somewhere under the server's document root. There
are other ways to accomplish serving this file (XMLHttpRequest, etc.) which I
won't get into right now.

Alternatively, in an XJS file you could do this:

<pre style="font-family: Courier New, monospace">
<?xjs
var f = new File('/sbbs/text/scores/lord.ans');
f.open('r');
var text = f.readAll(8192);
f.close();
write(html_encode(text.join('\r\n'), true, false, true, true)); ?>
</pre>

The 'html_encode' part is the same thing that asc_handler.js is doing.  This
method has the benefit of allowing you to load the file from a place outside of

your document root.

You would want that <pre> block to be in something with a black background.

Lastly, I did write a client-side .bin -> PNG rendering thing for the avatar
gallery on my website.  It doesn't parse .ans at the moment, but that could be
added easily enough.  We can explore that if you don't like the look of the
HTML-encoded ANSI.

---
echicken
electronic chicken bbs - bbs.electronicchicken.com - 416-273-7230

---
� Synchronet � electronic chicken bbs - bbs.electronicchicken.com