Subj : JS Commission?
To   : Android8675
From : echicken
Date : Wed Jul 15 2020 10:43 pm

 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