NightDev Community Forums

Help with selecting multiple responses

Hey guys I’ve looked around but couldn’t find anything, I was hoping to create a command that picks from 2 separate pools for separate parts. For example a Halloween command that says ‘user has been attacked by monster and chased into the woods’ but having the ‘has been attacked by monster’ part and the ‘chased into the woods’ part being pulled from separate options to create something that makes sense.

The simplest would probably be you take an example of one of those commands and use it twice in your case.
Here’s a pretty general example of one Riddle commands in the Chat - #7 by am_1
While you could technically do this command with one $(eval) it’s not realistically needed in this example so you just have:

$(eval with PastebinLink1) $(eval with PastebinLink2)

And if that’s not clear you’ll want to make two different pastebins for the different responses if you haven’t already.

Awesome thanks! that should work, I’ll come back for any questions if it doesn’t.

Not sure if this is the right place to ask but would I just put the link from the URL bar in or would I need to have a different link?

I’ve tried adding just the link but get the response unexpected end of input.

Also using the code from the example in that link I get an error saying invalid or unexpected token.

Well the first error is most likely because you didn’t use the raw link if I had to guess the second error would you of happened to of copy and pasted it into the mobile twitch app?

I did post it in the twitch app yeah, would it work if I used twitch in the browser or used the dashboard?

Yes both those options should work i very highly recommend the dashboard though.

The dashboard ended up working, thanks! I am curious tho, for the second option would it be possible to have the second option show up as a users name if input to the command. So if you just have the !command it pulls from the list of options from the pastebin and if you type !command user it’ll show that users name instead of the pool of options from the pastebin?

Yeah have the second half look like this

$(eval a=`$(urlfetch json PastebinLink)`.split(`|`);`$(1)`?`$(1)`:a[Math.floor(Math.random()*a.length)])

Thanks! I tried this code however whenever I don’t put in a user afterwards it only shows ‘null’ and doesn’t pull from the pastebin, I tried adding it through the dashboard but had the same issue.

$(eval a=`$(urlfetch json PastebinLink)`.split(`|`);`$(1)`!=`null`?`$(1)`:a[Math.floor(Math.random()*a.length)])

Sorry bout that make it look like this.

Thanks so much! I tried it and it works perfectly!