snowball

By BusyElf on Feb 18, 2008

I'm new to scripting but here goes.. my first shot at something worth posting. This snippet I used in my bot to entetain and have fun with, Only Ops can start it off and stop it. but any user can throw a snowball at another in the room. There's a 50/50 chance of hitting someone but the bot never misses, should you decide to throw a snowball at the bot.
Start it by a !snow on. Stop it by a !snow off
Just typing !snow will throw a snowball in the air and you catch it.
!snow and you stand a chance of hitting them with a splat!

on *:text:*snow*:#: {
  if $1 == ! $+ snow {
    if ($2 == off) {
      if ($nick isop $chan) set %sb 0
      if (%sb == 0) { /msg $chan Oh all the snow is gone now | halt }
    }
    if ($2 == on) { 
      if ($nick isop $chan) set %sb 1
      if (%sb == 1) { /msg $chan Yay it has snowed again. Let's play Snowballs | halt }
    }
    if (%sb == 0) { /msg $chan There's no snow here! | halt }
    if ($2 == $null) { describe $chan $nick throws a snowball in the air and catches it | halt }
    if $2 ison $chan {
      set %tk $rand(1,2) {
        if ($2 == $nick) { /msg $chan Now your just being silly $nick lmao | halt }
        if (%tk == 1) {
          if ($2 == $me) { 
            { /msg $chan Oi ! $nick I'll get you for that! }
            ./timer 1 10 { describe $chan throws a snowball back and splats $nick }
          }
          if (%tk == 1) { describe $chan $nick throws a snowball and splat's $2 }
        }
        if (%tk == 2) { /msg $chan Ohhhhhh bad luck $nick you missed $2 | halt }
      }
    }
    else {
      { describe $chan $nick throws a snowball at $2 and misses }
      { /msg $chan No wonder you missed them $nick lol ...  $2 is not here pmsl }
    }
  }
}

Comments

Sign in to comment.
Korvin   -  Feb 18, 2008

on :text:!snow :#: {

thats all you need, you only use one if for $1, so that would be sufficient, currently, to do the same thing, you have:

on :text:snow*:#: {
if $1 == ! $+ snow {

 Respond  
Jonesy44   -  Feb 18, 2008

[b]Not bad at all for a first script, although i suggest using

.timer .. 

rather than:

./timer

Just my preference, not sure if it makes a small bit off difference in the long run =)[/b]

[size=10]~TH[/size]

 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.