egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Timebomb
Goto page 1, 2  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
neilpkemp
Voice


Joined: 13 Nov 2005
Posts: 21

PostPosted: Sun Dec 18, 2005 10:17 am    Post subject: Timebomb Reply with quote

im currently using this script but wanted it so i can choose which channel it works in,can anyone help?

Code:
###############################################################################
#  Name:                                        Timebomb by ^DooM^
#  Eggdrop Version:     1.6.x
#  Original Author:                             jotham.read@gmail.com
#
#  This is a small TCL script for Eggdrop.  Timebomb is a game where one person
#  asks the Eggdrop bot to plant a timebomb in another users pants.  The target
#  user then needs to diffuse the bomb by cutting the correct wire, or be
#  kicked from the channel.
#
#  To start the game a user must type:
#    !timebomb <nickname> || !bomb <nickname>
#  This will cause the target user to have a timebomb "stuffed in their pants"
#  once this occurs the user will have a number of seconds to diffuse the bomb.
#  Diffusing the bomb is done by typing:
#    !cutwire <colour> || !snip <colour>
#
#  The wire colors you can choose from are displayed when the bomb is planted.
#  This script will not allow bots (Users who are +b), or the bot running the
#  script, to be timebombed.
#
#  I know it sounds very silly but it is a rather fun game.
#
#  Additional script features by ^DooM^:
#  -------------------------------------
#
#  *off* = Can be turned off
#
#  1) If the person you !bomb guesses correctly you get booted out of the channel
#  2) Added an idle check to not allow users to be bombed if they are AFK. **
#  3) Made the bot blow itself up on occasion **
#  4) Made the bot kill a user if they try and evade the kick if the bot is opered up **
#  5) Stopped the wire count from choosing just 1 wire thats too easy.
#  6) Added a kick counter
#  7) Added random amusing counter messages
#  8) Added random placements of bomb
#  9) Added protection for "specified" nicks i.e. the owner and a non linked bot
#  10) If a user bombs himself and guesses correctly the user throws the bomb away
#  11) general bug fixes
#
#
###############################################################################

bind  pub   -   !timebomb  doTimebomb
bind  pub   -   !bomb  doTimebomb
bind  pub   -   !cut   doCutWire
bind  pub   -   !snip      doCutWire
bind  pub   -   !defuse      Defuse

###############################################################################
# Configuration
#

## Set the minimum time the bomb can have in seconds
set gTimebombMinimumDuration 15

## Set the maximum time the bomb can have in seconds
set gTimebombMaximumDuration 60

## Set the colours you wish to use
set gWireChoices "Blue Green Red Brown Purple Orange Yellow Cyan Pink Grey Black White"

## Set the maximum number of wires that they can choose from to cut.
## has to be lower than the ammount of colours set above.
set gMaxWireCount 7

## Set this to your nick if you wish to be protected from being bombed
set gOwner "SOLID"

## Set this to the nick of another person or bot to protect if you havent linked the bots
set gBot ""

## This is the file used to store the number of people blown up make sure you have read/write
## access on your shell
set gKickFile "KickCounter.log"

## Set this to 1 if you wish users who are away for X minutes to be exempt from being bombed
set gIdleOn 1

## Set the number of minutes you wish a person to be idle before they are exempt from being bombed
set gIdleTime 2

## I have coded into this script a 1 in 25 chance that the bot will blow itself up arming the bomb
## if it does it will kick itself out of the channel I thought this was highly amusing.
## Set this to 0 if you wish to disable this feature.
set gAllowBotKickSelf 1

## Set this to 1 if your bot is opered up all this feature does is /kill a nick if they try and evade
## a kick from the channel if your bot is not an oper then it will just message them 'Coward' :)
set gOperBot 1

###############################################################################
# Set random counter reasons. Add as many as you like.
#

set gCounterMessage {
 {people have been blown up so far}
 {corpses are lying in the morgue}
 {people have paid with their lives}
 {times that damn bomb has exploded}
 {messy endings}
 {body parts scatter the floor}
 {people are no more}
 {green bottles hanging on the wall}
 {people have lost limbs}
 {tombstones with the words 'I should of cut the other wire' engraved for eternity}
 {people chose the wrong damn wire}
 {people commited suicide to date}
 {death certificates have been issued}
 {people got blown to smithereens}
 {people got 0wned}
 {people are crap at this}
 {peoples teeth decorate the ceiling}
 {people should of ducked}
 {people are burning in hell}
 {people didn't dodge Sentinel's rocket}
 {people got telefragged}
 {people have been forsaken by their evil god}
 {people have gone to that better place}
 {people R.I.P.}
 {people saw an intense white light as their skin melted away from their bones}
 {people were vaporised}
 {bombs were harmed during the making of this script}
 {bombs exploded leaving holes everywhere}
 {times we've scraped jam off the ceiling}
 {bombs were detonated to date}
 {weapons of mass destruction have been detonated so far}
 {times this random message procedure has been called}
 {three headed monkeys all laughed at your stupidity}
 {graves have been dug so far}
 {people wished they had taken the blue pill}
 {times someone set you up the bomb}
 {people had limbs blown off in the most excruciatingly painfull way}
 {times fire and brimstone have scorched the earth}
 {times the room has had to be repainted}
 {people realised too late that they were colour blind}
}

###############################################################################
# Set random place to plant bomb. Add as many as you like.
#

set gPlaceBombMessage {
 {Pants}
 {Shoe}
 {Hair}
 {Bra}
 {Y Fronts}
 {Boxers}
 {Mouth}
 {Ass}
 {Eye Socket}
 {Nose}
 {Wee Hole}
}

###############################################################################
# Internal Globals Do Not Touch Unless You Know What You Are Doing....
#

set gTheScriptVersion "1.2"
set gTimebombActive 0
set gTimerId 0
set gTimebombTarget ""
set gTimebombChannel ""
set gCorrectWire ""
set gNumberNames "zero one two three four five six seven eight nine ten eleven twelve"
set gStarter ""
set gKickCounter 0

###############################################################################
# Script Starts Here
#

proc note {msg} {
  putlog "$msg"
}

proc IRCKick {theNick theChannel theReason} {
    global gKickCounter gKickFile gCounterMessage gOperBot
  note "Kicking $theNick in $theChannel (Reason: $theReason)"
  if { [onchan $theNick $theChannel] } {
     
      #Open file and read the variable
      if { [file exists $gKickFile] == 1 } {
         
          set FileHandle [open $gKickFile "r"]
          set TempString [read $FileHandle]
          close $FileHandle
          set lines [split $TempString "\n"]

          set gKickCounter [lindex $lines 0]
     
      } else {

          # Set the kickcounter to 0 initially
          set gKickCounter 0
      }
      set CounterMessage [lindex $gCounterMessage [rand [llength $gCounterMessage]]]
      putserv "KICK $theChannel $theNick :$theReason. ($gKickCounter $CounterMessage)"
      incr gKickCounter 1
     
      # Write the variable to file (remember opening with 'w' mode truncates the file contents)
      set FileHandle [open $gKickFile "w"]
      puts $FileHandle $gKickCounter
      close $FileHandle
      return
   } elseif { $gOperBot == 1 } {
      putserv "KILL $theNick :$theReason"
      return
   } else {
      putserv "NOTICE $theNick :Coward!!"   
      return
   }
}


proc IRCPrivMSG {theTarget messageString} {
  putserv "PRIVMSG $theTarget :$messageString"
}

proc IRCAction {theTarget messageString} {
  putserv "PRIVMSG $theTarget :\001ACTION $messageString\001"
}

proc MakeEnglishList {theList} {
  set theListLength [llength $theList]
  set returnString [lindex $theList 0]
  for {set x 1} {$x < $theListLength} {incr x} {
    if { $x == [expr $theListLength - 1] } {
      set returnString "$returnString and [lindex $theList $x]"
    } else {
      set returnString "$returnString, [lindex $theList $x]"
    }
  }
  return $returnString
}

proc SelectWires {wireCount} {
  global gWireChoices
  set totalWireCount [llength $gWireChoices]
  set selectedWires ""
  for {set x 0} {$x < $wireCount} {incr x} {
    set currentWire [lindex $gWireChoices [expr int( rand() * $totalWireCount )]]
    if { [lsearch $selectedWires $currentWire] == -1 } {
      lappend selectedWires $currentWire
    } else {
      set x [expr $x - 1]
    }
  }
  return $selectedWires
}

proc DetonateTimebomb {destroyTimer kickMessage} {
  global gTimebombTarget gTimerId gTimebombChannel gTimebombActive gPlaceBombMessage
  if { $destroyTimer } {
    killutimer $gTimerId
  }
  set gTimerId 0
  set gTimebombActive 0
  IRCKick $gTimebombTarget $gTimebombChannel $kickMessage
}

proc DiffuseTimebomb {wireCut} {
  global gTimerId gTimebombActive gTimebombTarget gTimebombChannel gStarter gPlaceBombMessage
  killutimer $gTimerId
  set gTimerId 0
  set gTimebombActive 0
  set RearmDuration 2
  IRCPrivMSG $gTimebombChannel "$gTimebombTarget cut the $wireCut wire.  This has defused the bomb!"
 
  if { [string tolower $gTimebombTarget] == [string tolower $gStarter] } {
      IRCPrivMSG $gTimebombChannel "$gTimebombTarget Throws the bomb away"
      set gStarter ""
      return
  } else {
      set PlaceBombMessage [lindex $gPlaceBombMessage [rand [llength $gPlaceBombMessage]]]
      IRCPrivMSG $gTimebombChannel "$gTimebombTarget ReArmed the bomb at \[4\002$RearmDuration\002\] Seconds and stuffed it into $gStarter's $PlaceBombMessage!"
      IRCKick $gStarter $gTimebombChannel "Tick Tick *BOOM!*"
      set gStarter ""
      return
  }
}

proc StartTimeBomb {theStarter theNick theChannel} {
  global gTimebombActive gTimebombTarget gTimerId gTimebombChannel gNumberNames gCorrectWire
  global gMaxWireCount gTimebombMinimumDuration gTimebombMaximumDuration gStarter gPlaceBombMessage
  set PlaceBombMessage [lindex $gPlaceBombMessage [rand [llength $gPlaceBombMessage]]]
  if { $gTimebombActive == 1 } {
    note "Timebomb not started for $theStarter (Reason: timebomb already active)"
    if { $theChannel != $gTimebombChannel } {
      IRCPrivMSG $theChannel "I don't have a single bomb to spare. :-("
      return
    } else {
      IRCAction $theChannel "points at the bulge in the back of $gTimebombTarget's $PlaceBombMessage."
    }
  } else {
    set timerDuration [expr $gTimebombMinimumDuration + [expr int(rand() * ($gTimebombMaximumDuration - $gTimebombMinimumDuration))]]
    set gStarter $theStarter
    set gTimebombTarget $theNick
    set gTimebombChannel $theChannel
    set numberOfWires [expr 2 + int(rand() * ( $gMaxWireCount - 1 ))]
    set listOfWires [SelectWires $numberOfWires]
    set gCorrectWire [lindex $listOfWires [expr int( rand() * $numberOfWires )]]
    set wireListAsEnglish [MakeEnglishList $listOfWires]
    set wireCountAsEnglish [lindex $gNumberNames $numberOfWires]
    IRCAction $theChannel "stuffs the bomb into $gTimebombTarget's $PlaceBombMessage.  The display reads \[4\002$timerDuration\002\] seconds."
    if { $numberOfWires == 1 } {
      IRCPrivMSG $theChannel "Defuse the bomb by using '!cut colour' Try and cut the correct wire. There is $wireCountAsEnglish wire. It is $wireListAsEnglish."
    } else {
      IRCPrivMSG $theChannel "Defuse the bomb by using '!cut colour' Try and cut the correct wire. There are $wireCountAsEnglish wires. They are $wireListAsEnglish."
    }
    set gTimebombActive 1
    set gTimerId [utimer $timerDuration "DetonateTimebomb 0 {\002*BOOM!*\002}"]
  }
}

###############################################################################
# Eggdrop command binds
#

proc doCutWire {nick uhost hand chan arg} {
  global gTimebombActive gCorrectWire gTimebombTarget
  if { $gTimebombActive == 1 } {
    if { [string tolower $nick] == [string tolower $gTimebombTarget] } {
      if { [llength $arg] == 1 } {
        if { [string tolower $arg] == [string tolower $gCorrectWire] } {
          DiffuseTimebomb $gCorrectWire
        } else {
          DetonateTimebomb 1 "\002snip...*BOOM!*\002"
        }
      }
    }
  }
}

proc doTimebomb {nick uhost hand chan arg} {

  global botnick gStarter gOwner gBot gIdleTime gTimebombActive gAllowBotKickSelf gIdleOn gPlaceBombMessage
  #set gStarter $nick
  set theNick $nick
  if { [lindex [split $arg] 0] != "" } {
    set theNick [lindex [split $arg] 0]
  }
  if { ![onchan $theNick $chan] } {
      putserv "PRIVMSG $chan :$theNick is not here maybe he has been blown up!"
      return
  }
  if { $gAllowBotKickSelf == 1} {
    if { $gTimebombActive == 0 } {
      if { ![rand 25] } {
        IRCKick $botnick $chan "Blew himself up Arming the bomb"
        return
      }
    }
  }
  if { $gIdleOn == 1} {
    if { [getchanidle $theNick $chan] > $gIdleTime && $theNick != $nick} {
      putserv "PRIVMSG $chan :$theNick is Away. Choose another victim!"
      return
    }
  }
  if { [string tolower $theNick] == [string tolower $botnick] || [string tolower $theNick] == [string tolower $gOwner] || [string tolower $theNick] == [string tolower $gBot] } {
    set theNick $nick
    StartTimeBomb $theNick $theNick $chan
    return
  }
  if { [validuser $theNick] == 1 } {
     if { [matchattr $theNick "+b"] == 1 } {
      set theNick $nick
      IRCKick $theNick $chan "You should not attack the bots!"
      return
    }
  }
  StartTimeBomb $nick $theNick $chan
}


proc Defuse {nick uhost hand chan arg} {
  global gTimerId gTimebombActive gTimebombTarget gTimebombChannel gStarter
  killutimer $gTimerId
  set gTimerId 0
  set gTimebombActive 0
 
  if { [string tolower $nick] == [string tolower $gStarter] } {
      IRCPrivMSG $gTimebombChannel "$nick defuses the bomb and throws the bomb away"
      set gStarter ""
      return
  }
}
###############################################################################

note "timebomb $gTheScriptVersion: loaded";
Back to top
View user's profile Send private message Send e-mail
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sun Dec 18, 2005 1:39 pm    Post subject: Reply with quote

insert the following as first line of doTimebomb proc:
Code:

if {[lsearch {#yourchan1 #yourchan2} $chan] == -1} return

_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Sun Dec 18, 2005 6:09 pm    Post subject: Reply with quote

or something like this
Code:

setudef flag Timebomb

place this outside any proc and this:
Code:

if {![channel get $chan Timebomb]} { return }

inside the proc as first line. If you want to enable/disable the Timebomb for a specific channel just .chanset #channel +/-Timebomb
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Sun Dec 18, 2005 6:30 pm    Post subject: Reply with quote

yep, caesar's even better
_________________
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code
Back to top
View user's profile Send private message Visit poster's website
neilpkemp
Voice


Joined: 13 Nov 2005
Posts: 21

PostPosted: Mon Dec 19, 2005 1:06 pm    Post subject: Reply with quote

thxs worked Smile
Back to top
View user's profile Send private message Send e-mail
groofy
Voice


Joined: 18 Oct 2006
Posts: 7

PostPosted: Wed Oct 18, 2006 9:07 am    Post subject: TimeBomb i realy like this script! Reply with quote

But is it possible to change !cut <color> to only color so people don't have to type !cut blue but can type blue
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Wed Oct 18, 2006 9:38 am    Post subject: Re: TimeBomb i realy like this script! Reply with quote

groofy wrote:
But is it possible to change !cut <color> to only color so people don't have to type !cut blue but can type blue

So, any one having a normal covsersation and just happens to mention a colour as the first word in a sentence would trigger the script every time?

Would be interesting to see in a busy channel. Laughing
_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
groofy
Voice


Joined: 18 Oct 2006
Posts: 7

PostPosted: Wed Oct 18, 2006 10:08 am    Post subject: TimeBomb i realy like this script! Reply with quote

not realy cos the only one that can defuse it is the one that got the bomb.
i ment only typeing the color name for defusing the bom Laughing
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Thu Oct 19, 2006 1:55 am    Post subject: Reply with quote

Just make a bind for !blue (or blue, whatever you want):
Code:

bind pub - blue doCutBlue
proc doCutBlue {nick uhost hand chan text} {
     #pass the parameters along to the doCutWire proc with 'blue' as the arg
     doCutWire $nick $uhost $hand $chan blue
}

Something like that, for each color.
Back to top
View user's profile Send private message
groofy
Voice


Joined: 18 Oct 2006
Posts: 7

PostPosted: Thu Oct 19, 2006 6:29 am    Post subject: Reply with quote

Thanks man can i use this to change it so it will work on any color that are used in the script by repeating the code for every color. Question

I just gonna try it to change it so maybe it will or not work Twisted Evil
Back to top
View user's profile Send private message
groofy
Voice


Joined: 18 Oct 2006
Posts: 7

PostPosted: Thu Oct 19, 2006 7:23 am    Post subject: Reply with quote

It's working Thanks A Lot

Now for something else maybe it's a bug i don't know, i got it running it kicks are great but it will not kick the channel owner can this be changed?
Back to top
View user's profile Send private message
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Thu Oct 19, 2006 7:53 am    Post subject: Reply with quote

## Set this to your nick if you wish to be protected from being bombed
set gOwner "SOLID"
Back to top
View user's profile Send private message
groofy
Voice


Joined: 18 Oct 2006
Posts: 7

PostPosted: Thu Oct 19, 2006 8:38 am    Post subject: Reply with quote

Thanks but thats not what i ment i don't need protection i got +O on the channel and it can me but the ones that got +OA don't get kicked

damm i know what the problem is the bot can't kick people with more right that the bot has.

Anyway thanks for all the help i realy needed it cos this is one of the first scripts i worked on (i'm new at this scripting stuff)

in the next post i'll supply the script with the changes
Back to top
View user's profile Send private message
groofy
Voice


Joined: 18 Oct 2006
Posts: 7

PostPosted: Thu Oct 19, 2006 8:50 am    Post subject: Here is the changed script as promissed Reply with quote

Code:

###############################################################################
# Name: Timebomb by ^DooM^
# Eggdrop Version: 1.6.x
# Original Author: jotham.read@gmail.com
#
# Changes made by Groofy on 19-10-2006
# added only <color> to defuse the bomb (with some help by rosc2112)
# changed time on bomb to random time
# some changes on the text (display)
#
# This is a small TCL script for Eggdrop. Timebomb is a game where one person
# asks the Eggdrop bot to plant a timebomb in another users pants. The target
# user then needs to diffuse the bomb by cutting the correct wire, or be
# kicked from the channel.
#
# To start the game a user must type:
# !timebomb <nickname> || !bomb <nickname>
# This will cause the target user to have a timebomb "stuffed in their pants"
# once this occurs the user will have a number of seconds to diffuse the bomb.
# Diffusing the bomb is done by typing:
# <colour> || !snip <colour>
#
# The wire colors you can choose from are displayed when the bomb is planted.
# This script will not allow bots (Users who are +b), or the bot running the
# script, to be timebombed.
#
# I know it sounds very silly but it is a rather fun game.
#
# Additional script features by ^DooM^:
# -------------------------------------
#
# ** = Can be turned off
#
# 1) If the person you !bomb guesses correctly you get booted out of the channel
# 2) Added an idle check to not allow users to be bombed if they are AFK. **
# 3) Made the bot blow itself up on occasion **
# 4) Made the bot kill a user if they try and evade the kick if the bot is opered up **
# 5) Stopped the wire count from choosing just 1 wire thats too easy.
# 6) Added a kick counter
# 7) Added random amusing counter messages
# 8) Added random placements of bomb
# 9) Added protection for "specified" nicks i.e. the owner and a non linked bot
# 10) If a user bombs himself and guesses correctly the user throws the bomb away
# 11) general bug fixes
#
#
###############################################################################

bind pub - !timebomb doTimebomb
bind pub - !bomb doTimebomb
bind pub - !snip doCutWire
bind pub - blue doCutBlue
bind pub - green doCutGreen
bind pub - red doCutRed
bind pub - brown doCutBrown
bind pub - purple doCutPurple
bind pub - orange doCutOrange
bind pub - yellow doCutYellow
bind pub - cyan doCutCyan
bind pub - pink doCutPink
bind pub - grey doCutGrey
bind pub - black doCutBlack
bind pub - white doCutWhite
 

###############################################################################
# Configuration
#

## Set the minimum time the bomb can have in seconds
set gTimebombMinimumDuration 10

## Set the maximum time the bomb can have in seconds
set gTimebombMaximumDuration 40

## Set the colours you wish to use
set gWireChoices "Blue Green Red Brown Purple Orange Yellow Cyan Pink Grey Black White"

## Set the maximum number of wires that they can choose from to cut.
## has to be lower than the ammount of colours set above.
set gMaxWireCount 11

## Set this to your nick if you wish to be protected from being bombed
set gOwner "something"

## Set this to the nick of another person or bot to protect if you havent linked the bots
set gBot "some"

## This is the file used to store the number of people blown up make sure you have read/write
## access on your shell
set gKickFile "KickCounter.log"

## Set this to 1 if you wish users who are away for X minutes to be exempt from being bombed
set gIdleOn 1

## Set the number of minutes you wish a person to be idle before they are exempt from being bombed
set gIdleTime 5

## I have coded into this script a 1 in 25 chance that the bot will blow itself up arming the bomb
## if it does it will kick itself out of the channel I thought this was highly amusing.
## Set this to 0 if you wish to disable this feature.
set gAllowBotKickSelf 1

## Set this to 1 if your bot is opered up all this feature does is /kill a nick if they try and evade
## a kick from the channel if your bot is not an oper then it will just message them 'Coward' :)
set gOperBot 1

###############################################################################
# Set random counter reasons. Add as many as you like.
#

set gCounterMessage {
{people have been blown up so far}
{corpses are lying in the morgue}
{people have paid with their lives}
{times that damn bomb has exploded}
{messy endings}
{body parts scatter the floor}
{people are no more}
{green bottles hanging on the wall}
{people have lost limbs}
{tombstones with the words 'I should of cut the other wire' engraved for eternity}
{people chose the wrong damn wire}
{people commited suicide to date}
{death certificates have been issued}
{people got blown to smithereens}
{people got 0wned}
{people are crap at this}
{peoples teeth decorate the ceiling}
{people should of ducked}
{people are burning in hell}
{people didn't dodge Sentinel's rocket}
{people got telefragged}
{people have been forsaken by their evil god}
{people have gone to that better place}
{people R.I.P.}
{people saw an intense white light as their skin melted away from their bones}
{people were vaporised}
{bombs were harmed during the making of this script}
{bombs exploded leaving holes everywhere}
{times we've scraped jam off the ceiling}
{bombs were detonated to date}
{weapons of mass destruction have been detonated so far}
{times this random message procedure has been called}
{three headed monkeys all laughed at your stupidity}
{graves have been dug so far}
{people wished they had taken the blue pill}
{times someone set you up the bomb}
{people had limbs blown off in the most excruciatingly painfull way}
{times fire and brimstone have scorched the earth}
{times the room has had to be repainted}
{people realised too late that they were colour blind}
}

###############################################################################
# Set random place to plant bomb. Add as many as you like.
#

set gPlaceBombMessage {
{Pants}
{Shoe}
{Hair}
{Bra}
{Y Fronts}
{Boxers}
{Mouth}
{Ass}
{Eye Socket}
{Nose}
{Wee Hole}
}

###############################################################################
# Internal Globals Do Not Touch Unless You Know What You Are Doing....
#

set gTheScriptVersion "1.2"
set gTimebombActive 0
set gTimerId 0
set gTimebombTarget ""
set gTimebombChannel "#psy-chat"
set gCorrectWire ""
set gNumberNames "zero one two three four five six seven eight nine ten eleven twelve"
set gStarter ""
set gKickCounter 0

###############################################################################
# Script Starts Here
#
proc doCutBlue {nick uhost hand chan text} {
     #pass the parameters along to the doCutWire proc with 'blue' as the arg
     doCutWire $nick $uhost $hand $chan blue
}

proc doCutGreen {nick uhost hand chan text} {
     #pass the parameters along to the doCutWire proc with 'green' as the arg
     doCutWire $nick $uhost $hand $chan green
}

proc doCutRed {nick uhost hand chan text} {
     #pass the parameters along to the doCutWire proc with 'red' as the arg
     doCutWire $nick $uhost $hand $chan red
}

proc doCutBrown {nick uhost hand chan text} {
     #pass the parameters along to the doCutWire proc with 'brown' as the arg
     doCutWire $nick $uhost $hand $chan brown
}

proc doCutPurple {nick uhost hand chan text} {
     #pass the parameters along to the doCutWire proc with 'purple' as the arg
     doCutWire $nick $uhost $hand $chan purple
}

proc doCutOrange {nick uhost hand chan text} {
     #pass the parameters along to the doCutWire proc with 'orange' as the arg
     doCutWire $nick $uhost $hand $chan orange
}

proc doCutYellow {nick uhost hand chan text} {
     #pass the parameters along to the doCutWire proc with 'yellow' as the arg
     doCutWire $nick $uhost $hand $chan yellow
}

proc doCutCyan {nick uhost hand chan text} {
     #pass the parameters along to the doCutWire proc with 'cyan' as the arg
     doCutWire $nick $uhost $hand $chan cyan
}

proc doCutPink {nick uhost hand chan text} {
     #pass the parameters along to the doCutWire proc with 'pink' as the arg
     doCutWire $nick $uhost $hand $chan pink
}

proc doCutGrey {nick uhost hand chan text} {
     #pass the parameters along to the doCutWire proc with 'grey' as the arg
     doCutWire $nick $uhost $hand $chan grey
}

proc doCutBlack {nick uhost hand chan text} {
     #pass the parameters along to the doCutWire proc with 'black' as the arg
     doCutWire $nick $uhost $hand $chan black
}

proc doCutWhite {nick uhost hand chan text} {
     #pass the parameters along to the doCutWire proc with 'white' as the arg
     doCutWire $nick $uhost $hand $chan white
}

proc note {msg} {
putlog "$msg"
}

proc IRCKick {theNick theChannel theReason} {
global gKickCounter gKickFile gCounterMessage gOperBot
note "Kicking $theNick in $theChannel (Reason: $theReason)"
if { [onchan $theNick $theChannel] } {

#Open file and read the variable
if { [file exists $gKickFile] == 1 } {

set FileHandle [open $gKickFile "r"]
set TempString [read $FileHandle]
close $FileHandle
set lines [split $TempString "\n"]

set gKickCounter [lindex $lines 0]

} else {

# Set the kickcounter to 0 initially
set gKickCounter 0
}
set CounterMessage [lindex $gCounterMessage [rand [llength $gCounterMessage]]]
putserv "KICK $theChannel $theNick :$theReason. ($gKickCounter $CounterMessage)"
incr gKickCounter 1

# Write the variable to file (remember opening with 'w' mode truncates the file contents)
set FileHandle [open $gKickFile "w"]
puts $FileHandle $gKickCounter
close $FileHandle
return
} elseif { $gOperBot == 1 } {
putserv "KILL $theNick :$theReason"
return
} else {
putserv "NOTICE $theNick :Coward!!"
return
}
}


proc IRCPrivMSG {theTarget messageString} {
putserv "PRIVMSG $theTarget :$messageString"
}

proc IRCAction {theTarget messageString} {
putserv "PRIVMSG $theTarget :\001ACTION $messageString\001"
}

proc MakeEnglishList {theList} {
set theListLength [llength $theList]
set returnString [lindex $theList 0]
for {set x 1} {$x < $theListLength} {incr x} {
if { $x == [expr $theListLength - 1] } {
set returnString "$returnString and [lindex $theList $x]"
} else {
set returnString "$returnString, [lindex $theList $x]"
}
}
return $returnString
}

proc SelectWires {wireCount} {
global gWireChoices
set totalWireCount [llength $gWireChoices]
set selectedWires ""
for {set x 0} {$x < $wireCount} {incr x} {
set currentWire [lindex $gWireChoices [expr int( rand() * $totalWireCount )]]
if { [lsearch $selectedWires $currentWire] == -1 } {
lappend selectedWires $currentWire
} else {
set x [expr $x - 1]
}
}
return $selectedWires
}

proc DetonateTimebomb {destroyTimer kickMessage} {
global gTimebombTarget gTimerId gTimebombChannel gTimebombActive gPlaceBombMessage
if { $destroyTimer } {
killutimer $gTimerId
}
set gTimerId 0
set gTimebombActive 0
IRCKick $gTimebombTarget $gTimebombChannel $kickMessage
}

proc DiffuseTimebomb {wireCut} {
global gTimerId gTimebombActive gTimebombTarget gTimebombChannel gStarter gPlaceBombMessage
killutimer $gTimerId
set gTimerId 0
set gTimebombActive 0
set RearmDuration 2
IRCPrivMSG $gTimebombChannel "124,1:::5:0 $gTimebombTarget has cut the $wireCut wire. This has defused the bomb!0,1 5,1:4:::"

if { [string tolower $gTimebombTarget] == [string tolower $gStarter] } {
IRCPrivMSG $gTimebombChannel "124,1:::5:0 $gTimebombTarget Throws the bomb away0,1 5,1:4:::"
set gStarter ""
return
} else {
set PlaceBombMessage [lindex $gPlaceBombMessage [rand [llength $gPlaceBombMessage]]]
IRCPrivMSG $gTimebombChannel "$gTimebombTarget ReArmed the bomb at \[4\002$RearmDuration\002\] Seconds and stuffed it into $gStarter's $PlaceBombMessage!"
IRCKick $gStarter $gTimebombChannel "Tick Tick *BOOM!*"
set gStarter ""
return
}
}

proc StartTimeBomb {theStarter theNick theChannel} {
global gTimebombActive gTimebombTarget gTimerId gTimebombChannel gNumberNames gCorrectWire
global gMaxWireCount gTimebombMinimumDuration gTimebombMaximumDuration gStarter gPlaceBombMessage
set PlaceBombMessage [lindex $gPlaceBombMessage [rand [llength $gPlaceBombMessage]]]
if { $gTimebombActive == 1 } {
note "Timebomb not started for $theStarter (Reason: timebomb already active)"
if { $theChannel != $gTimebombChannel } {
IRCPrivMSG $theChannel "I don't have a single bomb to spare. :-("
return
} else {
IRCAction $theChannel "points at the bulge in the back of $gTimebombTarget's $PlaceBombMessage."
}
} else {
set timerDuration [expr $gTimebombMinimumDuration + [expr int(rand() * ($gTimebombMaximumDuration - $gTimebombMinimumDuration))]]
set gStarter $theStarter
set gTimebombTarget $theNick
set gTimebombChannel $theChannel
set numberOfWires [expr 2 + int(rand() * ( $gMaxWireCount - 1 ))]
set listOfWires [SelectWires $numberOfWires]
set gCorrectWire [lindex $listOfWires [expr int( rand() * $numberOfWires )]]
set wireListAsEnglish [MakeEnglishList $listOfWires]
set wireCountAsEnglish [lindex $gNumberNames $numberOfWires]
IRCAction $theChannel "stuffs the bomb into $gTimebombTarget's $PlaceBombMessage. The display reads \[4\002$timerDuration\002\] seconds."
if { $numberOfWires == 1 } {
IRCPrivMSG $theChannel "\4,1:::5:0 INCOMING!: Bomb has been planted!!! You have4 $timerDuration seconds0 to defuse the Bomb! Engine: \002\00309$theNick \002\00300use 'colour' to cut the wire. Try to cut the correct wire. There is $wireCountAsEnglish wire. $wireListAsEnglish.:\. 5:5:4,1::"
} else {
IRCPrivMSG $theChannel "\4,1:::5:0 INCOMING!: Bomb has been planted!!! You have4 $timerDuration seconds0 to defuse the Bomb! Engine: \002\00309$theNick \002\00300use 'colour' to cut the wire. Try to cut the correct wire. There are $wireCountAsEnglish wires. $wireListAsEnglish.:\. 5:5:4,1::"
}
set gTimebombActive 1
set gTimerId [utimer $timerDuration "DetonateTimebomb 0 {\124,1:::5:0 *BOOM* Fear. Go to die noob!}"]
}
}

###############################################################################
# Eggdrop command binds
#

proc doCutWire {nick uhost hand chan arg} {
global gTimebombActive gCorrectWire gTimebombTarget
if { $gTimebombActive == 1 } {
if { [string tolower $nick] == [string tolower $gTimebombTarget] } {
if { [llength $arg] == 1 } {
if { [string tolower $arg] == [string tolower $gCorrectWire] } {
DiffuseTimebomb $gCorrectWire
} else {
DetonateTimebomb 1 "\124,1:::5:0 snip...*BOOM!*"
}
}
}
}
}

proc doTimebomb {nick uhost hand chan arg} {

global botnick gStarter gOwner gBot gIdleTime gTimebombActive gAllowBotKickSelf gIdleOn gPlaceBombMessage
#set gStarter $nick
set theNick $nick
if { [lindex [split $arg] 0] != "" } {
set theNick [lindex [split $arg] 0]
}
if { ![onchan $theNick $chan] } {
putserv "PRIVMSG $chan :$theNick is not here maybe he has been blown up!"
return
}
if { $gAllowBotKickSelf == 1} {
if { $gTimebombActive == 0 } {
if { ![rand 25] } {
IRCKick $botnick $chan "Blew himself up Arming the bomb"
return
}
}
}
if { $gIdleOn == 1} {
if { [getchanidle $theNick $chan] > $gIdleTime && $theNick != $nick} {
putserv "PRIVMSG $chan :124,1:::5:0 $theNick is Away. Choose another victim!124,1:::5:0 "
return
}
}
if { [string tolower $theNick] == [string tolower $botnick] || [string tolower $theNick] == [string tolower $gOwner] || [string tolower $theNick] == [string tolower $gBot] } {
set theNick $nick
StartTimeBomb $theNick $theNick $chan
return
}
if { [validuser $theNick] == 1 } {
if { [matchattr $theNick "+b"] == 1 } {
set theNick $nick
IRCKick $theNick $chan "124,1:::5:0 You should not attack the bots!124,1:::5:0 " 
return
}
}
StartTimeBomb $nick $theNick $chan
}

###############################################################################

note "timebomb $gTheScriptVersion: loaded";


Last edited by groofy on Thu Oct 19, 2006 10:34 am; edited 2 times in total
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Thu Oct 19, 2006 9:24 am    Post subject: Reply with quote

goofy: edit your post using code tags and correcting the colour codes.
_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber