Simple Soccer Game

By hamtarofreak on May 04, 2006

Put the script in your remotes tab then type /set %soccerchan (channels you want it to work in) if you want more than one, type #soccer,#mirc,#etc

Use !soccer to begin the game, !play to start playing, !kick to kick the ball, !goal to go for a goal, !endgame to finish and !scores to view the current scores.

on *:TEXT:!soccer:%soccerchan:{
  if (%soccer != on) {
    msg $chan $nick has started the soccer game.
    set %soccer on
  }
  elseif (%soccer == on) {
    msg $chan There is a game in progress $nick $+ .
  }
}
on *:TEXT:!play:%soccerchan:{
  if ((%soccer == on) && (%playing != on)) {
    set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
    while (%soccerisin == $me) {
      set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
    }
    msg $chan $nick kicks the soccer ball to %soccerisin
    set %distance $rand(1,100)
    msg $chan The ball is now %distance $+ m from the goal.
    set %playing on
  }
}
on *:TEXT:!kick:%soccerchan:{
  if ($nick == %soccerisin) {
    set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
    while (%soccerisin == $me) {
      set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
    }
    msg $chan $nick kicks the soccer ball to %soccerisin
    set %distance $rand(1,100)
    msg $chan The ball is now %distance $+ m from the goal.
  }
  elseif ($nick != %soccerisin) {
    notice $nick You don't have the ball!! Sshh
  }
}
on *:TEXT:!goal:%soccerchan:{
  if ($nick == %soccerisin) {
    if (%distance >= 40) {
      inc %cpu 1
      msg $chan $read(ballstopped.txt)
      set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
      while (%soccerisin == $me) {
        set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
      }
      msg $chan %soccerisin now has the ball.
      set %distance $rand(1,100)
      msg $chan The ball is now %distance $+ m from the goal.
    }
    elseif ((%distance <= 40) && (%distance >= 10)) { 
      set %rands $rand(1,10)
      if (%rands == 10) {
        msg $chan The ball is in!!
        inc %players 1
        msg $chan The scores are CPU: $int(%cpu) $+ , Players: $int(%players)
      }
      elseif (%rands != 4) {
        inc %cpu 1
        msg $chan $read(ballstopped.txt)
        set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
        while (%soccerisin == $me) {
          set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
        }
        msg $chan %soccerisin now has the ball.
        set %distance $rand(1,100)
        msg $chan The ball is now %distance $+ m from the goal.
      }
    }
    elseif (%distance <= 10) {
      set %rands $rand(1,5)
      if (%rands == 5) {
        msg $chan The ball is in!!!
        inc %players 1
        msg $chan The scores are CPU: $int(%cpu) $+ , Players: $int(%players)
      }
      elseif (%rands != 5) {
        inc %cpu 1
        msg $chan $read(ballstopped.txt)
        set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
        while (%soccerisin == $me) {
          set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
        }
        msg $chan %soccerisin now has the ball.
        set %distance $rand(1,100)
        msg $chan The ball is now %distance $+ m from the goal.
      }
    }
    elseif (%distance <= 5) {
      set %rands $rand(1,2)
      if (%rands == 2) {
        msg $chan The ball is in!!!
        inc %players 1
        msg $chan The scores are CPU: $int(%cpu) $+ , Players: $int(%players)
      }
      elseif (%rands != 2) {
        inc %cpu 1
        msg $chan $read(ballstopped.txt)
        set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
        while (%soccerisin == $me) {
          set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
        }
        msg $chan %soccerisin now has the ball.
        set %distance $rand(1,100)
        msg $chan The ball is now %distance $+ m from the goal.
      }
    }
  }
}
on *:TEXT:!scores:%soccerchan:{
  if (%soccer == on) {
    msg $chan The scores are: CPU: $int(%cpu) $+ , Players: $int(%players)
  }
  elseif (%soccer != on) {
    msg $chan No game is in progress.
  }
}
on *:TEXT:!steal:%soccerchan:{
  if ((%soccerisin != $null) && (%soccerisin != $nick) && (%steal != on)) {
    set %rand $rand(1,5) 
    set %steal on
    timer9 1 30 { set %steal off }
    if (%rand == 5) { 
      msg $chan The ball is stolen from %soccerisin by $nick $+ !!
      set %soccerisin $nick
    }
    elseif (%rand != 5) {
      msg $chan The attempt to steal from %soccerisin failed.
    }
  }
}
on *:TEXT:!endgame:%soccerchan:{
  if (%soccer == on) {
    msg $chan Soccer is now over.
    if (%cpu >= %players) {
      msg $chan The winner was13 CPU, too bad, better luck next time.
    }
    elseif (%players >= %cpu) {
      msg $chan The winner was13 Players, you won!!
      msg $chan Congratulations!!
    }
    set %soccer off
    set %soccer2 off
    set %soccerisin .
    set %cpu 0
    set %players 0
    set %playing off
  }
}
on *:JOIN:%soccerchan:{
  msg $nick Soccer is enabled in this channel, type !soccercommands to learn more.
}
on *:TEXT:!soccercommands:%soccerchan:{
  msg $nick Type !soccer to begin, !play to start the game, !kick to kick the ball once you get it;
  msg $nick !scores shows the current scores
  msg $nick !goal to try for a goal, once your in 40m of the goal.
  msg $nick Everytime you try for a goal, and miss, the CPU team gets a point.
  msg $nick !endgame ends the game.
  msg $nick !steal lets you steal the ball from another player.
  msg $nick Soccer is much more fun with more than one player ;)
  if (%soccer == on) {
    msg $nick There is a game on at the moment.
  }
  elseif (%soccer != on) {
    msg $nick There is no game on at the moment.
  }
  msg $nick Thankyou for playing HamSoccer BETA v1
}
on *:PART:%soccerchan:{
  if (%soccer == on) && ($nick($chan,0) == 1) {
    msg $chan Soccer is now over.
    if (%cpu >= %players) {
      msg $chan The winner was 13 CPU, too bad, better luck next time.
    }
    elseif (%players >= %cpu) {
      msg $chan The winner was 13 Players, you won!!
      msg $chan Congratulations!!
    }
    set %soccer off
    set %soccer2 off
    set %soccerisin .
    set %cpu 0
    set %players 0
    set %playing off
  }
}

Comments

Sign in to comment.
Stewie1k94   -  Oct 27, 2011

Sadly, no, sorry :(

 Respond  
NiceGuy23   -  Oct 27, 2011

toclafane1 i was wondering if you know the code where i can add a pass to the remote like so !pass toclafane1 and then it should say Niceguys passes the ball to toclafane1 do you know the code ?

 Respond  
Stewie1k94   -  Oct 27, 2011

You might want to change

on *:TEXT:!soccer:%soccerchan:{

to

on *:TEXT:!soccer:#:{

It wont work with %soccerchan if the channel wasn't set yet, and maybe this script might work better with hash tables, just wondering!

 Respond  
NiceGuy23   -  Oct 27, 2011

its a wonderful Code i like it but i was just wondering about the pass

 Respond  
NiceGuy23   -  Oct 27, 2011

i just have a question you didnt add the pass and how i can make it to pass it to the payer i want to like for Example !pass and the nickname if you can please tell me

 Respond  
Eugenio   -  Mar 21, 2008

Dont even work for me.

 Respond  
Blugh   -  Apr 14, 2007

/set %soccerchan but you have to do it on the nick that has the script.. its a good game.. i just wish that it told you that you miss everytime not once in awhile

 Respond  
BrainBryce   -  Apr 14, 2007

Well mine doesnt work what should i type to get it in a channel?

 Respond  
Blugh   -  Apr 12, 2007

Ok this is a great script. love it.. but even after i copied over APinis i still dont always get the miss.. its only sometimes.. so does anyone know how to possibly to fix this?
thank you

 Respond  
anlexsc   -  Mar 22, 2007

Is there a way to exclude another bot nick in the room? Something like, if (%random.chatter == nicktoexclude) || (%random.chatter = $nick) goto start
set %response
That\'s all I have, and I don\'t know where to put it, or if that would even work.

Thanks

 Respond  
APinis   -  Jan 25, 2007

Ok I changed something in the script! Problem was that wen i played I typed !goal it sometimes answered The ball is in!! and showed score! But sometimes it didnt because you missed and CPU got the point, but the bot didnt say anything! So I was a little confused wenn i typed !scores and saw that the score was 18:0 ( example ) So now I made it to show whenn you miss and CPU scores! I`m very proud of myself because I dont know anything ANYTHING about scripting :)))) gratz to me!
Sorry for bad english!

on :TEXT:!soccer:%soccerchan:{
if (%soccer != on) {
msg $chan $nick has started the soccer game.
set %soccer on
}
elseif (%soccer == on) {
msg $chan There is a game in progress $nick $+ .
}
}
on
:TEXT:!play:%soccerchan:{
if ((%soccer == on) && (%playing != on)) {
set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
while (%soccerisin == $me) {
set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
}
msg $chan $nick kicks the soccer ball to %soccerisin
set %distance $rand(1,100)
msg $chan The ball is now %distance $+ m from the goal.
set %playing on
}
}
on :TEXT:!kick:%soccerchan:{
if ($nick == %soccerisin) {
set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
while (%soccerisin == $me) {
set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
}
msg $chan $nick kicks the soccer ball to %soccerisin
set %distance $rand(1,100)
msg $chan The ball is now %distance $+ m from the goal.
}
elseif ($nick != %soccerisin) {
notice $nick You don\'t have the ball!! Sshh
}
}
on
:TEXT:!goal:%soccerchan:{
if ($nick == %soccerisin) {
if (%distance >= 40) {
msg $chan you missed CPU gets a point!
inc %cpu 1
msg $chan The scores are CPU: $int(%cpu) $+ , Players: $int(%players)
msg $chan $read(ballstopped.txt)
set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
while (%soccerisin == $me) {
set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
}
msg $chan %soccerisin now has the ball.
set %distance $rand(1,100)
msg $chan The ball is now %distance $+ m from the goal.
}
elseif ((%distance <= 40) && (%distance >= 10)) {
set %rands $rand(1,10)
if (%rands == 10) {
msg $chan The ball is in!!
inc %players 1
msg $chan The scores are CPU: $int(%cpu) $+ , Players: $int(%players)
}
elseif (%rands != 4) {
msg $chan you missed CPU gets a point!
inc %cpu 1
msg $chan The scores are CPU: $int(%cpu) $+ , Players: $int(%players)
msg $chan $read(ballstopped.txt)
set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
while (%soccerisin == $me) {
set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
}
msg $chan %soccerisin now has the ball.
set %distance $rand(1,100)
msg $chan The ball is now %distance $+ m from the goal.
}
}
elseif (%distance <= 10) {
set %rands $rand(1,5)
if (%rands == 5) {
msg $chan The ball is in!!!
inc %players 1
msg $chan The scores are CPU: $int(%cpu) $+ , Players: $int(%players)
}
elseif (%rands != 5) {
inc %cpu 1
msg $chan $read(ballstopped.txt)
set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
while (%soccerisin == $me) {
set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
}
msg $chan %soccerisin now has the ball.
set %distance $rand(1,100)
msg $chan The ball is now %distance $+ m from the goal.
}
}
elseif (%distance <= 5) {
set %rands $rand(1,2)
if (%rands == 2) {
msg $chan The ball is in!!!
inc %players 1
msg $chan The scores are CPU: $int(%cpu) $+ , Players: $int(%players)
}
elseif (%rands != 2) {
inc %cpu 1
msg $chan $read(ballstopped.txt)
set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
while (%soccerisin == $me) {
set %soccerisin $nick($chan,$rand(1,$nick($chan,0)))
}
msg $chan %soccerisin now has the ball.
set %distance $rand(1,100)
msg $chan The ball is now %distance $+ m from the goal.
}
}
}
}
on :TEXT:!scores:%soccerchan:{
if (%soccer == on) {
msg $chan The scores are: CPU: $int(%cpu) $+ , Players: $int(%players)
}
elseif (%soccer != on) {
msg $chan No game is in progress.
}
}
on
:TEXT:!steal:%soccerchan:{
if ((%soccerisin != $null) && (%soccerisin != $nick) && (%steal != on)) {
set %rand $rand(1,5)
set %steal on
timer9 1 30 { set %steal off }
if (%rand == 5) {
msg $chan The ball is stolen from %soccerisin by $nick $+ !!
set %soccerisin $nick
}
elseif (%rand != 5) {
msg $chan The attempt to steal from %soccerisin failed.
}
}
}
on :TEXT:!endgame:%soccerchan:{
if (%soccer == on) {
msg $chan Soccer is now over.
if (%cpu >= %players) {
msg $chan The winner was13 CPU, too bad, better luck next time.
}
elseif (%players >= %cpu) {
msg $chan The winner was13 Players, you won!!
msg $chan Congratulations!!
}
set %soccer off
set %soccer2 off
set %soccerisin .
set %cpu 0
set %players 0
set %playing off
}
}
on
:JOIN:%soccerchan:{
msg $nick Soccer is enabled in this channel, type !soccercommands to learn more.
}
on :TEXT:!soccercommands:%soccerchan:{
msg $nick Type !soccer to begin, !play to start the game, !kick to kick the ball once you get it;
msg $nick !scores shows the current scores
msg $nick !goal to try for a goal, once your in 40m of the goal.
msg $nick Everytime you try for a goal, and miss, the CPU team gets a point.
msg $nick !endgame ends the game.
msg $nick !steal lets you steal the ball from another player.
msg $nick Soccer is much more fun with more than one player ;)
if (%soccer == on) {
msg $nick There is a game on at the moment.
}
elseif (%soccer != on) {
msg $nick There is no game on at the moment.
}
msg $nick Thankyou for playing HamSoccer BETA v1
}
on
:PART:%soccerchan:{
if (%soccer == on) && ($nick($chan,0) == 1) {
msg $chan Soccer is now over.
if (%cpu >= %players) {
msg $chan The winner was 13 CPU, too bad, better luck next time.
}
elseif (%players >= %cpu) {
msg $chan The winner was 13 Players, you won!!
msg $chan Congratulations!!
}
set %soccer off
set %soccer2 off
set %soccerisin .
set %cpu 0
set %players 0
set %playing off
}
}

OMG IM SO HAPPY!!! :))))))))

 Respond  
mysterycool   -  Dec 27, 2006

petrillo2000 I think you didn\'t set a %soccerchan in your variables. Type //set %soccerchan #andhereyourchan. If even then it won\'t work then dunno what\'s wrong :(

 Respond  
petrillo2000   -  May 21, 2006

i have added this to my script but i cant seem to get it to work any ideas what i have done wrong?

 Respond  
spitfire3292   -  May 12, 2006

its kinda hard to make a game that you kinda NEED graphics for for a channel. theres always good attempts , and this is close to one but i think a game like this is better off as a graphics game as an add on in mIRC

 Respond  
hamtarofreak   -  May 08, 2006

Yeah, I need to add in some code that\'ll show who has the ball and stuff.
I was thinking of setting a timer so the same person can\'t !kick more than once in 10 seconds. But I decided against it.

 Respond  
spitfire3292   -  May 06, 2006

seems like a script that would create alot of confusion in the channel. if ppl quit or come in then who knows who has the ball and such. and this could create alot of spam by making ppl keep saying !kick or !steal or !goal over and over...nice idea though ...i may use it for a channel where no1 spams lol but thats hard to find...:D

 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.