Code: Select all
##########################################
## ##
## Author: Justdabomb2 ##
## Script: High Low ##
## Version: v1.0 ##
## Date: 10/12/2006 ##
## ##
## Thanks for the great ##
# suggestions Rolcol! ##
## ##
##########################################
############################################################
## Set this to the highest number your bot can pick from. ##
############################################################
set highestnumber "999"
######################################################################
## Random messages the bot will use when you get the correct guess. ##
######################################################################
set correctmsgs {
"Good job!"
"Congratulations!"
"Wowzers!"
"Great Guess!"
"Good work!"
"Outstanding!"
"Now win again!"
}
#########################################################################
## Random messages your bot will use when you make an incorrect guess. ##
#########################################################################
set incorrectmsgs {
"Sorry"
"Too bad,"
"Try again,"
"Incorrect guess,"
"Keep trying"
}
######################################################
## You don't need to edit anything below this line. ##
######################################################
set hlinuse 0
set correctnumber ""
set hlcreator "Justdabomb2"
set hlturnedoff "High Low has been turned off by"
set hlnoton "9High Low1 is not currently on."
set hlalreadyoff "9High Low1 is already off."
set hlinvalidguess "Your guesses must be bewteen3,1 1 0,1and7,1"
set hlalreadyon "9High Low1 is already on."
set hlnumberstoguess "1The numbers vary from3 1 1to7"
set hlturnedon "9High Low14 has been turned on by"
set hlcommand "Type !guess <number>"
bind pub - !hlon hl:on
bind pub - !guess hl:guess
bind pub - !hloff hl:off
proc hl:on {nick uhost hand chan args} {
global hlinuse correctnumber hlcreator hlalreadyon highestnumber hlturnedon hlcommand hlnumberstoguess
if { $hlinuse == 0 } {
set hlinuse 1
set correctnumber [rand $highestnumber]
putquick "PRIVMSG $chan :9,1High Low8,14 By: $hlcreator"
putquick "PRIVMSG $chan :$hlturnedon 10$nick14. $hlcommand to guess a number."
putquick "PRIVMSG $chan :$hlnumberstoguess $highestnumber1."
} else {
putquick "PRIVMSG $chan :$hlalreadyon"
}
}
proc hl:guess {nick uhost hand chan args} {
global hlinuse correctnumber highestnumber hlnoton hlinvalidguess correctmsgs incorrectmsgs hlcommand
set correctmsg [lindex $correctmsgs [rand [llength $correctmsgs]]]
set incorrectmsg [lindex $incorrectmsgs [rand [llength $incorrectmsgs]]]
if { $hlinuse == 1 } {
set guess [lindex $args 0]
if { [string tolower $guess] == [string tolower $correctnumber] } {
set hlinuse 0
putquick "PRIVMSG $chan :10$nick13 got the correct guess of 12$correctnumber13. $correctmsg"
}
if { [string tolower $guess] > [string tolower $correctnumber] } {
putquick "PRIVMSG $chan :7$incorrectmsg 10$nick7. Your guess of $guess was too high. Try a lower number."
}
if { [string tolower $guess] < [string tolower $correctnumber] } {
putquick "PRIVMSG $chan :3$incorrectmsg 10$nick3. Your guess of $guess was too low. Try a higher number."
}
if { [string tolower $guess] > [string tolower $highestnumber] } {
putquick "NOTICE $nick :0,1$hlinvalidguess $highestnumber."
}
} else {
putquick "PRIVMSG $chan :1Sorry 10$nick,1 $hlnoton"
}
if {$guess == ""} {
putquick "NOTICE $nick :0,1$hlcommand"
}
}
proc hl:off {nick uhost hand chan args} {
global hlinuse hlturnedoff hlalreadyoff
if { $hlinuse == 1 } {
set hlinuse 0
putquick "PRIVMSG $chan :4$hlturnedoff 10$nick."
} else {
putquick "PRIVMSG $chan :1Sorry 10$nick,1 $hlalreadyoff"
}
}
putlog "Justdabot's High Low Script Loaded"
Code: Select all
if {something} {
do this (1 tab)
} else {
do that (1 tab)
if {something else} {
so forth and so on (2 tabs)
}
}
IMO, that's way too many spaces.rosc2112 wrote:Code: Select all
if {something} { do this (1 tab) } else { do that (1 tab) if {something else} { so forth and so on (2 tabs) } }
Code: Select all
if {something} {
do this (2 spaces)
} else {
do that (2 spaces)
if {something else} {
so forth and so on (4 spaces)
}
}
Umm, I already know how to use those, but I edit my scripts in mIRC script editor becuase I was too lazy to uninstall that client and then I got an eggdrop and the script editor helps me a lot, with spacing, and replacing text. So it's easiest for me to just use the ctrl+commands, sorry. Next scripts that I share I will use the editor to replace those.Alchera wrote:Colour and formatting codes
Justdabomb2: Following the above guide you will be able to fix your script.
Code: Select all
##########################################
## ##
## Author: Justdabomb2 ##
## Script: High Low ##
## Version: v1.0 ##
## Date: 10/16/2006 ##
## ##
## Thanks for the great ##
# suggestions Rolcol! ##
## ##
##########################################
#######################################################################
## Set this to the highest number you want to be able to guess from. ##
#######################################################################
set highestnumber "100000"
###################################################################
## Set this to the lowest number you want to be able guess from. ##
###################################################################
set lowestnumber "10"
######################################################################
## Random messages the bot will use when you get the correct guess. ##
######################################################################
set correctmsgs {
"Good job!"
"Congratulations!"
"Wowzers!"
"Great Guess!"
"Good work!"
"Outstanding!"
"Now win again!"
}
#########################################################################
## Random messages your bot will use when you make an incorrect guess. ##
#########################################################################
set incorrectmsgs {
"Sorry"
"Too bad,"
"Try again,"
"Incorrect guess,"
"Keep trying"
}
######################################################
## You don't need to edit anything below this line. ##
######################################################
set hlinuse 0
set numbertouse ""
set correctnumber ""
set hlcreator "Justdabomb2"
set hlturnedoff "High Low has been turned off by"
set hlnoton "\0039High Low\0031 is not currently on."
set hlalreadyoff "\0039High Low\0031 is already off."
set hlinvalidguess "Your guesses must be bewteen"
set hlinvalidnumber "Please use a number between"
set hlalreadyon "\0039High Low\0031 is already on."
set hlnumberstoguess "\0031The numbers vary from\0033 \0021\002 \0031to\0037"
set hlturnedon "\0039High Low\00314 has been turned on by"
set hlguesscommand "Type \002!guess <number>\002"
set hlcommand "Type \002!hl on <highest number>.\002"
set hloncommand "on"
set hloffcommand "off"
bind pub - !hl hl:activate
bind pub - !guess hl:guess
proc hl:activate {nick uhost hand chan arg} {
global hlinuse correctnumber hlcreator hlalreadyon numbertouse highestnumber lowestnumber hlturnedon hlcommand hlguesscommand hlnumberstoguess hloncommand hloffcommand hlturnedoff hlalreadyoff hlinvalidnumber
set command [lindex $arg 0]
if {$command == ""} {
putquick "NOTICE $nick :\0030,1Type $hlcommand"
}
if {[string tolower $command] == [string tolower $hloncommand]} {
if { $hlinuse == 0 } {
set numbertouse [lindex $arg 1]
if {[string tolower $numbertouse] < [string tolower $lowestnumber]} {
putquick "NOTICE $nick :\0030,1I won't use that number, it is too low. $hlinvalidnumber $lowestnumber and $highestnumber."
return
}
if {[string tolower $numbertouse] > [string tolower $highestnumber]} {
putquick "NOTICE $nick :\0030,1I won't use that number, it is too high. $hlinvalidnumber $lowestnumber and $highestnumber."
return
}
if {$numbertouse == ""} {
putquick "NOTICE $nick :\0030,1Type $hlcommand"
} else {
set hlinuse 1
set correctnumber [rand $numbertouse]
putquick "PRIVMSG $chan :\0039,1High Low\0038,14 By: $hlcreator"
putquick "PRIVMSG $chan :$hlturnedon \00310$nick\00314. $hlguesscommand to guess a number."
putquick "PRIVMSG $chan :$hlnumberstoguess \002$numbertouse\002\0031."
}
} else {
putquick "PRIVMSG $chan :$hlalreadyon"
}
}
if {[string tolower $command] == [string tolower $hloffcommand]} {
if { $hlinuse == 1 } {
set hlinuse 0
set numbertouse ""
putquick "PRIVMSG $chan :\0034$hlturnedoff \00310$nick."
} else {
putquick "PRIVMSG $chan :\0031$hlalreadyoff"
}
}
}
proc hl:guess {nick uhost hand chan args} {
global hlinuse correctnumber numbertouse hlnoton hlinvalidguess correctmsgs incorrectmsgs hlguesscommand lowestnumber
set correctmsg [lindex $correctmsgs [rand [llength $correctmsgs]]]
set incorrectmsg [lindex $incorrectmsgs [rand [llength $incorrectmsgs]]]
if { $hlinuse == 1 } {
set guess [lindex $args 0]
if { [string tolower $guess] == [string tolower $correctnumber] } {
set hlinuse 0
putquick "PRIVMSG $chan :\00310$nick\00313 got the correct guess of \002\00312$correctnumber\00313\002. $correctmsg"
}
if { [string tolower $guess] > [string tolower $correctnumber] } {
putquick "PRIVMSG $chan :\0037$incorrectmsg \00310$nick\0037. Your guess of \002$guess\002 was too \002high\002. Try a lower number."
}
if { [string tolower $guess] < [string tolower $correctnumber] } {
putquick "PRIVMSG $chan :\0033$incorrectmsg \00310$nick\0033. Your guess of \002$guess\002 was too \002low\002. Try a higher number."
}
if { [string tolower $guess] > [string tolower $numbertouse] } {
putquick "NOTICE $nick :\0030,1$hlinvalidguess \0033,1 \002$lowestnumber\002 \0030,1and\0037,1 \002$numbertouse\002."
}
} else {
putquick "PRIVMSG $chan :\0031Sorry \00310$nick,\0031 $hlnoton"
}
if {$guess == ""} {
putquick "NOTICE $nick :\0030,1$hlguesscommand"
}
}
putlog "Justdabot's High Low Script Loaded"
Tcl scripts should be saved using UTF-8 encoding i.e. no weird end of line characters being added.Justdabomb2 wrote:Umm, I already know how to use those, but I edit my scripts in mIRC script editor becuase I was too lazy to uninstall that client and then I got an eggdrop and the script editor helps me a lot, with spacing, and replacing text. So it's easiest for me to just use the ctrl+commands, sorry. Next scripts that I share I will use the editor to replace those.Alchera wrote:Colour and formatting codes
Justdabomb2: Following the above guide you will be able to fix your script.