Pass the H-Bomb Game!!!

By Naemuti on Aug 23, 2006

Well...This is just my variation on the pass the hbomb game. It's a variation of the Hot Potato Game, only the Potato is...a bomb!!! You have to pass the bomb and make sure you don't have it when it explodes! If you do..bad things will happen. It has a min/max bomb time, return to sender, bot can play, idle/away protection, difficulty levels, different punishments for losers, and all the settings can be changed from one, very easy to use dialog to change these settings.

The game is also very good on the eyes...unless your bg is white. Maybe I'll go through and add background colors to it later. It also transmits most game notices through notice, so it doesn't look ugly. If you find any bugs, SporkNinja/Pieman/MikeHunt on irc.scrollrack.com (#pirc) and I'll be happy to assist you. Enjoy!

############################
#Pass The H-Bomb           #
#Created by: Pieman        #
#Server: irc.scrollrack.com#
#Channels: #pirc           #
############################

;  Instructions

;  Okay..the way to run this is:
;  1. Copy the snippet to the clipboard and open
;     a new notepad file (or ms word if you'd
;     like) and save it to your bot's mIRC folder
;     as H-BombGame.mrc.
;  2. Open the bot and type /.load -rs H-BombGame.mrc.
;  3. Type /hbomb and configure the settings.

;  Now, If you want people to use your game, all
;  they do is type `passthehbomb, then when it's
;  a player's turn, they type `pass [nick]. If
;  the player who started the game wants, they
;  can type end to end the game.

;  Settings:

;  MinBombTimer: Minimum time before the bomb explodes.
;  MaxBombTimer: Maximum time before the bomb explodes.
;  Punishment: What happens to the loser; note if it is
;   set to Devoice/Kick, the bot must have op on the
;   channel, and if a user doesn't have voice the bot
;   is scripted NOT to try and devoice them. A kick
;   message may also be given if kick is selected.
;  Return to Sender: Bomb may be passed back to person
;   who gave it to them.
;  Bot Plays: The bot hosting the game can issue the
;   game commands. (NOT RECCOMMENDED!)
;  Channel: Check this and enter a channel if you want
;   the bot only to work in a specific channel. Leave
;   it blank for it to work in all channels. Note the
;   bot will STILL only play ONE game at a time.
;  Idle Protection: Protects users that are idle longer
;   than a number of seconds you specify.
;  Difficulty Mode: Easy Mode shows the fuse and a 5
;   second warning if the fuse is over 5 seconds. Hard
;   Mode shows no fuse and no warning.

;  Remember to apply all changes to the bot before
;  closing the dialog. If you have changed something
;  and tried to close before clicking apply, the script
;  will ask you to save your changes.

//Settings Dialog

//Open Dialog
alias hbomb {
  if ($dialog(hbombset)) { dialog -v hmbombset }
  else { dialog -dm hbombset hbombset }
}

alias -l dnotice {
  if ($dialog(notice)) { dialog -v notice }
  else { dialog -m notice notice }
}

//Dialog Table
dialog -l hbombset {
  title "Pass the H-Bomb Settings"
  size -1 -1 258 98
  option dbu
  box "H-Bomb Timer", 3, 2 2 86 43
  text "Minimum time before bomb explodes:", 4, 5 10 51 15
  text "Maximum time before bomb explodes:", 5, 4 27 52 15
  edit "0", 6, 57 11 13 10, limit 2
  edit "0", 7, 57 29 13 10, limit 2
  button "Close", 1, 136 83 39 12, default flat ok
  text "sec.", 2, 72 12 12 8
  text "sec.", 8, 72 30 12 8
  button "Apply Settings", 10, 89 83 45 12, default flat
  box "Idle Protection", 9, 90 46 85 33
  check "Turn Idle Protection On", 11, 93 54 80 12
  text "Idle Protect After", 12, 92 68 45 8
  edit "0", 13, 139 67 16 10, limit 3
  text "secs.", 14, 157 68 15 8
  box "Punishment", 15, 2 46 85 50
  radio "Nothing", 16, 5 54 32 10, group
  radio "Devoice Loser (-v)", 17, 5 63 56 10
  radio "Kick Loser", 18, 5 72 36 10
  text "Kick Message:", 19, 4 84 35 8
  edit "", 20, 41 83 43 10, autohs
  edit "", 22, 123 31 47 10, autohs
  box "Other Settings", 24, 89 2 85 43
  check "Return to Sender", 25, 92 10 54 10
  check "Bot Can Play", 26, 92 20 50 10
  box "Difficulty Level", 23, 177 2 78 94
  radio "Easy Mode", 27, 180 10 71 10, group
  text "In this mode, the fuse is revealed at the beginning, and a 5 second warning is given.", 28, 181 20 69 27
  radio "Hard Mode", 29, 180 49 71 10
  text "In this mode, no fuse is revealed, and no warning is given before the bomb is about to explode.", 30, 180 60 70 33
  check "Channel", 21, 92 31 31 10
}

dialog -l notice {
  title "Notice"
  size -1 -1 67 42
  option dbu
  icon C:\Windows\Explorer.exe, 8
  text "All Changes Saved.", 1, 11 7 48 8, center
  button "Continue", 2, 5 26 59 12, default ok
}

//Dialog Events
On *:Dialog:*:*:*:{
  if ($dname == hbombset) {
    if ($devent == init) {
      if ($did == 0) {
        if (%minbombtimer) { did -ra hbombset 6 %minbombtimer }
        if (%maxbombtimer) { did -ra hbombset 7 %maxbombtimer }
        if (!%punishment) { 
          did -c hbombset 16
          set %punishment 0
        }
        if (%punishment) { did -c hbombset $replace(%punishment,0,16,1,17,2,18) }
        if (%punishment == 0) || (%punishment == 1) { did -b hbombset 20 }
        if (%punishment == 2) && (%kickmsg) { did -ra hbombset 20 %kickmsg }
        if (%returntosender == 1) { did -c hbombset 25 }
        if (%botplays == 1) { did -c hbombset 26 }
        if (%hbombchan == $ $+ chan) { did -b hbombset 22 }
        if (%hbombchan != $ $+ chan) { did -ra hbombset 22 %hbombchan | did -e hbombset 22 }
        if (%idleprotection == 1) { did -c hbombset 11 }
        if (%idlethreshold) { did -ra hbombset 13 %idlethreshold }
        if (%difficulty == $null) { did -c hbombset 29 }
        if (%difficulty != $null) { did -c hbombset $replace(%difficulty,0,27,1,29) }
        set %apply 1
      }
    }
    if ($devent == sclick) {
      if ($did == 10) {
        applySettings
      }
      elseif ($did != 10) {
        if ($did == 16) || ($did == 17) { did -b $dname 20 }
        if ($did == 11) {
          if ($did(11).state == 0) { did -b $dname 13 }
          if ($did(11).state == 1) { did -e $dname 13 }
        }
        if ($did == 21) {
          if ($did(21).state == 0) { did -b $dname 22 }
          if ($did(21).state == 1) { did -e $dname 22 }
        }
        if ($did == 18) { did -e $dname 20 }
        if ($did != 1) { set %apply 0 }
      }
    }
    if ($devent == edit) {
      set %apply 0
    }
    if ($devent == close) {
      if ($did == 0) {
        if (%apply == 0) {
          if ($$?!="You haven't applied your latest settings. Exit anyways?" == $false) {
            applySettings
          }
        }
        unset %apply
      }
    }
  }
  if ($dname == notice) {
    if ($devent == sclick) {
      if ($did == 2) {
        if ($dialog(hbombset)) { dialog -v hbombset }
      }
    }
  }
}

//Apply Settings

alias applySettings {
  set %apply 1
  set %minbombtimer $did(6)
  set %maxbombtimer $did(7)
  if ($did(16).state == 1) { set %punishment 0 }
  if ($did(17).state == 1) { set %punishment 1 }
  if ($did(18).state == 1) {
    set %punishment 2
    if ($did(20)) { set %kickmsg $did(20) }
  }
  if ($did(25).state == 1) { set %returntosender 1 }
  if ($did(26).state == 1) { set %botplays 1 }
  if ($did(25).state == 0) { set %returntosender 0 }
  if ($did(26).state == 0) { set %botplays 0 }
  if ($did(21).state == 0) { set %hbombchan $ $+ chan }
  if ($did(21).state == 1) { set %hbombchan $did(22) }
  if ($did(11).state == 1) { 
    set %idleprotection 1
    if ($did(13)) { set %idlethreshold $did(13) }
  }
  if ($did(27).state == 1) { set %difficulty 0 }
  if ($did(29).state == 1) { set %difficulty 1 }
  dnotice
}

// Hbomb Commands

On *:Text:`*:#:{
  if ($1 == `passthehbomb) {
    if (%game == 1) {
      .notice $nick 14A Game has already started. Please wait for this one to end.
      .return
    }
    else {
      set %game 1
      set %aliaschan $eval(%hbombchan,2)
      msg $eval(%hbombchan,2) 4[.:I14t's time to play a rousing game of 4PASS THE H-BOMB14!!!4:.]
      set %start $nick
      set %player $nick
      set %fuse $rand(%minbombtimer,%maxbombtimer)
      .timer 1 %fuse detonate
      if (%difficulty == 0) {
        msg $eval(%hbombchan,2) 4[.:T14he length of the fuse is 4 $+ %fuse $+ 14 seconds.4:.]
        if (%fuse > 5) { .timer 1 $calc(%fuse - 5) 5secwarn }
      }
      elseif (%difficulty == 1) {
        msg $eval(%hbombchan,2) 4[.:T14he length of the fuse is unknown. Better keep passing that bomb!4:.]
      }
      topass %start
    }
  }
  elseif ($1 == `pass) {
    if (%game == 0) {
      .notice $nick 14There is no game currently.
      .return
    }
    if ($nick != %player) {
      .notice $nick 4[.:Y14ou don't have the bomb!4:.]
    }
    elseif (!$2) {
      .notice $nick 4[.:Y14ou have to pass to someone!!4:.]
    }
    elseif ($2 == $nick) {
      .notice $nick 4[.:Y14ou can't pass the bomb to yourself!!4:.]
    }
    elseif ($2 !ison $eval(%hbombchan,2)) {
      .notice $nick 4[.:T14hat person isn't on the channel!!4:.]
    }
    elseif ($2 == $me) && (%botplays == 0) {
      .notice $nick 4[.:Y14ou can't pass the bomb to me!!4:.]
    }
    elseif ($nick($eval(%hbombchan,2),$2).idle > %idlethreshold) && (%idleprotection == 1) {
      .notice $nick 4[.:Y14ou can't pass the bomb to a person who has been idle THAT long!!4:.]
    }
    elseif ($2 == %last) && (%returntosender = 0) {
      .notice $nick 4[.:Y14ou can't pass the bomb to the person who gave it to you!!4:.]
    }
    elseif ($2 == %last) && (%returntosender = 0) {
      set %last $nick
      set %player $2
      returntosender
    }
    else {
      set %player $2
      set %last $nick
      msg $chan 4[.:14 $+ $nick $+  passes the bomb to $2 $+ .4:.]
      topass $2
    }
  }
  elseif ($1 == `end) {
    if ($nick != %start) { .notice $nick 4[.:Y14ou can't end the game if you didn't start it!4:.] | .return }
    else { 
      msg $eval(%hbombchan,2) 4[.:G14ame Ended by  $+ $nick $+ .4:.]
      gameover
    }
  }
}

On *:Input:*:{
  if (%botplays == 1) {
    if ($1 == `pass) {
      if (%game == 1) {
        .notice $nick 14There is no game currently.
        .return
      }
      if ($me != %player) {
        .notice $me 4[.:Y14ou don't have the bomb!4:.]
      }
      elseif (!$2) {
        .notice $me 4[.:Y14ou have to pass to someone!!4:.]
      }
      elseif ($2 == $me) {
        .notice $me 4[.:Y14ou can't pass the bomb to yourself!!4:.]
      }
      elseif ($2 !ison $eval(%hbombchan,2)) {
        .notice $me 4[.:T14hat person isn't on the channel!!4:.]
      }
      elseif ($2 == $me) && (%botplays == 0) {
        .notice $me 4[.:Y14ou can't pass the bomb to me!!4:.]
      }
      elseif ($nick($eval(%hbombchan,2),$2).idle > %idlethreshold) && (%idleprotection == 1) {
        .notice $me 4[.:Y14ou can't pass the bomb to a person who has been idle THAT long!!4:.]
      }
      elseif ($2 == %last) && (%returntosender = 0) {
        .notice $me 4[.:Y14ou can't pass the bomb to the person who gave it to you!!4:.]
      }
      elseif ($2 == %last) && (%returntosender = 0) {
        set %last $me
        set %player $2
        returntosender
      }
      else {
        set %player $2
        set %last $me
        msg $eval(%hbombchan,2) 4[.:14 $+ $me $+  passes the bomb to $2 $+ .4:.]
        echo PASS: $me to $2
        topass $2
      }
    }
    elseif ($1 == `end) {
      if ($me != %start) { .notice $me 4[.:Y14ou can't end the game if you didn't start it!4:.] | .return }
      else { 
        msg $eval(%hbombchan,2) 4[.:G14ame Ended by  $+ $me $+ .4:.]
        gameover
      }
    }
  }
}

alias returntosender {
  if (%punishment = 0) {
    msg %aliaschan 4B7O8OM14!!! 4(R14eturn to Sender4) 4(V14ictim 4=14 %player $+ 4)
  }
  elseif (%punishment = 1) {
    msg %aliaschan 4B7O8OM14!!! 4(R14eturn to Sender4) 4(V14ictim 4=14 %player $+ 4)
    if (+ isin $nick(%aliaschan,%player).pnick) { mode %aliaschan -v %player }
  }
  elseif (%punishment = 2) {
    kick %aliaschan %player 4(R14eturn to Sender4) 4B7O8OM14!!! $iif(%kickmsg,4 $+ $chr(91) $+  $+ %kickmsg $+ 4 $+ $chr(93)) (V14ictim 4=14 %player $+ 4)
  }
  gameover
}

alias detonate {
  if (%punishment = 0) {
    msg %aliaschan 4B7O8OM14!!! 4(V14ictim 4=14 %player $+ 4)
  }
  elseif (%punishment = 1) {
    msg %aliaschan 4B7O8OM14!!! 4(V14ictim 4=14 %player $+ 4)
    if (+ isin $nick(%aliaschan,%player).pnick) { mode %aliaschan -v %player }
  }
  elseif (%punishment = 2) {
    kick %aliaschan %player 4B7O8OM14!!! $iif(%kickmsg,4 $+ $chr(91) $+  $+ %kickmsg $+ 4 $+ $chr(93)) (V14ictim 4=14 %player $+ 4)
  }
  gameover
}

alias gameover {
  set %player $null
  set %fuse $null
  set %start $null
  set %last $null
  set %game 0
  .timers off
  msg %aliaschan 4[.:G14ame Over.4:.]
  set %aliaschan $null
}

alias 5secwarn msg %aliaschan 4[.:T14ICK...TICK...TICK...4:.]
alias topass .notice $1 4[.:T14o pass the bomb, type `pass [nick].4:.]

Comments

Sign in to comment.
Naemuti   -  Feb 07, 2007

Oh yeah, Russel, if you think you can make a better version, go ahead and try. No one\'s stopping you if you think mine is crappy. I just don\'t feel like bothering updating it, it\'s not worth my time.

 Respond  
Naemuti   -  Feb 07, 2007

Hmm..let\'s see. Because I said I\'d base the idea of my script off yours, not the code? Yeah, I thought so. My code looks much different from yours and it\'s more feature rich, although the game does work the same way. If it ain\'t broke, why fix it, y\'know? But I really don\'t see why I should give you credit just because I made a script of the same kind.

Like I said, this is out of date, for the best version, mirc.net.

 Respond  
Alfreido   -  Jan 23, 2007

Hmmm can\'t edit comments. Well I just noticed the comment you placed on my entry, so I shouldn\'t have come off so harsh, but you could of at least said on this page that the code was based off mine, since it looks fairly similar.

 Respond  
Alfreido   -  Jan 23, 2007

Why does this script look and function almost exactly the same like the one I posted up in 2005?

http://www.hawkee.com/snippet.php?snippet_id=1364

If you were looking to improve my script, at least give me some credit.

 Respond  
RussellReal   -  Jan 13, 2007

lol the script prolly isn\'t that good, if you argue on these comments, for 7 hours lol, but won\'t update your script which would take 2 minutes? lol

 Respond  
Naemuti   -  Dec 07, 2006

It\'s my choice whether I upload it or not. If you must know what bothers me:

There is a 1 megabyte limit on script submissions. Please do not include any executables with your script.

Only upload .zip files, nothing else will be accepted.

Script Updates need to use a different file name from the past.

Now please, for the new version, you must go to mirc.net. No exceptions, I\'m not uploading it here.

 Respond  
RoninWarrior   -  Dec 05, 2006

there are other files on this site that are .rar and what sub guidlines are there for you not to submitt it here ? i have review a few files that were .rar in the past

 Respond  
Naemuti   -  Dec 05, 2006

I can\'t update it because it\'s a .rar archive, and I can\'t be assed to submit it here, especially when mirc.net has a fine version of it. That, and I don\'t like Hawkee\'s submission guidelines, no offense.

 Respond  
Setever   -  Dec 02, 2006

Indeed, Pieman. Add the new version. :|

 Respond  
Hawkee   -  Dec 02, 2006

So why not update it?

 Respond  
Naemuti   -  Dec 02, 2006

This is wicked out of date and bad. Use the one on mirc.net I submitted there.

 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.