Subj : Door Scores...
To : Android8675
From : echicken
Date : Tue Apr 10 2018 03:45 pm
Re: Door Scores...
By: Android8675 to echicken on Tue Apr 10 2018 10:51:52
An> what's the format for scores.ini?
An> doorcode = filename?
I think that's correct. 'filename' probably needs to be a complete path to a
file.
An> Out of curiousity, would this also display files from urls? For example,
No, that sample function will only display a file that exists on your local
filesystem. It could be adapted though.
load('http.js'); // add this near the top of your script
function launch(code) {
bbs.exec_xtrn(code);
if (console.yesno('Display scores')) {
var f = new File(system.ctrl_dir + 'scores.ini');
f.open('r');
var ini = f.iniGetObject();
f.close();
if (ini[code]) {
console.clear(BG_BLACK|LIGHTGRAY);
if (ini[code].search(/^http/) > -1) {
const http = new HTTPRequest();
const ans = http.Get(ini[code]);
console.putmsg(ans);
} else {
console.printfile(ini[code]);
}
console.pause();
}
}
}
That might work. It'll assume that any value from the ini file beginning with
"http" is a URL to some file to download and display.
Would be best to wrap your calls to launch() in a try ... catch block, since
the HTTP request (or file access) might fail.
You could also put the config in ctrl/modopts.ini instead of its own file, and
use modopts.js to load settings.
An> pull the score file from BBS Links
I did recently make a thing for displaying BBSLink scores:
https://github.com/echicken/bbslink-things
It's a bit redundant to the example provided above, but it might be worth
looking at.
---
echicken
electronic chicken bbs - bbs.electronicchicken.com - 416-273-7230
� Synchronet � electronic chicken bbs - bbs.electronicchicken.com