I’m a little experienced with code but this is stumping me.
So what I want to have happen is the user types in !wildsurge. Then a random thing based on the result of code located on PasteBin. Right now there’s only three things that can happen: roll 2 results, a message saying the user can see invisible things, and a modron with a random name appears. Ideally, I’ll be adding more possible results later. I also want to pull in three random users in chat for when results are supposed to affect others (ope, you’re caught in the fireball). Right now none of the results use the other three random users.
So right now my Nightbot message looks like this:
$(eval u=`$(user)`; r=`$(urlfetch https://decapi.me/twitch/random_user/timbluemage)`; s=`$(urlfetch https://decapi.me/twitch/random_user/timbluemage)`; t=`$(urlfetch https://decapi.me/twitch/random_user/timbluemage)`; $(urlfetch https://pastebin.com/raw/8c55vMK5))
And my pastebin code looks like this:
let caster = u;
let target1 = r;
let target2 = s;
let target3 = t;
const modronFirstNames = ['Alpha-', 'Beta-', 'Gamma-', 'Delta-', 'Epislon-', 'Zeta-', 'Eta-', 'Theta-', 'Iota-', 'Kappa-', 'Ia-', 'Mu-', 'Nu-', 'Xi-', 'Omicron-', 'Pi-', 'Rho-', 'Sigma-', 'Tau-', 'Upsilon-', 'Phi-', 'Chi-', 'Psi-', 'Omega-'];
let modronName = modronFirstNames[Math.floor(Math.random() * responses.length)] + Math.floor((Math.random() * 100) + 1));
const wildSurges = ['Double trouble!', 'For the next minute ' + caster + ' can see invisible things!', 'A modron has been summoned for 1 minute! Their name is ' + modronName];
let wildSurgeRolled = Math.floor(Math.random() * wildSurges.length);
let surgeResult;
if(wildSurgeRolled == 0)
{
let doubleTrouble1 = 0;
let doubleTrouble2 = 0;
while((doubleTrouble1 == doubleTrouble2)||(doubleTrouble1==0)||(doubleTrouble2==0)
{
doubleTrouble1 = Math.floor(Math.random() * wildSurges.length)
doubleTrouble2 = Math.floor(Math.random() * wildSurges.length)
}
surgeResult = caster + " unleashed a wild surge! Double trouble!" + wildSurges[doubleTrouble1] + ' ' + wildSurges[doubleTrouble2];
}
else
{
surgeResult = caster + " unleashed a wild surge!" + wildSurges[wildSurgeRolled];
}
surgeResult;
I appreciate any help that is given.