-
JS Commission?
From
Android8675@VERT/SHODAN to
All on Thu May 28 08:07:59 2020
Looking for some help. I was about to tear into existing .js doors to see if I could figure it all out on my own, but maybe someone here might be able to make it easier for me.ããSo I enjoy interactive fiction, a "bit", but finding a decent interpreter has been a pain in Windows because for some reason a lot of programs like Frotz for DOS/Windows just do not output simple text for BBSs, OR they allow saving anywhere which... that's just no good. So I found an old Waffle BBS door that did the trick (allowed saves for each user, output plain text, and even made a top 10 scores list), but now I've jumped over to Linux and dfrotz is working in a few test scenarios, but I'd like to have a small frontend that lets the user specify a couple parameters. So I'm hoping to have a .js door that:ãã-takes a story datafile as a parameterã-asks the user a question which specifies color choices to pass to dfrotzã-makes a save folder for the user based on their username-# if it does not exist.ã+and calls dfrotz and exits after.ããAny help is appreciated from "Look at this link, you can do it..." type encouragement all the way up to a chunk of .js that I can drop in, modify as needed, test, deploy, etc.ããCredit given where credit is due. I could even float compensation your way if needed.ããAs always, thanks in advance...ã-A.ã--ãAndroid8675@ShodansCoreãã---ã þ Synchronet þ Shodan's Core @ ShodansCore.comã
-
From
Coz@VERT/CEBBS to
Android8675 on Thu May 28 19:14:15 2020
Re: JS Commission?ã By: Android8675 to All on Thu May 28 2020 08:07 amãã > Any help is appreciated from "Look at this link, you can do it..." typeã > encouragement all the way up to a chunk of .js that I can drop in, modify asã > needed, test, deploy, etc.ããThis may not be anything near what you're looking for.. and it's not JS, but have you taken a look at this project:ãã
https://sourceforge.net/projects/frotzdoor/ããIt might get you closer to what you're looking for. I believe Marisa G. frequents DOVEnet and may have more insight as well. Hope this helps!ãã---ã þ Synchronet þ The Computer Express - cebbs.costakis.orgã
-
From
echicken@VERT/ECBBS to
Android8675 on Sun May 31 16:35:14 2020
Re: JS Commission?ã By: Android8675 to All on Thu May 28 2020 08:07:59ãã An> I'd like to have a small frontend that lets the user specify a couple parameters. So I'm hoping toã An> have a .js door that: ãã An> -takes a story datafile as a parameterã An> -asks the user a question which specifies color choices to pass to dfrotzã An> -makes a save folder for the user based on their username-# if it does not exist.ã An> +and calls dfrotz and exits after.ãã// Script startsãconsole.clear();ãconst story = argv[0];ãconst color = console.yesno('Do you want color?');ãconst save_dir = backslash(format('%s%04d-dfrotz', system.data_dir, user.number));ãmkdir(save_dir);ãbbs.exec(ã 'dfrotz' +ã ' -h ' + console.screen_rows +ã ' -f ' + (color ? 'ansi' : 'normal') +ã ' -R ' + save_dirã);ã// Script endsããThat's a start anyhow; probably some more things to be added.ãã---ãechickenãelectronic chicken bbs - bbs.electronicchicken.comã þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.comã
-
From
Android8675@VERT/SHODAN to
echicken on Fri Jun 5 13:37:11 2020
Re: JS Commission?
By: Android8675 to All on Thu May 28 2020 08:07:59
// Script starts
console.clear();
const story = argv[0];
const color = console.yesno('Do you want color?');
const save_dir = backslash(format('%s%04d-dfrotz', system.data_dir, user.number));
mkdir(save_dir);
bbs.exec(
'dfrotz' +
' -h ' + console.screen_rows +
' -f ' + (color ? 'ansi' : 'normal') +
' -R ' + save_dir
);
// Script ends
That's a start anyhow; probably some more things to be added.
Thanks eC, gonna get to tinkering, can you decode the save_dir const for me? if user 1 runs zork, where's the save end up? if it's like /sbbs/data/if/zork/1/ that'd work...
--
Android8675@ShodansCore
---
þ Synchronet þ Shodan's Core @ ShodansCore.com
-
From
echicken@VERT/ECBBS to
Android8675 on Fri Jun 5 21:39:22 2020
Re: JS Commission?ã By: Android8675 to echicken on Fri Jun 05 2020 13:37:11ãã >> const save_dir = backslash(format('%s%04d-dfrotz', system.data_dir,ã >> user.number));ãã An> Thanks eC, gonna get to tinkering, can you decode the save_dir const for me? ifã An> user 1 runs zork, where's the save end up? if it's like /sbbs/data/if/zork/1/ã An> that'd work...ããMy example would've resulted in something like:ãã /sbbs/data/0001-dfrotz/ããMaybe you want something like:ãã const save_dir = backslash(format('%s/if/%s/%d', system.data_dir, story, user.number);ããLooks like I forgot to tell dfrotz which story file to use, so the bbs.exec statement should be more like:ãã bbs.exec(ã 'dfrotz' +ã '-h ' + console.screen_rows +ã '-f ' + (color ? 'ansi' : 'normal') +ã '-R ' + save_dir +ã storyã );ãã---ãechickenãelectronic chicken bbs - bbs.electronicchicken.comã þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.comã
-
From
Android8675@VERT/SHODAN to
echicken on Sun Jun 7 10:44:14 2020
Re: JS Commission?ã By: echicken to Android8675 on Fri Jun 05 2020 09:39 pmãã > >> const save_dir = backslash(format('%s%04d-dfrotz', system.data_dir,ã > >> user.number));ã >ã > My example would've resulted in something like:ã >ã > /sbbs/data/0001-dfrotz/ã >ã > Maybe you want something like:ã >ã > const save_dir = backslash(format('%s/if/%s/%d', system.data_dir, story,ã > user.number);ããOK, so the first %s is replaced with /sbbs/data/, then if/, then story/, and 0001/ for /sbbs/data/if/zork1/0001/ããI think I can figure that out, might swap story for the internal door code. I could maybe name the story file as the internal door code that way you just call the .js with no parameters needed, but that sounds like it breaks some code rule.ãã > Looks like I forgot to tell dfrotz which story file to use, so the bbs.execã > statement should be more like:ã >ã > bbs.exec(ã > 'dfrotz' +ã > '-h ' + console.screen_rows +ã > '-f ' + (color ? 'ansi' : 'normal') +ã > '-R ' + save_dir +ã > storyã > );ããGot that part. Thanks again. -A.ãã--ãAndroid8675@ShodansCoreãã---ã þ Synchronet þ Shodan's Core @ ShodansCore.comã
-
From
echicken@VERT/ECBBS to
Android8675 on Sun Jun 7 14:18:29 2020
Re: JS Commission?ã By: Android8675 to echicken on Sun Jun 07 2020 10:44:14ãã An> I think I can figure that out, might swap story for the internal door code. I could maybe name theã An> story file as the internal door code that way you just call the .js with no parameters needed, butã An> that sounds like it breaks some code rule. ããYou could try 'user.curxtrn' in place of 'story', as long as the internal code of the external program matches the name of the story file exactly (or work from there by appending a suffix/file extension or whatever to the value of user.curxtrn).ãã---ãechickenãelectronic chicken bbs - bbs.electronicchicken.comã þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.comã
-
From
Android8675@VERT/SHODAN to
echicken on Mon Jun 8 12:32:23 2020
Re: JS Commission?
By: Android8675 to echicken on Sun Jun 07 2020 10:44:14
You could try 'user.curxtrn' in place of 'story', as long as the internal code of the external program matches the name of the story file exactly (or work from there by appending a suffix/file extension or whatever to the value of user.curxtrn).
OK, I can try that. I started the tinkering. Hopefully I'll have something cool by the end of the week. Board is running so smoothly now.
Sidenote...
I'm glad I took the time to move everything over to Linux. It's just so nice, but I broke my webv4 custom.css. Something was causing problems as all the text colors were weird, but after a restart and nuking nginx that I forgot I put on, everything seems to be working smoothly.
--
Android8675@ShodansCore
---
þ Synchronet þ Shodan's Core @ ShodansCore.com
-
From
Android8675@VERT/SHODAN to
Coz on Mon Jun 8 12:37:23 2020
This may not be anything near what you're looking for.. and it's not JS, but have you taken a look at this project:
https://sourceforge.net/projects/frotzdoor/
It might get you closer to what you're looking for. I believe Marisa G. frequents DOVEnet and may have more insight as well. Hope this helps!
Saw that a long time ago, I don't like that it disables saving altogether. IF needs a save capability. Easier to just tell Frotz where it's OK to save files each time and restrict it's access as needed. I'm getting there. I really wanted to mess with fonts and color settings as well. Eventually I'd like to make it so you can run the story through the web or bbs interface, access your saves, and get access to the more advanced story engines like Hugo, TADS, Glulx, etc.
--
Android8675@ShodansCore
---
þ Synchronet þ Shodan's Core @ ShodansCore.com
-
From
Tracker1@VERT/TRN to
echicken on Sun Jun 14 22:49:55 2020
On 6/5/2020 6:39 PM, echicken wrote:
My example would've resulted in something like:
/sbbs/data/0001-dfrotz/
Maybe you want something like:
const save_dir = backslash(format('%s/if/%s/%d', system.data_dir, story, user.number);
just a thought data_dir/usernumber/frotz/story/
This way user data is cleaned up when a user is recycled. User-number prefixed to 3/4 iirc.
--
Michael J. Ryan
tracker1 +o Roughneck BBS
---
þ Synchronet þ Roughneck BBS - coming back 2/2/20
-
From
Android8675@VERT/SHODAN to
echicken on Tue Jul 14 11:51:05 2020
My example would've resulted in something like:
/sbbs/data/0001-dfrotz/
Hey eC,
So I have:
const story = backslash(format('stories/%s', argv[0]));
const save_dir = backslash(format('%sif/%s%d', system.data_dir, story, user.number));
//debug
console.print(story);
console.crlf(2);
console.print(save_dir);
and it spits out:
stories/zork1.z3/
/sbbs/data/if/stories/zork1.z3/1/
the save path is fine, and I verified it works, but how do I drop the trailing slash for the story file? Was thinking:
const story = format('stories/%s', argv[0]);
---
ï¿ Synchronet ï¿ Shodan's Core @ ShodansCore.com
-
From
echicken@VERT/ECBBS to
Android8675 on Tue Jul 14 23:05:35 2020
Re: JS Commission?ã By: Android8675 to echicken on Tue Jul 14 2020 11:51:05ãã >> const story = backslash(format('stories/%s', argv[0]));ã >> const save_dir = backslash(format('%sif/%s%d', system.data_dir, story,ã >> user.number));ã >> //debugã >> console.print(story);ã >> console.crlf(2);ã >> console.print(save_dir);ãã An> and it spits out:ãã >> stories/zork1.z3/ãã >> /sbbs/data/if/stories/zork1.z3/1/ãã An> the save path is fine, and I verified it works, but how do I drop the trailingã An> slash for the story file? Was thinking:ãã >> const story = format('stories/%s', argv[0]);ããbackslash(str) adds a slash or backslash to 'str', depending whether you are on *nix or Windows. I don't think it actually checks to see if the path exists, if there's a file or dir there, etc.ããYou might try:ããconst story = format('stories/%s', argv[0]);ãconst save_dir = backslash(format('%sif/%s', system.data_dir, story));ãconst save_file = format('%s%d', save_dir, user.number);ããand then adjust your script to use save_file instead of save_dir.ããOr you could condense it to:ããconst save_file = backslash(format('%sif/stories/%s', system.data_dir, argv[0])) + user.number;ãã---ãechickenãelectronic chicken bbs - bbs.electronicchicken.comã þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.comã
-
From
Mortifis@VERT/EPHRAM to
Android8675 on Wed Jul 15 00:36:25 2020
My example would've resulted in something like:ãã > > /sbbs/data/0001-dfrotz/ãã > Hey eC,ãã > So I have:ãã > > const story = backslash(format('stories/%s', argv[0]));ã > > const save_dir = backslash(format('%sif/%s%d', system.data_dir, story,ã > > user.number));ãã > > //debugã > > console.print(story);ã > > console.crlf(2);ã > > console.print(save_dir);ãã > and it spits out:ãã > > stories/zork1.z3/ãã > > /sbbs/data/if/stories/zork1.z3/1/ãã > the save path is fine, and I verified it works, but how do I drop theã > trailing slash for the story file? Was thinking:ãã > > const story = format('stories/%s', argv[0]);ããconst story = format('stories/%s', argv[0].slice(0,1)); might workãã---ã þ Synchronet þ Realm of Dispair BBS - http://ephram.synchro.net:82ã
-
From
Android8675@VERT/SHODAN to
echicken on Wed Jul 15 09:40:17 2020
You might try:
const story = format('stories/%s', argv[0]);
const save_dir = backslash(format('%sif/%s', system.data_dir, story));
const save_file = format('%s%d', save_dir, user.number);
and then adjust your script to use save_file instead of save_dir.
Or you could condense it to:
const save_file = backslash(format('%sif/stories/%s', system.data_dir, argv[0])) + user.number;
frotz needs a folder for saves. I wonder if I could put all the saves in one folder. Gotta check what frotz uses for save filenames. If the filename contains a story marker then I could probably use:
const story = format('stories/%s', argv[0]);
const save_dir = backslash(format('%sif/saves/%s', system.data_dir, user.number));
That'd dump all saves for one user in /sbbs/data/if/saves/(user.number)/
Next question how do I take a const from 1-4 and pass 4 different results based on the number?
Basically
const colors = console.getnum(4, 1);
then pass different strings based on the answer like..
bbs.exec(
'frotz ' +
'-h ' + console.screen_rows +
'-w ' + console.screen_columns +
'-f ' + (colors ? 'green' : 'white' : 'white' : 'yellow') + // <--- these bits here
'-b ' + (colors ? 'black' : 'black' : 'blue' : 'black') +
'-R ' + save_dir +
story
);
Final final... why doesn't the background on this line switch to blue? Ctrl-A "4" should be blue background.
console.putmsg(" 3.\1h\14 White on Blue\1n");
--
Android8675@ShodansCore
---
ï¿ Synchronet ï¿ Shodan's Core @ ShodansCore.com
-
From
echicken@VERT/ECBBS to
Android8675 on Wed Jul 15 22:43:14 2020
Re: JS Commission?ã By: Android8675 to echicken on Wed Jul 15 2020 09:40:17ãã An> Next question how do I take a const from 1-4 and pass 4 different results basedã An> on the number?ãã An> Basicallyã >> const colors = console.getnum(4, 1);ã An> then pass different strings based on the answer like..ãã >> '-f ' + (colors ? 'green' : 'white' : 'white' : 'yellow') +ã >> '-b ' + (colors ? 'black' : 'black' : 'blue' : 'black') +ããI would probably do this:ããconst fg = ['green', 'white', 'white', 'yellow'];ãconst bg = ['black', 'black', 'blue', 'black'];ãconst colors = console.getnum(4, 1) - 1;ããbbs.exec(ã 'frotz 'ã ...ã + '-f ' + fg[colors]ã + '-b ' + bg[colors]ã ...ã);ããWhere 'fg' and 'bg' are arrays of strings. If the user hits '4', fg[3] and bg[3] would be used, so the user would get yellow-on-black, and so on. (If I'm understanding your goal properly.)ãã An> Final final... why doesn't the background on this line switch to blue? Ctrl-Aã An> "4" should be blue background.ãã >> console.putmsg(" 3.\1h\14 White on Blue\1n");ããNot sure. Try \x014 instead of \14 and see if it helps.ãã---ãechickenãelectronic chicken bbs - bbs.electronicchicken.comã þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.comã
-
From
Android8675@VERT/SHODAN to
echicken on Mon Jul 20 13:21:55 2020
Re: JS Commission?ã By: echicken to Android8675 on Wed Jul 15 2020 10:43 pmãã > Re: JS Commission?ã > By: Android8675 to echicken on Wed Jul 15 2020 09:40:17ã >ã > I would probably do this:ã >ã > const fg = ['green', 'white', 'white', 'yellow'];ã > const bg = ['black', 'black', 'blue', 'black'];ã > const colors = console.getnum(4, 1) - 1;ã >ã > bbs.exec(ã > 'frotz 'ã > ...ã > + '-f ' + fg[colors]ã > + '-b ' + bg[colors]ã > ...ã > );ã >ã > Where 'fg' and 'bg' are arrays of strings. If the user hits '4', fg[3] andã > bg[3] would be used, so the user would get yellow-on-black, and so on. (Ifã > I'm understanding your goal properly.)ããYeah, that looks right, and verified that the results I need are getting passed to bbs.exec, but I think frotz doesn't like something. It's throwing up TERMCAP errors. I had to catch the output in a janky way, but it threw up:ããERROR: Unknown terminal: ansi-bbsã Check the TERM environment variable.ã Also make sãure that the terminal is defined in the terminfo database.ã Alternatively, set theã TERMCAP environment variable to the desiredã termcap entryã--clip--ããTried with both frotz and dfrotz, same error.ãã > >> console.putmsg(" 3.\1h\14 White on Blue\1n");ã >ã > Not sure. Try \x014 instead of \14 and see if it helps.ããThat did it. Thanks.ã-A.ãã--ãAndroid8675@ShodansCoreãã---ã þ Synchronet þ Shodan's Core @ ShodansCore.comã
-
From
echicken@VERT/ECBBS to
Android8675 on Mon Jul 20 22:27:21 2020
Re: JS Commission?ã By: Android8675 to echicken on Mon Jul 20 2020 13:21:55ãã An> ERROR: Unknown terminal: ansi-bbsã An> Check the TERM environment variable.ã An> Also make sã An> ure that the terminal is defined in the terminfo database.ã An> Alternatively, set theã An> TERMCAP environment variable to the desiredã An> termcap entryããTry following the "Terminal Capabilities" section here:ãã
http://wiki.synchro.net/install:nix#terminal_capabilitiesããThere are probably other hacky ways around this, but with any luck that'll get the job done.ãã---ãechickenãelectronic chicken bbs - bbs.electronicchicken.comã þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.comã