MultiPlayer Tic Tac Toe for mIRC v0.1

By OrFeAsGr on Aug 20, 2015

SCRIPT ID: TICTACTOE
You'll need to get the two icons from here:
https://www.dropbox.com/s/fbrqlwr5q1pddjj/tictactoeO.ico?dl=0
https://www.dropbox.com/s/ed1qd9s02ea9k4z/tictactoeX.ico?dl=0
It is played through a dialog! And sends info with notice!

v0.1 14/06/2016
-Added Version and ID for Update checker script

;;;; Script by OrFeAsGr ;;;;
;;;; My website: http://humanity.ucoz.com ;;;;
;;;; Right Click On A User and click Tic Tac Toe ;;;;
;;;; To pick a sign type /toesign X or O ;;;;
;;;; To accept or decline a game invitation type /toeacc or /toedec ;;;;
dialog tictactoe {
  title "Tic Tac Toe"
  size -1 -1 100 100
  option dbu
  icon 1, 1 1 30 20
  icon 2, 40 1 30 33
  icon 3, 80 1 30 33
  icon 4, 1 40 30 33
  icon 5, 40 40 30 33
  icon 6, 80 40 30 33
  icon 7, 1 80 30 33
  icon 8, 40 80 30 33
  icon 9, 80 80 30 33
  box "", 11, 33 1 2 100
  box "", 12, 65 1 2 100 
  text "_____________" 13, 1 20 34 8
  text "______________" 14, 34 20 32 8
  text "________________" 15, 65 20 34 8
  text "_____________" 16, 1 60 34 8
  text "______________" 17, 34 60 32 8
  text "________________" 18, 65 60 34 8
}

on *:DIALOG:tictactoe:*:*: {
  if ($devent == sclick) {
    if (%tttoeison) {
      if (!%tttmestop) {
        if (!$istok(%playedmetttoe,$did,126)) && (!$istok(%playedothertttoe,$did,126)) {
          inc %tttoeleft 1
          if (%tttoeleft == 10) {
            .notice %tttoenick It's A Tie!
            endtttoe
          }
          elseif (%tttoeleft < 10) {
            did -g $dname $did $tttsign(%mysign)
            set %playedmetttoe $addtok(%playedmetttoe,$did,126)
            set $+(%,tttmine,~,$did) 1
            .notice %tttoenick Played Tic Tac Toe $did
            set %tttmestop 1
            if ($($+(%,tttmine,~,1),2)) && ($($+(%,tttmine,~,2),2)) && ($($+(%,tttmine,~,3),2)) {
              .notice %tttoenick I Win! YAY!!!!
              endtttoe
            }
            if ($($+(%,tttmine,~,4),2)) && ($($+(%,tttmine,~,5),2)) && ($($+(%,tttmine,~,6),2)) {
              .notice %tttoenick I Win! YAY!!!!
              endtttoe
            }
            if ($($+(%,tttmine,~,7),2)) && ($($+(%,tttmine,~,8),2)) && ($($+(%,tttmine,~,9),2)) {
              .notice %tttoenick I Win! YAY!!!!
              endtttoe
            }
            if ($($+(%,tttmine,~,1),2)) && ($($+(%,tttmine,~,4),2)) && ($($+(%,tttmine,~,7),2)) {
              .notice %tttoenick I Win! YAY!!!!
              endtttoe
            }
            if ($($+(%,tttmine,~,2),2)) && ($($+(%,tttmine,~,5),2)) && ($($+(%,tttmine,~,8),2)) {
              .notice %tttoenick I Win! YAY!!!!
              endtttoe
            }
            if ($($+(%,tttmine,~,3),2)) && ($($+(%,tttmine,~,6),2)) && ($($+(%,tttmine,~,9),2)) {
              .notice %tttoenick I Win! YAY!!!!
              endtttoe
            }
            if ($($+(%,tttmine,~,1),2)) && ($($+(%,tttmine,~,5),2)) && ($($+(%,tttmine,~,9),2)) {
              .notice %tttoenick I Win! YAY!!!!
              endtttoe
            }
            if ($($+(%,tttmine,~,3),2)) && ($($+(%,tttmine,~,5),2)) && ($($+(%,tttmine,~,7),2)) {
              .notice %tttoenick I Win! YAY!!!!
              endtttoe
            }
          }
        }
      }
    }
    elseif (!%tttoeison) {
      echo -at You Can't Play Yet. 
    }
  }
}

on *:notice:*:?: {
  if (!%tttoeison) {
  if (!%TICTACTOEversion) || (%TICTACTOEversion != v0.1) { set %TICTACTOEversion v0.1 }
    if (Wanna Play Tic Tac Toe??? == $strip($1-)) {
      set %tttoenick $nick
      echo -at $nick Wants To Play Tic Tac Toe With You! 
      echo -at To Accept Type /toeacc
      echo -at To Decline Type /toedec
      haltdef
    }
    if ($nick == %tttoenick) {
      if ($strip($1) == !accept) {
        set %tttoemestop 1
        echo -at $nick Accepted Your Request. To Choose "X" or "O" Type /toesign X or O
        echo -at $nick Plays 1st
        haltdef
      }
      elseif ($strip($1) == !decline) {
        dialog -x tictactoe
        echo -at $nick Declined Your Request. 
        unset %tttoenick
      }
      if ($strip($1-3) == I Chose Sign) {
        echo -at $nick Chose Sign $strip($4)
        haltdef
        set %mysign $iif($strip($4) == X, O, X)
        set %othersign $strip($4)
        set %tttoeison 1
        echo -at Your Sign Is Automatically Set To $iif($strip($4) == X, O, X)
        haltdef
      }
    }
  }
  elseif (%tttoeison) {
    if ($strip($1-4) == Played Tic Tac Toe) {
      inc %tttoeleft 1
      if (%tttoeleft == 10) {
        .notice %tttoenick It's A Tie!
        endtttoe
      }
      elseif (%tttoeleft < 10) {
        did -g tictactoe $strip($5) $tttsign(%othersign)
        unset %tttmestop
        set %playedothertttoe $addtok(%playedothertttoe,$strip($5),126)
        set $+(%,tttother,~,$strip($5)) 1
        if ($($+(%,tttother,~,1),2)) && ($($+(%,tttother,~,2),2)) && ($($+(%,tttother,~,3),2)) {
          endtttoe
          .notice %tttoenick Good Game!!!
          unset %tttoeison
        }
        if ($($+(%,tttother,~,4),2)) && ($($+(%,tttother,~,5),2)) && ($($+(%,tttother,~,6),2)) {
          endtttoe
          .notice %tttoenick Good Game!!!
          unset %tttoeison
        }
        if ($($+(%,tttother,~,7),2)) && ($($+(%,tttother,~,8),2)) && ($($+(%,tttother,~,9),2)) {
          .notice %tttoenick Good Game!!!
          endtttoe
          unset %tttoeison
        }
        if ($($+(%,tttother,~,1),2)) && ($($+(%,tttother,~,4),2)) && ($($+(%,tttother,~,7),2)) {
          .notice %tttoenick Good Game!!!
          endtttoe
          unset %tttoeison
        }
        if ($($+(%,tttother,~,2),2)) && ($($+(%,tttother,~,5),2)) && ($($+(%,tttother,~,8),2)) {
          .notice %tttoenick Good Game!!!
          endtttoe
          unset %tttoeison
        }
        if ($($+(%,tttother,~,3),2)) && ($($+(%,tttother,~,6),2)) && ($($+(%,tttother,~,9),2)) {
          .notice %tttoenick Good Game!!!
          endtttoe
          unset %tttoeison
        }
        if ($($+(%,tttother,~,1),2)) && ($($+(%,tttother,~,5),2)) && ($($+(%,tttother,~,9),2)) {
          .notice %tttoenick Good Game!!!
          endtttoe
          unset %tttoeison
        }
        if ($($+(%,tttother,~,3),2)) && ($($+(%,tttother,~,5),2)) && ($($+(%,tttother,~,7),2)) {
          .notice %tttoenick Good Game!!!
          endtttoe
          unset %tttoeison
        }
      }
    }
  }
}

alias toeacc {
  .notice %tttoenick !accept
  echo -at Choose "X" or "O" By Typing /toesign X or O
}

alias toedec {
  .notice %tttoenick !decline
}

alias toesign {
  if ($strip($1) == O) || ($strip($1) == X) {
    set %mysign $strip($1)
    set %othersign $iif($1 == O, X, O)
    set %tttoeison 1
    .notice %tttoenick I Chose Sign $strip($1)
    dialog -md tictactoe tictactoe
    echo -at You Play 1st!!!
  }
  else {
    echo -at $iif($1, $1 Is Not X or O please Input X or O To Continue, Please Input X or O To Continue)
  }
}

alias asktoe {
  .notice $1 Wanna Play Tic Tac Toe???
}

menu nicklist {
  Tic Tac Toe:asktoe $$1 | dialog -md tictactoe tictactoe | set %tttoenick $$1
}

alias tttsign {
  return $+(tictactoe,$1,.ico)
}

alias endtttoe {
  unset %tttmestop
  unset %tttoe*
  unset %played*tttoe
  unset %mysign
  unset %othersign
  unset %tttmine*
  unset %tttother*
  dialog -x tictactoe
}

Have Fun!!!
Leave a comment if you find a bug.. or for improvement!

Take a look / try out / download Humanity Bot™ @ http://humanitybot.tk
Do you want to help me make some money? You can do it without paying for nothing! Just visit my site, turn off your ad blocker, watch an ad and turn it back on! You'll be giving me something less than a cent! Thanks!

Or do you want to donate some bucks because you like my scripts??? Visit https://www.paypal.me/OrFeAsGr
Thx! ^_^

Comments

Sign in to comment.
OrFeAsGr   -  Feb 10, 2016

Full Instructions on how to play are written on the script start with comment characters. ;;
Take a look :)

 Respond  
Somsubhra1   -  Jan 11, 2016

How to start playing?

OrFeAsGr  -  Jan 17, 2016

Click a nickname on the nicklist. (Of course to play with someone he/she needs the script too.)

Sign in to comment

Wims   -  Aug 24, 2015

You can improve it by getting the script to automatically download the icons, or you could create them with picture windows and /drawsave!

OrFeAsGr  -  Aug 25, 2015

good idea! thx!

Ashoollakhani  -  Feb 07, 2016

Where we post it?

OrFeAsGr  -  Feb 07, 2016

If you mean where to put the script, you should put in a clear remote file. :)

Ashoollakhani  -  Feb 08, 2016

also aliase?

Ashoollakhani  -  Feb 08, 2016

and how to start?

OrFeAsGr  -  Feb 10, 2016

Right click on a nickname and then click Tic Tac Toe .
Make sure the other person has the script!

Ashoollakhani  -  Feb 10, 2016

not working can you give me screen shot?

OrFeAsGr  -  Feb 11, 2016

Did you click someone that also had the script and it didn't work??
Last time i tried it it worked...
Make sure you and the other person loaded the script in a clear remote file..
I will provide even a video when i'm able but not right now..

Ashoollakhani  -  Feb 12, 2016

Pls its not working provide video or pic.

OrFeAsGr  -  Feb 21, 2016

https://www.dropbox.com/s/9mhu13wgqj3eu7c/Untitled%2043.mp4?dl=0
i'm not sure about the video quality but i think you'll get the idea...

Ashoollakhani  -  Feb 23, 2016

i don't know why its not working i will again try.
thanks!

Sign in to comment

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.