Rock, Paper, Scissors Command

Is there a command api to make it like the !fight command that I saw someone else use but except it uses values like “won with paper”?


I haven’t seen a custom API for something like that, but it’s entirely possible to do in a Nightbot command with $(eval). If you give an example of what the command output should look like I could write up something.

I’ve used that post to come up with something quite similar.

$(user) fought $(urlfetch$(channel)) and $(eval a=[`won with a rock`,`won with a piece of paper`,`won with a pair of scissors`];a[Math.floor(Math.random()*a.length)]).

There’s an array in the $(eval) that looks like this.

[`won with a rock`,`won with a piece of paper`,`won with a pair of scissors`]

You can add more outcomes, just make sure they’re bounded by backticks and separated by commas as shown above.

Thanks so much! For anyone else who wants to use this here is his formula but except you can win, lose or draw. (It took away the ` somehow. Don’t forget them)

$(user) fought $(urlfetch$(channel)) and $(eval a=[lost with a rock,won with paper,drew with scissors,won with a rock,drew with paper,lost with scissors,drew with a rock,lost with paper,won with scissors];a[Math.floor(Math.random()*a.length)]).

Is there anyway to change it so that I could say !rockpaperscissors @test and it would say 000caml13 fought test and won with rock or something like that?

This will allow you to input a username, otherwise it’ll output a random username, and includes all win/draw/lose rock/paper/scissors outcomes.

$(user) fought $(eval a=[`won`,`drew`,`lost`];b=[`a rock`,`paper`,`scissors`];r=x=>x[Math.floor(Math.random()*x.length)];`${decodeURIComponent(`$(querystring)`).replace(/@/g,``)||`$(urlfetch$(channel))`} and ${r(a)} with ${r(b)}`).

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