"Who Said it?" Game

By Kerli on Apr 07, 2010

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

Comments

Sign in to comment.
Kerli   -  Apr 20, 2010

Could work. I'll see if I can work on it soon. ;D

 Respond  
Saigyouji   -  Apr 20, 2010

How about like this?

set -l %temp $read(wsigtips.txt)
msg $chan $gettok(%temp,1,5)
write <txt file here> $gettok(%temp,2,5)
 Respond  
Kerli   -  Apr 20, 2010

Well that's what I thought, but then you have to match the lines between the two documents, which I don't know how to do yet.

 Respond  
Saigyouji   -  Apr 19, 2010

Just make a new txt file and add it in. Just put in:

.write <txt file here> $nick

as people input in their little quotes.

 Respond  
Kerli   -  Apr 19, 2010

Yeah... I really wanted to make it right, but I couldn't figure out a way to fix that part without directly writing the names in the txt.

Once I learn how to match lines between documents and things, I may revise this.

 Respond  
Saigyouji   -  Apr 19, 2010

It's kinda nice, but people can cheat by saying no when it's yes and vice versa. It'll be nice if everyone tells the truth but we all know that's not going to happen.

 Respond  
Kerli   -  Apr 08, 2010

Ah. I'll keep it in mind for future snippets.

 Respond  
napa182   -  Apr 08, 2010

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

 Respond  
Kerli   -  Apr 08, 2010

It's a command identifier, since this is for a bot... Specifically, YourBot.

 Respond  
Jethro   -  Apr 08, 2010

I don't get this here:> on :text:whosaiditgame*:#:{
if ($1 == %c $+ whosaiditgame) {Why do you use %c <- mirc sees it as a variable. I don't see that as being necessary.

Why not just:

on *:text:*:#:{
  if ($1 == whosaiditgame) {
 Respond  
Kerli   -  Apr 08, 2010

What do you mean nothing is setting them?

I never received an error. It seems you have the right setup...

Oh... Ah. I see. I think you have to create 'wsigentrants.txt' and 'wsigtips.txt' before you start. I'll see if I can change it so you don't.

EDIT:

Fixed.

 Respond  
GuitarMasterx7   -  Apr 08, 2010

hm it seems u have all these
vars
but nuffin is setting them

also an error

  • /write: unable to open file 'C:\Users\Kevin\AppData\Roaming\mIRC\txt\wsigentrants.txt' (line 3, wsig)
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.