This is a game where a certain channel user is selected to identify who said a certain phrase that was sent to your bot. Many features to keep this script as fail-safe as possible. Keep in mind that no nick changes should occur among entrants of the game, and always be sure to play the game in the right order, even though I put blocks in for that. My first complex script I did without any help.
;who said it scripting
on 1000:text:*whosaiditgame*:#:{
if ($1 == %c $+ whosaiditgame) {
if ($2 == on) { .enable #wsigchan | .write txt\wsigentrants.txt troubleshoot | .write txt\wsigtips.txt troubleshoot | set %wsig.step 1 | unset %master | set %master $nick | unset %wsig.join.* | unset %wsig.tip.* | unset %wsig.hotseat | set %wsig.tips 0 | unset %wsig.accnick | /write -c txt\wsigentrants.txt | /write -c txt\wsigtips.txt | .msg $chan $chan $+ : $nick has initiated the "Who Said it?" Game Mode. To join, type %c $+ join. Master: type %c $+ whosaiditgame start to begin the "Who Said it?" Game. }
if ($2 == off) { .disable #wsigchan | .msg $chan $chan $+ : $nick has uninitiated the "Who Said it?" Game Mode. }
if ($2 == start) {
if (%wsig.step == 1) {
set %wsig.step 2
set %wsig.hotseat $read txt\wsigentrants.txt
.msg $chan $chan $+ : The "Who Said it?" Game is now beginning. %wsig.hotseat is in the hotseat. All members besides %wsig.hotseat must type the following: /query $me %qc $+ wsigtip <message to/about %wsig.hotseat without using your name>.
}
else { .notice $nick 10We aren't on that step right now. }
}
if ($2 == advance) {
if (%wsig.step == 2) {
.msg $chan $chan $+ : $nick has authorized me to advance the game to the next step. %wsig.hotseat $+ , you must now guess who said the following phrase: $read txt\wsigtips.txt
.msg $chan %wsig.hotseat $+ : To submit your guess, type %c $+ wsigguess <nick of person that said above phrase>.
set %wsig.step 3
}
else { .notice $nick 10You aren't on the correct step on the game to use this command. }
}
else { .notice $nick 10Incorrect: Use %c $+ whosaiditgame <on/off/start/advance> | halt }
}
else { halt }
}
#wsigchan off
on *:text:*join*:#: {
if ($1 == %c $+ join) {
if ($nick != %master) {
if (%wsig.step == 1) {
if (%wsig.join. [ $+ [ $nick ] ] != 1) {
.notice $nick 10You have successfully joined this round of the "Who Said it?" Game. Make sure you do not change your nick during the game, as it could cause major error.
set %wsig.join. [ $+ [ $nick ] ] 1
.write txt\wsigentrants.txt $nick
}
else { .notice $nick 10You have already joined this round of the "Who Said it?" Game. }
}
else { .notice $nick 10Entrants aren't currently being accepted. }
}
else { .notice $nick 10You are the master of this game, so you may not join. }
}
}
on *:text:*wsigtip*:*: {
if ($1 == %qc $+ wsigtip) {
if (%wsig.step == 2) {
if (%wsig.join. [ $+ [ $nick ] ] == 1) {
if (%wsig.tip. [ $+ [ $nick ] ] != 1) {
if ($nick != %wsig.hotseat) {
.write txt\wsigtips.txt $2-
set %wsig.tip. [ $+ [ $nick ] ] 1
inc %wsig.tips 1
.msg $nick 10Your tip has been submitted, $nick $+ . Good luck!
closemsg $nick
.notice %master 10So far, %wsig.tips tips have been submitted. Type %c $+ whosaiditgame advance when you are ready to continue.
}
else { .msg $nick 10You're in the hotseat, $nick $+ . You may not submit a tip. | closemsg $nick }
}
else { .msg $nick 10You already submitted a tip during this round. | closemsg $nick }
}
else { .msg $nick 10You did not enter this round, so you may not submit a tip. | closemsg $nick }
}
else { .msg $nick 10It isn't time to send tips right now. | closemsg $nick }
}
}
on *:text:*wsigguess*:#: {
if ($1 == %c $+ wsigguess) {
if (%wsig.step == 3) {
if ($nick == %wsig.hotseat) {
set %wsig.accnick $2
set %wsig.step 4
.msg $chan %wsig.accnick $+ , is this correct? To verify that it is correct, type %c $+ wsigyes. To deny this accusation, type %c $+ wsigno.
}
else { .notice $nick 10You are not in the hotseat. It is not your turn to guess. }
}
else { .notice $nick 10It isn't time to guess yet. }
}
}
on *:text:*wsigyes*:#: {
if ($1 == %c $+ wsigyes) {
if (%wsig.step == 4) {
if ($nick == %wsig.accnick) {
.msg $chan %wsig.hotseat has completed the "Who Said it?" Game! This mode will now shut down.
.disable #wsigchan
}
}
else { .notice $nick 10It isn't time for that now. }
}
}
on *:text:*wsigno*:#: {
if ($1 == %c $+ wsigno) {
if (%wsig.step == 4) {
if ($nick == %wsig.accnick) {
.msg $chan %wsig.hotseat has lost the "Who Said it?" Game! Better luck next time! This mode will now shut down.
.disable #wsigchan
}
}
else { .notice $nick 10It isn't time for that now. }
}
}
#wsigchan end
yeah i have seen people use that before
on *:text:*whosaiditgame*:#:{
if ($1 == %c $+ whosaiditgame) {
i think it's an old way of coding.
even tho in the on text it's set up as a wild card match using the the " if $1 == %c $+ whosaiditgame " will make it only trigger if it's the first thing said like using
on *:text:whosaiditgame *:#:{
to me that extra if line is a waste of space tbh