I've got a paper, rock, scissors script that trigger randomly as the stream is playing. Here's the script for reference:
alias -l PRS {
set %PRS_user $read(PRS.txt, n)
msg %PRS_newbie /me Dinobot challenges %PRS_user to Paper Rock Scissors, do you accept?
set %PRS_control 1
}
alias -l PRScissors {
msg %PRS_newbie I chose PRS_b
}
on !*:JOIN:#:{
var %ran $rand(20,60)
.timerPRS 1 %ran PRS
write PRS.txt $nick
set %PRS_newbie #
}
on *:TEXT:*:#: {
if ($nick == %PRS_user) {
if (%PRS_control == 1) {
if ($1 == yes) {
msg %PRS_newbie /me On the count of three.
set %PRS 2
.timerOne 1 2 msg %PRS_newbie /me 1
.timerTwo 1 4 msg %PRS_newbie /me 2
.timerThree 1 6 msg %PRS_newbie /me 3
.timerfour 1 8 msg %PRS_newbie /me Choose paper/rock/scissors
}
elseif ($1 == no) {
msg %PRS_newbie /me You don't want to play with me BibleThump $+ ?
}
}
if (%PRS == 2) {
set %PRS_u $1
var %choices = paper,rock,scissors
set %PRS_b $gettok(%choices, $rand(1,3), 44)
PRScissors
}
}
}
So the code will start the instant someone joins but can last until the end of the stream -- right now I only having it run for 60 seconds for testing purposes.
My question really comes down to deciding whether the player won or lost.
The variable PRS_u will be what the player input I.E. paper, rock, scissors. The variable PRS_b will be what my robot chose depending on $gettok(%choices, $rand(1,3), 44).
Is this the only way I can do it?
if ((%PRS_u == paper) && (%PRS_b == paper)) {
msg # You both tied, no winners
}
if ((%PRS_u == paper) && (PRS_b == rock)) {
msg # You win!
}
etc...
Or is there a shorter version to that?