| View previous topic :: View next topic |
| Author |
Message |
langer_hans Voice
Joined: 19 Feb 2015 Posts: 13
|
Posted: Thu Feb 19, 2015 5:26 pm Post subject: Bombscript with revenge mode |
|
|
Hi,
i found this nice Bombscript, it works very well. but i´ve seen an other script with "revenge" mode. if i defuse the bomb - the user which bombed me, gets himself bombed. and so on. till someone got bombed.
and i want that only 4 colors will appear. 4, not less, not more.
| Code: | ###############################################################################
# Name: Timebomb
# Author: jotham.read@gmail.com
# Web Site: http://radiosaurus.sporkism.org
# Eggdrop Version: 1.6.x
# Description:
#
# 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>
# 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 <color>
# 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.
#
###############################################################################
bind pub - !bomb doTimebomb
bind pub - !cut doCutWire
###############################################################################
# Configuration
#
set gTimebombMinimumDuration 20
set gTimebombMaximumDuration 60
set gWireChoices "Red Orange Yellow Green Blue Indigo Violet Black White Grey Brown Pink Mauve Beige Aquamarine Chartreuse Bisque Crimson Fuchsia Gold Ivory Khaki Lavender Lime Magenta Maroon Navy Olive Plum Silver Tan Teal Turquoise"
set gMaxWireCount 7
###############################################################################
# Internal Globals
#
set gTheScriptVersion "0.4"
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"
###############################################################################
proc note {msg} {
putlog "% $msg"
}
proc IRCKick {theNick theChannel theReason} {
note "Kicking $theNick in $theChannel (Reason: $theReason)"
putserv "KICK $theChannel $theNick :$theReason"
}
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
if { $destroyTimer } {
killutimer $gTimerId
}
set gTimerId 0
set gTimebombActive 0
IRCKick $gTimebombTarget $gTimebombChannel $kickMessage
}
proc DiffuseTimebomb {wireCut} {
global gTimerId gTimebombActive gTimebombTarget gTimebombChannel
killutimer $gTimerId
set gTimerId 0
set gTimebombActive 0
IRCPrivMSG $gTimebombChannel "$gTimebombTarget cut the $wireCut wire. This has defused the bomb!"
}
proc StartTimeBomb {theStarter theNick theChannel} {
global gTimebombActive gTimebombTarget gTimerId gTimebombChannel gNumberNames gCorrectWire
global gMaxWireCount gTimebombMinimumDuration gTimebombMaximumDuration
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. :-("
} else {
IRCAction $theChannel "points at the bulge in the back of $gTimebombTarget's pants."
}
} else {
set timerDuration [expr $gTimebombMinimumDuration + [expr int(rand() * ($gTimebombMaximumDuration - $gTimebombMinimumDuration))]]
set gTimebombTarget $theNick
set gTimebombChannel $theChannel
set numberOfWires [expr 2 + int(rand() * ( $gMaxWireCount - 0 ))]
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 pants. The display reads \[\002$timerDuration\002\] seconds."
if { $numberOfWires == 1 } {
IRCPrivMSG $theChannel "Diffuse the bomb by cutting the correct wire. Type !cut <color> There is $wireCountAsEnglish wire. It is $wireListAsEnglish."
} else {
IRCPrivMSG $theChannel "Diffuse the bomb by cutting the correct wire. Type !cut <color> There are $wireCountAsEnglish wires. They are $wireListAsEnglish."
}
note "Timebomb started by $theStarter (Bomb handed to $theNick it will detonate in $timerDuration seconds)"
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
set theNick $nick
if { [llength $arg] == 1 } {
set theNick [lindex [split $arg] 0]
}
if { [string tolower $theNick] == [string tolower $botnick] } {
set theNick $nick
IRCKick $theNick $chan "I will not tollerate this!"
return
}
if { [validuser $theNick] == 1 } {
if { [matchattr $theNick "+b"] == 1 } {
set theNick $nick
IRCKick $theNick $chan "I will not tollerate that!"
return
}
}
StartTimeBomb $nick $theNick $chan
}
###############################################################################
note "timebomb$gTheScriptVersion: loaded";
note " with $gMaxWireCount wire maximum,"
note " and time range of $gTimebombMinimumDuration to $gTimebombMaximumDuration seconds.";
|
thanks |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Thu Feb 19, 2015 8:38 pm Post subject: |
|
|
The "only 4 colors will appear" is easy to take care of.
search for this line in the script... | Code: | | set numberOfWires [expr 2 + int(rand() * ( $gMaxWireCount - 0 ))] |
...and change it to look more like this... | Code: | | set numberOfWires 4 |
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
langer_hans Voice
Joined: 19 Feb 2015 Posts: 13
|
Posted: Fri Feb 20, 2015 11:12 am Post subject: |
|
|
Thanks that works very well.
Is it difficult to implent the "revenge" mode?
now it is:
user1: !bomb user2
Bot: Diffuse the bomb by cutting the correct wire. Type !cut <color> There are four wires. They are Blue, Red, Green and Yellow.
user2: !cut green
Bot: user2 cut the Green wire. This has defused the bomb!
but i want:
user1: !bomb user2
Bot: Diffuse the bomb by cutting the correct wire. Type !cut <color> There are four wires. They are Blue, Red, Green and Yellow.
user2: !cut green
Bot: Bomb has been defused! You win! - Whoa, i can see you wanna suicide, user1. Okay, the bomb will explode in 30seconds! Good luck.
user1: !cut blue
Bot: * user1 was kicked by Bot (You cut the wrong wire! You should've cut the green wire! *CLICK CLICK BOOOOOOOOOOOOOOOOM*)
or user1 defuses the bomb, too. then the bomb will go back to user2.
thanks. |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sat Feb 21, 2015 11:52 am Post subject: |
|
|
Try this:
1) Replace the existing proc DiffuseTimebomb with this process: | Code: |
proc DiffuseTimebomb {wireCut} {
global gTimerId gTimebombActive gTimebombTarget gTimebombChannel gTimebomber
killutimer $gTimerId
IRCPrivMSG $gTimebombChannel "$gTimebombTarget cut the $wireCut wire. This has defused the bomb!"
StartTimeBomb $gTimebombTarget $gTimebomber $gTimebombChannel
}
|
2) Fix or replace the existing proc StartTimeBomb to look more like this: | Code: |
proc StartTimeBomb {theStarter theNick theChannel} {
global gTimebombActive gTimebombTarget gTimerId gTimebombChannel gNumberNames gCorrectWire
global gMaxWireCount gTimebombMinimumDuration gTimebombMaximumDuration gTimebomber ;# <- change this line #
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. :-("
} else {
IRCAction $theChannel "points at the bulge in the back of $gTimebombTarget's pants."
}
} else {
set timerDuration [expr $gTimebombMinimumDuration + [expr int(rand() * ($gTimebombMaximumDuration - $gTimebombMinimumDuration))]]
set gTimebombTarget $theNick
set gTimebombChannel $theChannel
set gTimebomber $theStarter ;# <- add this line #
set numberOfWires 4 ;# <- change this line #
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 pants. The display reads \[\002$timerDuration\002\] seconds."
if { $numberOfWires == 1 } {
IRCPrivMSG $theChannel "Diffuse the bomb by cutting the correct wire. Type !cut <color> There is $wireCountAsEnglish wire. It is $wireListAsEnglish."
} else {
IRCPrivMSG $theChannel "Diffuse the bomb by cutting the correct wire. Type !cut <color> There are $wireCountAsEnglish wires. They are $wireListAsEnglish."
}
note "Timebomb started by $theStarter (Bomb handed to $theNick it will detonate in $timerDuration seconds)"
set gTimebombActive 1
set gTimerId [utimer $timerDuration "DetonateTimebomb 0 {\002*BOOM!*\002}"]
}
}
|
Goodluck _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
langer_hans Voice
Joined: 19 Feb 2015 Posts: 13
|
Posted: Sat Feb 21, 2015 3:32 pm Post subject: |
|
|
thanks,
i will try it! |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sat Feb 21, 2015 6:38 pm Post subject: |
|
|
ok, please let us know how you make out. _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
langer_hans Voice
Joined: 19 Feb 2015 Posts: 13
|
Posted: Sat Feb 21, 2015 6:42 pm Post subject: |
|
|
it doesnt work so far  |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sat Feb 21, 2015 7:34 pm Post subject: |
|
|
That's not a helpful explanation of what it is or isn't doing.
Please explain "doesnt work so far" _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
langer_hans Voice
Joined: 19 Feb 2015 Posts: 13
|
Posted: Sat Feb 21, 2015 7:37 pm Post subject: |
|
|
okay, i will explain it:
i tried it.
user1 bombed me (user2)
i defused the bomb.
nothing happend. no one got kicked, no additional bomb would played.
Last edited by langer_hans on Sat Feb 21, 2015 7:47 pm; edited 2 times in total |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sat Feb 21, 2015 7:45 pm Post subject: |
|
|
Expect maybe you messed up the edits...
Post a copy of the script as you have it now.
Open a dcc partyline window with the bot before you do the trigger.
Collect any errors that go there. _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
langer_hans Voice
Joined: 19 Feb 2015 Posts: 13
|
Posted: Sat Feb 21, 2015 7:48 pm Post subject: |
|
|
your right, i did a mistake at the edit!
i tried a new one:
i tried a new edit of the script.
i defused the bomb. then the bot said:
| Quote: | | points at the bulge in the back of user2s pants. |
edit:
no errors at the partyline |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sat Feb 21, 2015 7:49 pm Post subject: |
|
|
I see the issue I think, Please post the script as you have it now and I'll try to patch further. _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
langer_hans Voice
Joined: 19 Feb 2015 Posts: 13
|
Posted: Sat Feb 21, 2015 7:55 pm Post subject: |
|
|
is it possible to get a minimum time between a NEW BOMB?
i think 5min would be great. if there is no time it would be spammed
here is my actual script
| Code: | ###############################################################################
# Name: Timebomb
# Author: jotham.read@gmail.com
# Web Site: http://radiosaurus.sporkism.org
# Eggdrop Version: 1.6.x
# Description:
#
# 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>
# 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 <color>
# 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.
#
###############################################################################
bind pub - !bomb doTimebomb
bind pub - !cut doCutWire
###############################################################################
# Configuration
#
set gTimebombMinimumDuration 30
set gTimebombMaximumDuration 35
set gWireChoices "Red Blue Yellow Green Goldbrauneschnitzelpanade Pissgelb"
set gMaxWireCount 4
###############################################################################
# Internal Globals
#
set gTheScriptVersion "0.4"
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"
###############################################################################
proc note {msg} {
putlog "% $msg"
}
proc IRCKick {theNick theChannel theReason} {
note "Kicking $theNick in $theChannel (Reason: $theReason)"
putserv "KICK $theChannel $theNick :$theReason"
}
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
if { $destroyTimer } {
killutimer $gTimerId
}
set gTimerId 0
set gTimebombActive 0
IRCKick $gTimebombTarget $gTimebombChannel $kickMessage
}
proc DiffuseTimebomb {wireCut} {
global gTimerId gTimebombActive gTimebombTarget gTimebombChannel gTimebomber
killutimer $gTimerId
IRCPrivMSG $gTimebombChannel "$gTimebombTarget cut the $wireCut wire. This has defused the bomb!"
StartTimeBomb $gTimebombTarget $gTimebomber $gTimebombChannel
}
proc StartTimeBomb {theStarter theNick theChannel} {
global gTimebombActive gTimebombTarget gTimerId gTimebombChannel gNumberNames gCorrectWire
global gMaxWireCount gTimebombMinimumDuration gTimebombMaximumDuration gTimebomber ;# <- change this line #
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. :-("
} else {
IRCAction $theChannel "points at the bulge in the back of $gTimebombTarget's pants."
}
} else {
set timerDuration [expr $gTimebombMinimumDuration + [expr int(rand() * ($gTimebombMaximumDuration - $gTimebombMinimumDuration))]]
set gTimebombTarget $theNick
set gTimebombChannel $theChannel
set gTimebomber $theStarter ;# <- add this line #
set numberOfWires 4 ;# <- change this line #
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 pants. The display reads \[\002$timerDuration\002\] seconds."
if { $numberOfWires == 1 } {
IRCPrivMSG $theChannel "Diffuse the bomb by cutting the correct wire. Type !cut <color> There is $wireCountAsEnglish wire. It is $wireListAsEnglish."
} else {
IRCPrivMSG $theChannel "Diffuse the bomb by cutting the correct wire. Type !cut <color> There are $wireCountAsEnglish wires. They are $wireListAsEnglish."
}
note "Timebomb started by $theStarter (Bomb handed to $theNick it will detonate in $timerDuration seconds)"
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
set theNick $nick
if { [llength $arg] == 1 } {
set theNick [lindex [split $arg] 0]
}
if { [string tolower $theNick] == [string tolower $botnick] } {
set theNick $nick
IRCKick $theNick $chan "I will not tollerate this!"
return
}
if { [validuser $theNick] == 1 } {
if { [matchattr $theNick "+b"] == 1 } {
set theNick $nick
IRCKick $theNick $chan "I will not tollerate that!"
return
}
}
StartTimeBomb $nick $theNick $chan
}
###############################################################################
note "timebomb$gTheScriptVersion: loaded";
note " with $gMaxWireCount wire maximum,"
note " and time range of $gTimebombMinimumDuration to $gTimebombMaximumDuration seconds.";
|
|
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Sat Feb 21, 2015 8:12 pm Post subject: |
|
|
5 minutes! lol:)
Let's just try this...
| Code: |
###############################################################################
# Name: Timebomb
# Author: jotham.read@gmail.com
# Web Site: http://radiosaurus.sporkism.org
# Eggdrop Version: 1.6.x
# Description:
#
# 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>
# 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 <color>
# 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.
#
###############################################################################
bind pub - !bomb doTimebomb
bind pub - !cut doCutWire
###############################################################################
# Configuration
#
set gTimebombMinimumDuration 30
set gTimebombMaximumDuration 35
set gWireChoices "Red Blue Yellow Green Goldbrauneschnitzelpanade Pissgelb"
set gMaxWireCount 4
###############################################################################
# Internal Globals
#
set gTheScriptVersion "0.4"
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"
###############################################################################
proc note {msg} {
putlog "% $msg"
}
proc IRCKick {theNick theChannel theReason} {
note "Kicking $theNick in $theChannel (Reason: $theReason)"
puthelp "KICK $theChannel $theNick :$theReason"
}
proc IRCPrivMSG {theTarget messageString} {
puthelp "PRIVMSG $theTarget :$messageString"
}
proc IRCAction {theTarget messageString} {
puthelp "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
if { $destroyTimer } {
killutimer $gTimerId
}
set gTimerId 0
set gTimebombActive 0
IRCKick $gTimebombTarget $gTimebombChannel $kickMessage
}
proc DiffuseTimebomb {wireCut} {
global gTimerId gTimebombActive gTimebombTarget gTimebombChannel gTimebomber
killutimer $gTimerId
set gTimerId 0
set gTimebombActive 0
IRCPrivMSG $gTimebombChannel "$gTimebombTarget cut the $wireCut wire. This has defused the bomb!"
StartTimeBomb $gTimebombTarget $gTimebomber $gTimebombChannel
}
proc StartTimeBomb {theStarter theNick theChannel} {
global gTimebombActive gTimebombTarget gTimerId gTimebombChannel gNumberNames gCorrectWire
global gMaxWireCount gTimebombMinimumDuration gTimebombMaximumDuration gTimebomber ;# <- change this line #
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. :-("
} else {
IRCAction $theChannel "points at the bulge in the back of $gTimebombTarget's pants."
}
} else {
set timerDuration [expr $gTimebombMinimumDuration + [expr int(rand() * ($gTimebombMaximumDuration - $gTimebombMinimumDuration))]]
set gTimebombTarget $theNick
set gTimebombChannel $theChannel
set gTimebomber $theStarter ;# <- add this line #
set numberOfWires 4 ;# <- change this line #
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 pants. The display reads \[\002$timerDuration\002\] seconds."
if { $numberOfWires == 1 } {
IRCPrivMSG $theChannel "Diffuse the bomb by cutting the correct wire. Type !cut <color> There is $wireCountAsEnglish wire. It is $wireListAsEnglish."
} else {
IRCPrivMSG $theChannel "Diffuse the bomb by cutting the correct wire. Type !cut <color> There are $wireCountAsEnglish wires. They are $wireListAsEnglish."
}
note "Timebomb started by $theStarter (Bomb handed to $theNick it will detonate in $timerDuration seconds)"
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
set theNick $nick
if { [llength $arg] == 1 } {
set theNick [lindex [split $arg] 0]
}
if { [string tolower $theNick] == [string tolower $botnick] } {
set theNick $nick
IRCKick $theNick $chan "I will not tollerate this!"
return
}
if { [validuser $theNick] == 1 } {
if { [matchattr $theNick "+b"] == 1 } {
set theNick $nick
IRCKick $theNick $chan "I will not tollerate that!"
return
}
}
StartTimeBomb $nick $theNick $chan
}
###############################################################################
note "timebomb$gTheScriptVersion: loaded";
note " with $gMaxWireCount wire maximum,"
note " and time range of $gTimebombMinimumDuration to $gTimebombMaximumDuration seconds.";
|
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
langer_hans Voice
Joined: 19 Feb 2015 Posts: 13
|
Posted: Sun Feb 22, 2015 7:45 am Post subject: |
|
|
yeah 5min pause between a NEW bomb. i explain it:
[11:11]user1: !bomb user2
[11:11]Bot: user2 you have to defuse the bomb, !cut red, blue, green, yellow
[11:11]user2: !cut red
[11:11]Bot: your wrong -> kick user2
[11:12]user2: !bomb user1
[11:12]Bot: you have to wait - i have to build a new bomb first.
[11:16]user2: !bomb user1
[11:16]Bot: user1 you have to defuse the bomb, !cut red, blue, green, yellow
______________
i tried your new script - it works so far. thanks a lot!
is it possible to protect users from a bomb? i dont want: !bomb Bot
suicide bomb  |
|
| Back to top |
|
 |
|