Randomization through switch/case multiple inputs setup issues

I am trying to work out this command as I have been working on a sorta quirk command and I have gotten quite stuck as I can get them command to work without trying to randomize the default but when I do add the additional randomizer it does come up with “unexpected Identifier” and I have gotten it to also post the exceeds 500 characters from the same command which could possibly have to do with the quirk list, which at this point I feel it is the trying to recall other randomized stuff with variable that are in a pastebin inside a pastebin

so I am wondering is there a way of adding randomization to each of the cases so that say for example if the user goes !quirk @hoodlumkira would be able to select say 1 out of 5 different responses depending on which user they do target or even if it goes to default after checking the cases

so far this is the code I have gotten to work to this point which is
$(eval u='$(user)'.toLowerCase(); t='$(touser)'.toLowerCase(); r='$(urlfetch json https://u.nu/AFdoF)'.split(';'); q=r[Math.floor(Math.random()*r.length)]; $(urlfetch json https://u.nu/VZFpR))

and this is the pastebin I was trying to use for the ${d} variable which I never got to work with the above command
(https://pastebin.com/nNPMKmj5)

I do thank you for any help in advanced

right now any code you write has to run within the character limits of the command response. I would recommend combining things into a single file rather than spreading them:

const quirks = ['Earth Flow','Decay','Creation','Arbor','Air Cannon','Anthropomorph','Frog','Fierce wings','Foresight','Gas','Gatling','Gecko','Gigantification','Blackwhip','Big Fist','Black Hole','Glamour','Blood Control','Bloodcurdle','Blueflame','Brainwashing','High Spec','Hellflame','Hardening','Half-Cold Half-Hot','Hair Control','Impact Recoil','Cemedine','Cement','Chronostasis','Clones','Compress','Copy','Horn Cannon','Hydra','Incite','Jet','Love','Landmine','Longbow','Dark Shadow','Dragon','Dupli-arms','Meatball','Manifest','Magnetism','Mushroom','Earphone Jack','Earth Flow','Elasticity','Electrification','Engine','Erasure','Eruption','Explosion','Extend-o-Hair','Navel Laser','Overhaul','Outburst','Permeation','Telepath','Tail','Telescopic','Transform','Twin Impact','Pliabody','Poltergeist','Pop Off','Pump Up','Vibrate','Vines','Voice','Rewind','Warp Gate','Water Control','Wave Motion','Weld','Whirlwind','Zero Gravity','Zoom','Sandstorm','Size','Sloshed','Softening','Solid Air','Somnambulist','Spotted Seal','Steel','Stiffening','Stress','Sugar Rush'];

const randomQuirk = quirks[Math.floor(Math.random() * quirks.length)];

switch (TOUSER.toLowerCase()) {
  case 'hoodlumkira':
    `${USER} attempts to beat ${TOUSER} using their ${randomQuirk} quirk, but ${TOUSER} used all for one to steal their quirk rendering them defenseless`;
    break;
  case 'saltibunni':
    `${USER} tries sneaking up on ${TOUSER} to use their ${randomQuirk} quirk, but ${TOUSER} heard them and uses her blueflame quirk to trap ${USER}`;
    break;
  case 'mellbell83':
    `${USER} tries to sneak up on ${TOUSER} to use their ${randomQuirk} but, hoodlumkira interferes using all for one and steals ${USER}s quirk protecting ${TOUSER} and rendering ${USER} helpless`;
    break;
  case 'shannonsully13':
    `${USER} tries to run up and use their ${randomQuirk} to assasinate ${TOUSER} but, ${TOUSER} uses her erasure quirk to erase ${USER}s quirk and restrains them`;
    break;
  case 'royalchachi':
    `${USER} love quirk`; 
    break;
  default: {
    const randomAction = Math.floor(Math.random() * 4);
    switch (randomAction) {
      case 0:
        `${USER} attempts to sneak up on ${TOUSER} to use their ${randomQuirk} quirk, but they step on a twig alerting them and they are restrained using ${TOUSER}s creation quirk`;
        break;
      case 1:
        `${USER} sneaks up on and uses their ${randomQuirk} quirk on ${TOUSER}, they never stood a change against the villian ${USER}`;
        break;
      case 2:
        `${USER} holds up a convenience store using their ${randomQuirk} quirk, but ${TOUSER} intervenes and arrests you using their ice quirk`;
        break;
      case 3:
      default:
        `${USER} holds up a convenience store using their ${randomQuirk} quirk, ${TOUSER} attempts to stop you, but they are over powered by the villain ${USER} who renders them unconscious`;
        break;
    }
  }
}
$(eval const USER = `$(user)`; const TOUSER = `$(touser)`; $(urlfetch json https://pastebin.com/raw/SOMEPASTEID)
1 Like

Alright I have used that code and it worked beautifully and I thank you alot for all that help, but now after making some changes now the code is jumping down to case ‘mellbell83’ and launching that line of code for reason if you use ‘hoodlumkira’ or ‘saltibunni’ as the TOUSER, though when using it on anyone else it does work as intended, as it was working after I did the changes to the case ‘hoodlumkira’ but when I did the changes to the ‘saltibunni’ case it started doing this even if I do remove the whole saltibunni case which has me confused now

these are the current changes that I have made since as I was trying out some things to see if I could get it to work

const quirks = ['Earth Flow','Decay','Creation','Arbor','Air Cannon','Anthropomorph','Frog','Fierce wings','Foresight','Gas','Gatling','Gecko','Gigantification','Blackwhip','Big Fist','Black Hole','Glamour','Blood Control','Bloodcurdle','Blueflame','Brainwashing','High Spec','Hellflame','Hardening','Half-Cold Half-Hot','Hair Control','Impact Recoil','Cemedine','Cement','Chronostasis','Clones','Compress','Copy','Horn Cannon','Hydra','Incite','Jet','Love','Landmine','Longbow','Dark Shadow','Dragon','Dupli-arms','Meatball','Manifest','Magnetism','Mushroom','Earphone Jack','Earth Flow','Elasticity','Electrification','Engine','Erasure','Eruption','Explosion','Extend-o-Hair','Navel Laser','Overhaul','Outburst','Permeation','Telepath','Tail','Telescopic','Transform','Twin Impact','Pliabody','Poltergeist','Pop Off','Pump Up','Vibrate','Vines','Voice','Rewind','Warp Gate','Water Control','Wave Motion','Weld','Whirlwind','Zero Gravity','Zoom','Sandstorm','Size','Sloshed','Softening','Solid Air','Somnambulist','Spotted Seal','Steel','Stiffening','Stress','Sugar Rush'];
 
const randomQuirk = quirks[Math.floor(Math.random() * quirks.length)];
 
switch (TOUSER.toLowerCase()) {
  case 'hoodlumkira': {
    const randomAction = Math.floor(Math.random() * 5);
    switch (randomAction) {
       case 0:       
         `${USER} attempts to beat ${TOUSER} using their ${randomQuirk} quirk, but ${TOUSER} used All for One to steal their quirk rendering them defenceless`;
     break;
       case 1:
         `${USER} manages to bring ${TOUSER} to his knees using their ${randomQuirk} quirk, but before ${TOUSER} passes out he uses All for One to steal their quirk`;
     break;
       case 2:
         `${USER} tries to beat ${TOUSER}, but before they can even use their ${randomQuirk} quirk, ${TOUSER} uses Spring like limbs and Kinetic booster x4 quirks through All for One and knocks out ${USER}`;
      break;
       case 3:
         `${USER} tries to battle ${TOUSER}, but ${TOUSER} is so disinterested in fighting ${USER} and their ${randomQuirk} quirk that he just sends multiple Nomu after them to beat them`;
      break;
       case 4:
       default:
         `${USER} manages to restrain ${TOUSER} by using their ${randomQuirk} quirk, ${TOUSER} tries to escape but it is all in vain before he gets knocked out and sent off to Tartarus`;
      break;
        }
       }
 
  case 'saltibunni': {
    const randomAction = Math.floor(Math.random() * 5);
    switch (randomAction) {
      case 0:
    `${USER} tries sneaking up on ${TOUSER} to use their ${randomQuirk} quirk, but ${TOUSER} heard them and uses her Blueflame quirk to trap ${USER}`;
     break;
      case 1:
    `${USER} tries to use their ${randomQuirk} quirk on ${TOUSER} to over power her, but it fails and ${USER} is overpowered by ${TOUSER}s Blueflame quirk and left severely burnt`;
     break;
      case 2:
    `${USER} manages to get the drop on ${TOUSER} thus surprising her enough to restraining her using their ${randomQuirk} quirk, though ${TOUSER} emits alot of heat using her Blueflame quirk making it difficult to turn her in`;
     break;
      case 3:
    `${USER} attempts to fight ${TOUSER} using their ${randomQuirk} quirk but, they end up losing and getting many innocent bystanders caught in the crossfire from ${TOUSER}s Blueflame quirk`;
    break;
     case 4:
     default:
    `${USER} manages to knock out ${TOUSER} using their ${randomQuirk} quirk before ${TOUSER} can even activate her Blueflame quirk but before they can arrest her a Warp Gate spews from her takes ${TOUSER} away to safety`;
    break;
     }
    }
 
  case 'mellbell83': 
    `${USER} tries to sneak up on ${TOUSER} to use their ${randomQuirk} but, hoodlumkira interferes using All for One and steals ${USER}s quirk protecting ${TOUSER} and rendering ${USER} helpless`;
    break;       
 
  case 'shannonsully13': 
    `${USER} tries to run up and use their ${randomQuirk} to assasinate ${TOUSER} but, ${TOUSER} uses her Erasure quirk to erase ${USER}s quirk and restrains them`;
    break;      
 
  case 'royalchachi': 
    `${USER} love quirk`; 
    break;     
 
  default: {
    const randomAction = Math.floor(Math.random() * 4);
    switch (randomAction) {
      case 0:
        `${USER} attempts to sneak up on ${TOUSER} to use their ${randomQuirk} quirk, but they step on a twig alerting them and they are restrained using ${TOUSER}s creation quirk`;
        break;
      case 1:
        `${USER} sneaks up on and uses their ${randomQuirk} quirk on ${TOUSER}, they never stood a change against the villian ${USER}`;
        break;
      case 2:
        `${USER} holds up a convenience store using their ${randomQuirk} quirk, but ${TOUSER} intervenes and arrests you using their Ice quirk`;
        break;
      case 3:
      default:
        `${USER} holds up a convenience store using their ${randomQuirk} quirk, ${TOUSER} attempts to stop you, but they are over powered by the villain ${USER} who renders them unconscious`;
        break;
    }
  }
}

Hey @hoodlumkira!

You forgot to add break; on critical lines, so it jumps to the next case automatically, read the documentation on switch().
Also, you added accolades at random spots, and your indentation made it harder to fix your code, I strongly suggest using a code editor to assist you in the future.

const quirks = ['Earth Flow','Decay','Creation','Arbor','Air Cannon','Anthropomorph','Frog','Fierce wings','Foresight','Gas','Gatling','Gecko','Gigantification','Blackwhip','Big Fist','Black Hole','Glamour','Blood Control','Bloodcurdle','Blueflame','Brainwashing','High Spec','Hellflame','Hardening','Half-Cold Half-Hot','Hair Control','Impact Recoil','Cemedine','Cement','Chronostasis','Clones','Compress','Copy','Horn Cannon','Hydra','Incite','Jet','Love','Landmine','Longbow','Dark Shadow','Dragon','Dupli-arms','Meatball','Manifest','Magnetism','Mushroom','Earphone Jack','Earth Flow','Elasticity','Electrification','Engine','Erasure','Eruption','Explosion','Extend-o-Hair','Navel Laser','Overhaul','Outburst','Permeation','Telepath','Tail','Telescopic','Transform','Twin Impact','Pliabody','Poltergeist','Pop Off','Pump Up','Vibrate','Vines','Voice','Rewind','Warp Gate','Water Control','Wave Motion','Weld','Whirlwind','Zero Gravity','Zoom','Sandstorm','Size','Sloshed','Softening','Solid Air','Somnambulist','Spotted Seal','Steel','Stiffening','Stress','Sugar Rush'];
 
const randomQuirk = quirks[Math.floor(Math.random() * quirks.length)];
 
switch (TOUSER.toLowerCase()) {
  case 'hoodlumkira': {
    let randomAction = Math.floor(Math.random() * 5);
    switch (randomAction) {
      case 0:       
        `${USER} attempts to beat ${TOUSER} using their ${randomQuirk} quirk, but ${TOUSER} used All for One to steal their quirk rendering them defenceless`;
        break;
      case 1:
        `${USER} manages to bring ${TOUSER} to his knees using their ${randomQuirk} quirk, but before ${TOUSER} passes out he uses All for One to steal their quirk`;
        break;
      case 2:
        `${USER} tries to beat ${TOUSER}, but before they can even use their ${randomQuirk} quirk, ${TOUSER} uses Spring like limbs and Kinetic booster x4 quirks through All for One and knocks out ${USER}`;
        break;
      case 3:
        `${USER} tries to battle ${TOUSER}, but ${TOUSER} is so disinterested in fighting ${USER} and their ${randomQuirk} quirk that he just sends multiple Nomu after them to beat them`;
        break;
      case 4:
      default:
        `${USER} manages to restrain ${TOUSER} by using their ${randomQuirk} quirk, ${TOUSER} tries to escape but it is all in vain before he gets knocked out and sent off to Tartarus`;
        break;
    }
    break;
 
  case 'saltibunni': {
    let randomAction = Math.floor(Math.random() * 5);
    switch (randomAction) {
      case 0:
        `${USER} tries sneaking up on ${TOUSER} to use their ${randomQuirk} quirk, but ${TOUSER} heard them and uses her Blueflame quirk to trap ${USER}`;
        break;
      case 1:
        `${USER} tries to use their ${randomQuirk} quirk on ${TOUSER} to over power her, but it fails and ${USER} is overpowered by ${TOUSER}s Blueflame quirk and left severely burnt`;
        break;
      case 2:
        `${USER} manages to get the drop on ${TOUSER} thus surprising her enough to restraining her using their ${randomQuirk} quirk, though ${TOUSER} emits alot of heat using her Blueflame quirk making it difficult to turn her in`;
        break;
      case 3:
        `${USER} attempts to fight ${TOUSER} using their ${randomQuirk} quirk but, they end up losing and getting many innocent bystanders caught in the crossfire from ${TOUSER}s Blueflame quirk`;
        break;
      case 4:
      default:
        `${USER} manages to knock out ${TOUSER} using their ${randomQuirk} quirk before ${TOUSER} can even activate her Blueflame quirk but before they can arrest her a Warp Gate spews from her takes ${TOUSER} away to safety`;
        break;
    }
    break;
 
  case 'mellbell83': 
    `${USER} tries to sneak up on ${TOUSER} to use their ${randomQuirk} but, hoodlumkira interferes using All for One and steals ${USER}s quirk protecting ${TOUSER} and rendering ${USER} helpless`;
    break;       
 
  case 'shannonsully13': 
    `${USER} tries to run up and use their ${randomQuirk} to assasinate ${TOUSER} but, ${TOUSER} uses her Erasure quirk to erase ${USER}s quirk and restrains them`;
    break;      
 
  case 'royalchachi': 
    `${USER} love quirk`; 
    break;     
 
  default: {
    let randomAction = Math.floor(Math.random() * 4);
    switch (randomAction) {
      case 0:
        `${USER} attempts to sneak up on ${TOUSER} to use their ${randomQuirk} quirk, but they step on a twig alerting them and they are restrained using ${TOUSER}s creation quirk`;
        break;
      case 1:
        `${USER} sneaks up on and uses their ${randomQuirk} quirk on ${TOUSER}, they never stood a change against the villian ${USER}`;
        break;
      case 2:
        `${USER} holds up a convenience store using their ${randomQuirk} quirk, but ${TOUSER} intervenes and arrests you using their Ice quirk`;
        break;
      case 3:
      default:
        `${USER} holds up a convenience store using their ${randomQuirk} quirk, ${TOUSER} attempts to stop you, but they are over powered by the villain ${USER} who renders them unconscious`;
        break;
    }
    break;
}
1 Like

Thank you alot for the help and suggestions Emily,

For the accolades I assumed that if I used 2 { accolades to start said argument/switch/case I assumed that I would have to use 2 } accolades to I guess close thoses too

Also there a code editor that you could recommend as I have only messed around abit with pycharm for discord using python for fun and I have just been up till now writing the code for my nightbot commands in pastebin and I am not sure what library I would have to install through command prompt

1 Like

Yes, you do, but with clear indentation you would have noticed that you didn’t need two because there actually was only one opened, haha!

I personally use VS Code, but I know many use Notepad++ too, or if you want something online, there’s Codepen that is very popular.

1 Like

ahhhh I get what you mean now as I have just tried out VS code and it makes its alot easier to see which connects to which accolades through colour coding it, which I thank you heaps for suggesting it and for the help you have given me :grin:

1 Like

this reply isnt so much for help but rather I thought I would post an update on the code I was working as I did get quite a lot of help from Emily and Night when I was working on this and thought I would post an update on this on here just incase people need help with an idea or if they do get directed here to help solve some of their issues with their own code as I do feel it might help a few people as this is what I have gotten to work for me so far in my endeavours for this so far even though its probably not the neatest or perfect code :sweat_smile:

This is what I put into the pastebin, one of the changes I did make to this is made it so that randomQuirk could be set depending on who used it though I cannot explain why var works and let and const dont with that part of the code unfortunately as I was just experimenting to see if it was possible for it to work that way using Java’s variable declarations

const quirks = ['Earth Flow','Foldabody','Decay','Creation','Arbor','Air Cannon','Anthropomorph','Frog','Fierce wings','Foresight','Gas','Gatling','Gecko','Gigantification','Blackwhip','Boomerang','Big Fist','Black Hole','Glamour','Blood Control','Blade Tooth','Blazing Hair','Bloodcurdle','Blueflame','Brainwashing','High Spec','Hellflame','Hardening','Half-Cold Half-Hot','Hair Control','Impact Recoil','Cemedine','Cement','Chronostasis','Clones','Comic','Compress','Copy','Horn Cannon','Hydra','Incite','Jet','Love','Landmine','Longbow','Dark Shadow','Dragon','Dupli-arms','Double','Meatball','Manifest','Magnetism','Mushroom','Earphone Jack','Earth Flow','Elasticity','Electrification','Engine','Erasure','Eruption','Explosion','Extend-o-Hair','Navel Laser','Overhaul','Outburst','Permeation','Telepath','Tail','Telescopic','Transform','Twin Impact','Pliabody','Poltergeist','Pop Off','Pump Up','Vibrate','Vines','Voice','Rewind','Warp Gate','Water Control','Wave Motion','Weld','Whirlwind','Zero Gravity','Zoom','Sandstorm','Size','Sloshed','Softening','Solid Air','Somnambulist','Spotted Seal','Steel','Stiffening','Stress','Sugar Rush'];

let randomQuirk2 = quirks[Math.floor(Math.random() * quirks.length)];

switch (USER.toLowerCase()) {
  case 'hoodlumkira':{
    var randomQuirk = `All for One`;
    break;
  }
  case 'simbaonfire':{
    var randomQuirk = `Permeation`;
    break;
  }
  case 'saltibunni':{
    var randomQuirk = `Blueflame`;
    break;
  }
  default: {
    var randomQuirk = quirks[Math.floor(Math.random() * quirks.length)];
    break;
  }
}

switch (TOUSER.toLowerCase()) {
  case 'hoodlumkira': {
    let randomAction = Math.floor(Math.random() * 6);
    switch (randomAction) {
      case 0:       
        `${USER} attempts to beat ${TOUSER} using their ${randomQuirk} quirk, but ${TOUSER} used All for One to steal their quirk rendering them defenceless`;
        break;
      case 1:
        `${USER} manages to bring ${TOUSER} to his knees using their ${randomQuirk} quirk, but before ${TOUSER} passes out he uses All for One to steal their quirk`;
        break;
      case 2:
        `${USER} tries to beat ${TOUSER}, but before they can even use their ${randomQuirk} quirk, ${TOUSER} uses Spring like limbs and Kinetic booster x4 quirks through All for One and knocks out ${USER}`;
        break;
      case 3:
        `${USER} tries to battle ${TOUSER}, but ${TOUSER} is so disinterested in fighting ${USER} and their ${randomQuirk} quirk that he just sends multiple Nomu after them to beat them`;
        break;
      case 4:
        `${USER} manages to restrain ${TOUSER} by using their ${randomQuirk} quirk, ${TOUSER} tries to escape but it is all in vain before he gets knocked out and sent off to Tartarus`;
        break;
      case 5:
      default:
        `${USER} is patroling the local area when ${TOUSER} uses his quirk All for One completely obliterating ${USER} leaving no trace of them or their ${randomQuirk} quirk`;
    }
  }
    break;
 
  case 'saltibunni': {
    let randomAction = Math.floor(Math.random() * 5);
    switch (randomAction) {
      case 0:
        `${USER} tries sneaking up on ${TOUSER} to use their ${randomQuirk} quirk, but ${TOUSER} heard them and uses her Blueflame quirk to trap ${USER}`;
        break;
      case 1:
        `${USER} tries to use their ${randomQuirk} quirk on ${TOUSER} to over power her, but it fails and ${USER} is overpowered by ${TOUSER}s Blueflame quirk and left severely burnt`;
        break;
      case 2:
        `${USER} manages to get the drop on ${TOUSER} thus surprising her enough to restraining her using their ${randomQuirk} quirk, though ${TOUSER} emits alot of heat using her Blueflame quirk making it difficult to turn her in`;
        break;
      case 3:
        `${USER} attempts to fight ${TOUSER} using their ${randomQuirk} quirk but, they end up losing and getting many innocent bystanders caught in the crossfire from ${TOUSER}s Blueflame quirk`;
        break;
      case 4:
      default:
        `${USER} manages to knock out ${TOUSER} using their ${randomQuirk} quirk before ${TOUSER} can even activate her Blueflame quirk but before they can arrest her a Warp Gate spews from her takes ${TOUSER} away to safety`;
        break;
    }
  }
    break;
 
  case 'mellbell83': {
    let randomAction = Math.floor(Math.random() * 5);
    switch (randomAction) {
      case 0:
        `${USER} tries to sneak up on ${TOUSER} to use their ${randomQuirk} but, hoodlumkira interferes using All for One and steals ${USER}s quirk protecting ${TOUSER} and rendering ${USER} helpless`;
        break;
      case 1:
        `${USER} tries to use their ${randomQuirk} quirk on ${TOUSER} to get sneak up on her, but they failed after ${TOUSER} uses her Incite quirk to beat them`;
        break;
      case 2:
        `${USER} manages to over power and restrain ${TOUSER} by using their ${randomQuirk} quirk before ${TOUSER} could use her Incite quirk on people around her`;
        break;
      case 3:
       `${USER} is patroling the area when ${TOUSER} ambushes them with a crowd of people, knocking ${USER} out before they can use their ${randomQuirk} quirk, leaving ${TOUSER} to cause chao in town`;
       break;
      case 4:
      default:
        `${USER} manages to knock out ${TOUSER} using their ${randomQuirk} quirk after a long battle but before ${TOUSER} can be restrained a Warp Gate teleports her away from the scene to saftey`;
        break;
    }
  }
    break;
 
  case 'shannonsully13': {
    let randomAction = Math.floor(Math.random() * 5);
    switch (randomAction) {
      case 0:
        `${USER} tries to run up and use their ${randomQuirk} to assasinate ${TOUSER} but, ${TOUSER} uses her Erasure quirk to erase ${USER}s quirk and restrains them`;
        break;
      case 1:
        `${USER} is minding their own buisness when ${TOUSER} ambushes the villain ${USER}, and ${USER} tries to use their ${randomQuirk} quirk but ${TOUSER} erases their quirk and apprehends them`;
        break;
      case 2:
        `${USER} tries to overpower ${TOUSER}, but as they go to activate their ${randomQuirk} quirk they quickly realize that their quirk is being erased by ${TOUSER}s Erasure quirk, and ${USER} are arrested`;
        break;
      case 3:
        `${USER} sneaks up on ${TOUSER} as she is talking to a civillian and manages to wound her badly using their ${randomQuirk} quirk before she can erase ${USER}s quirk, ${TOUSER} passes out from her wounds`;
        break;
      case 4:
      default: 
        `${USER} starts to fight ${TOUSER}, during the fight ${USER} finds an opening between ${TOUSER}s blinks to beable to get around her Erasure quirk to activate their ${randomQuirk} quirk, ${TOUSER} gets knocked out`;
        break;
    }
  }
    break; 
 
  case 'tomasenzo1999': {
    let randomAction = Math.floor(Math.random() * 5);
    switch (randomAction) {
      case 0:
        `${USER} tries to overpower ${TOUSER} using their ${randomQuirk} quirk but, by them time they got close to ${TOUSER} they get affected by his Sloshed quirk, ${USER} falls to the ground unable to stop everything spinning`;
        break;
      case 1:
        `${USER} attempts to apprehend ${TOUSER} using their ${randomQuirk} quirk but, as the battle goes on eventually ${USER} makes a mistake due to ${TOUSER}s Sloshed quirk allowing ${TOUSER} to knock them out`;
        break;
      case 2:
        `${USER} sneaks up on ${TOUSER} and using their ${randomQuirk} quirk quickly apprehending ${TOUSER} before he could activate his Sloshed quirk and he was taken to the nearest police station`;
        break;
      case 3:
        `${USER} manages to overcome ${TOUSER}s Sloshed quirk and overpowers him using their ${randomQuirk} quirk, ${TOUSER} stood no chance against the hero ${USER}`;
        break;
      case 4:
      default:
        `${USER} starts to fight ${TOUSER}, while they are fighting ${TOUSER} keeps drinking and eventually ${USER} eventually succumbs to ${TOUSER}s Sloshed quirk falling to the ground even with their ${randomQuirk} quirk`;
        break;
    }
  }
    break;

  case 'royalchachi': {
    let randomAction = Math.floor(Math.random() * 5);
    switch (randomAction) {
      case 0: 
        `${USER} tries to attack ${TOUSER} using their ${randomQuirk} quirk but, they are over powered by ${TOUSER}s Glamour quirk and ${USER} is arrested and taken to the nearest police station`; 
        break;
      case 1:
        `${USER} attempts to sneak up on ${TOUSER} to use their ${randomQuirk} quirk on them but they make too much noise, alerting ${TOUSER} who uses their Glamour quirk to knock out the villain ${USER}`;
        break;
      case 2:
        `${USER} tries to overpower ${TOUSER} using their ${randomQuirk} quirk but as the fight continues on ${TOUSER} slowly overpowers ${USER} using their Glamour quirk and apprehends the villain ${USER}`;
        break;
      case 3:
        `${USER} sneaks up on ${TOUSER} so they can use their ${randomQuirk} quirk on them, ${TOUSER} doesnt see ${USER} coming and gets knocked out by the villain ${USER} before even being able to use their Glamour quirk`;
        break;
      case 4:
      default:
        `${USER} attempts to overpower ${TOUSER} using their ${randomQuirk} quirk, as the fight continues on ${TOUSER} slips up using their Glamour quirk which ${USER} quickly acts to capitalize on it to end the fight knocking them out`;
        break;
    }     
  }
    break;

  default: {
    let randomAction = Math.floor(Math.random() * 4);
    switch (randomAction) {
      case 0:
        `${USER} attempts to sneak up on ${TOUSER} to use their ${randomQuirk} quirk, but they step on a twig alerting them and they are restrained using ${TOUSER}s ${randomQuirk2} quirk`;
        break;
      case 1:
        `${USER} sneaks up on and uses their ${randomQuirk} quirk on ${TOUSER} before they could use their ${randomQuirk2} quirk, they never stood a change against the villian ${USER}`;
        break;
      case 2:
        `${USER} holds up a convenience store using their ${randomQuirk} quirk, but ${TOUSER} intervenes and arrests you using their ${randomQuirk2} quirk`;
        break;
      case 3:
      default:
        `${USER} holds up a convenience store using their ${randomQuirk} quirk, ${TOUSER} attempts to stop them with their ${randomQuirk2} quirk, but they are over powered by the villain ${USER} who renders them unconscious`;
        break;
    }
  }
    break;
}

and this is the code that was put into nightbot

$(eval const USER = `$(user)`; const TOUSER = `$(touser)`; $(urlfetch json https://pastebin.com/raw/Q0aj1j26))

If you’re interested to learn why, one word: hoisting.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.