Results 1 to 4 of 4

Thread: Bomb script

  1. #1
    Junior Member
    Join Date
    Jul 2009
    Location
    California
    Posts
    6

    Default Bomb script

    Bomb script for mIRC , its sort of a game. I've seen people try to disarm it countless times and i thought it was Hilarious, because this kicks you if you cut the wrong wire. It can be kind of fun unless all the people in your chan are ops or protected because it will not kick protceted ops or people higher in access level to the nick/bot you are using this script with. you must give the nick/bot you want this script for op status. for those who aren't willing to have this bot giving out free halfop status for those who are lucky, i suggest you edit this script to your liking. Also I had a problem with making it so only ops or a certain person can turn the bombgame on/off, at the moment anyone can turn it off or on, but as i said edit it to your liking or not whichever is good for you. I hope you like it or not since i am new to scripting.

    Here's the script or you can get the text file from the link

    Code:
     
    on 1:text:*!bombgame*:#:{
      if ($1 == %c $+ !bombgame) { 
        if ($2 == on) { .enable #bombgame | .msg $chan 7The Bombgame Has Been Enabled. To start the game, Type !bomb. | set %las.used.command bombgame on | set %last.person $nick | /set %st.bombgame on | halt }
        if ($2 == off) { .disable #bombgame | .msg $chan 7The Bombgame has Been Disabled. | set %last.used.command bombgame off | set %last.person $nick | /set %st.bombgame off | halt }
      }
      else { }
    }
    #bombgame on
    on *:text:!bomb:#: { 
      if ($1 == %c $+ !bomb) {
      .msg $chan 14There is a bomb on the channel!!!! We need someone to diffuse it, so all you have to do is cut one of these wires: 4red14, 2blue14, 8yellow14, 3green14. Type !cut (color) to cut the wire and see if you successfully disarmed the bomb. }
    }
    on *:text:!cut red:#: {
      %chance = $r(1,2)
      if ( %chance == 1 ) { .msg $chan Cutting the 4Red wire was a good idea! You saved the channel by successfully disarming the bomb. Hooray for $nick ! Here's a reward! | if ($me isop $chan) { /mode $chan +h $nick } }
      else { .msg $chan you have failed in disarming the bomb! The correct color was 2blue | if ($me isop $chan) { /kick $chan $nick Boom! You failed, correct wire was 2blue! :) }
      }
    }
    on *:text:!cut blue:#: {
      %chance = $r(1,2)
      if ( %chance == 1 ) { .msg $chan Cutting the 2Blue wire was a good idea! You saved the channel by successfully disarming the bomb. Hooray for $nick ! Here's a reward! | if ($me isop $chan) { /mode $chan +h $nick } }
      else { .msg $chan .........nothing happened, proceed to cutting another wire. | if ($me isop $chan) { /mode $chan +v $nick } }
    }
    on *:text:!cut yellow:#: {
      %chance = $r(1,2)
      if ( %chance == 1 ) { .msg $chan .........nothing happened, proceed to cutting another wire. | if ($me isop $chan) { /mode $chan +v $nick  } }
      else { .msg $chan you have failed in disarming the bomb! The correct color was 4red! | if ($me isop $chan) { /kick $chan $nick Boom! You failed, correct wire was 4red! :) }
      }
    }
    on *:text:!cut green:#: {
      %chance = $r(1,2)
      if ( %chance == 1 ) { .msg $chan Cutting the 3Green wire was a good idea! You saved the channel by successfully disarming the bomb. Hooray for $nick ! Here's a reward | if ($me isop $chan) { /mode $chan +h $nick  } }
      else { .msg $chan you have failed in disarming the bomb! The correct wire was 8yellow! | if ($me isop $chan) { /kick $chan $nick Boom! You failed, correct wire was 8yellow! :) }
      }
    }
    #bombgame end
    on *:text:!bombcmds*:#:{
      if ($1 == $c $+ !bombcmds) {
      .msg $chan 7The commands for the Bomb game are !bomb to start the game, !cut (color) to cut one of the 4 wires, and !bombgame [on/off] to enable/disable the bombgame feature. 14These last two commands are to be done by a responsible op. }
      else { halt }
    }
    Attached Files Attached Files
    Last edited by Danfire0; 08-18-2009 at 05:09 AM.

  2. #2
    Rizon Staff
    Join Date
    Apr 2006
    Posts
    1,215

    Default

    Hmm, I wanted to comment on this without providing a whole new script, but there's too much to comment on.

    There are a few important things you have to be told, though:


    on *:text:!bomb:#: {
    if ($1 == %c $+ !bomb) {
    on *:text:!bombcmds*:#:{
    if ($1 == $c $+ !bombcmds) {
    What is this? You already check for !bomb/!bombcmds* (get rid of the * wildcard here) in the matchtext.

    if ($1 == %c $+ !bomb)?
    if ($1 == $c $+ !bombcmds)?

    Both %c and $c return $null, so %c $+ !bomb is equal to !bomb, and $c $+ !bombcmds is equal to !bombcmds.




    on *:text:!cut red:#: {
    %chance = $r(1,2)
    if ( %chance == 1 )
    First of all.. it's a bomb, right?
    If you cut a wire, the bomb usually doesn't randomly say DEFUSED or go BOOM no matter what wire you cut.
    When !bomb is triggered, you set a variable to the color of the wire that can be cut, and when a user does !cut you check if the given color is equal to the wire color variable.

    Either way, if you want an easy and quickly written 50/50 chance, simplycheck if ($r(0,1)).




    Another thing that should be mentioned is that not only a wire color but also a bomb channel variable is to be set when !bomb is triggered,
    so that you're able to make sure that only users from the channel the bomb is on are able to cut wires.


    Other than that.. a single on text event will be sufficient, a single !color check will be sufficient, get rid of the / command prefixes in scripts and useless elses and halts, and don't put too many commands in a single line.



    I'm not gonna ask what those %last (or in one case %las) variables are there for if you don't even use them at all. And a few other things.
    But generally you should unset variables when you're done using them, and use set's -e switch in case mIRC exists before they're unset by the script.

  3. #3
    Junior Member
    Join Date
    Jul 2009
    Location
    California
    Posts
    6

    Talking Thanks

    Thanks Holz for the constructive criticism, i understand my scripting needs alot of work, and i thank you commenting on that. As you could see i am new to scripting, so this script was sort of a cut and paste project that you see in a kindergarden class, but i will work on this script some more and will post hopefully a better one at a later date.

  4. #4
    Rizon Staff
    Join Date
    Apr 2006
    Posts
    1,215

    Default

    Hi Danfire0,

    glad you took my previous post as constructive criticism, was getting a little worried after reviewing it.

    Well, and that's what it is. Appreciating the effort and the fact that you're willing to learn and share things in general.

    Feel free ask and discuss stuff on #mIRC or #help.script, good luck.

Similar Threads

  1. Multi-owner script
    By twilightNoir in forum IRC client scripts and addons
    Replies: 4
    Last Post: 04-15-2019, 09:59 AM
  2. making a ban script on clirc
    By benbop1992 in forum Nintendo DS
    Replies: 1
    Last Post: 11-04-2009, 03:50 PM
  3. mIRC: WHOIS script
    By darkex in forum IRC client scripts and addons
    Replies: 0
    Last Post: 10-14-2009, 07:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •