This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Tournament help please??

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
m
monie089
Halfop
Posts: 76
Joined: Sat Jul 29, 2006 11:13 pm

Tournament help please??

Post by monie089 »

Code: Select all

##########Binds #########
bind pub - @Tournament Tourneycmd ;#done
bind pub - @Tversion Tourneyversion ;#done
bind pub - @tinfo Tourneyinfo ;#done
bind pub - @join Tourneyjoin  
bind pub n @tupdate Tourney_writeCFG ;#done
bind pub - @find find:nick ;#done
bind pub - @add pub:add ;#done
bind pub n|o @start Tourneyinit
bind pub n|o @end Tourneyend
bind pub - @request Tourneyrequest
bind pub - @terror Tourneyerror
bind pub n @noticeon Tourneynoticeon ;#done
bind pub n @noticeoff Tourneynoticeoff ;#done
bind pub n @topicon Tourneytopicon
bind pub n @topicoff Tourneytopicoff
bind msg - won Tourneywon
bind msg - tie Tourneytie
bind msg - lose Tourneylose

##Unbinding commands##
proc Tourneyunbindcmd {} {
catch {unbind pub - @join Tourneyjoin}
catch {unbind pub - win Tourneywon}
catch {unbind pub - tie Tourneytie}
catch {unbind pub - lose Tourneylose}
}



##The Tournament Menu###
proc Tourneycmd {nick uhost hand chan text} {
global Tourneychan cmd1 cmd2 cmd3 cmd4 cmd5 cmd6 cmd7 cmd8 cmd10 cmd11 cmd12 cmd13
puthelp "NOTICE $nick :$cmd1"
puthelp "NOTICE $nick :$cmd2"
puthelp "NOTICE $nick :$cmd3"
puthelp "NOTICE $nick :$cmd4"
puthelp "NOTICE $nick :$cmd5"
puthelp "NOTICE $nick :$cmd6"
if {[isop $nick $Tourneychan]} {
puthelp "NOTICE $nick :$cmd7"
}
if {[isop $nick $Tourneychan]} {
puthelp "NOTICE $nick :$cmd8"
}
puthelp "NOTICE $nick :$cmd10"
puthelp "NOTICE $nick :$cmd11"
puthelp "NOTICE $nick :$cmd12"
puthelp "NOTICE $nick :$cmd13"
return
}


##The Joining Info##
bind join - "% *" join:foo
proc join:foo {nick uhost hand chan} {
global Tourneynotice Tourneychan Tourneybot Tourneyon
set _msg ""
if {$Tourneynotice == 1} {
putquick "NOTICE $nick :Welcome to $chan im $Tourneybot Tournament status is currently:"
if {$Tourneyon == 1} { putquick "NOTICE $nick :\002On\002"} else { putquick "NOTICE $nick :\002Off\002" }
}
if {$Tourneynotice == 0} {return}
}

##Adding the Settings to the config##
proc Tourney_writeCFG {nick uhost hand chan text} {
global Tourneychan Tourneycmdchar Tourneybot Tourneyfile Tourneyversion gamefile TourneyCFGfile
set f [open $TourneyCFGfile w]
puts $f "#The MLB Tournament Config file"
puts $f "Tournament Channel=$Tourneychan"
puts $f "Tournament Char=$Tourneycmdchar"
puts $f "Tournament Bot name=$Tourneybot"
puts $f "Game File dir=$gamefile"
puts $f "Tourney File dir=$Tourneyfile"
puts $f "Tourney Version=$Tourneyversion"
close $f
putquick "PRIVMSG $Tourneychan :\002Notice:\002 The Tournament Script is currently updating please wait until its done"
puthelp "PRIVMSG $Tourneychan :Done updating."
return
}

##Showing the Tournament Version##
proc Tourneyversion {nick uhost hand chan text} {
global Tourneybot Tourneychan Tourneyversion Towner
puthelp "NOTICE $nick :$Tourneybot current Tournament version is $Tourneyversion for $Tourneychan by $Towner"
}


######Default Settings######
set Tourneynotice 0
set Tourneytopic 0
set Tourneyon 0
set TourneyIDX ""
set Towner "Monie"
set Trounduser ""
set Tourneychan "#NintendoXG"
set Tourneybot "MLB"
set Tourneycmdchar "@"
set gamefile "wifi/game.txt"
set Tourneyfile "wifi/tourney.txt"
set Tourneyversion "0.1.2"
set TourneyCFGfile "wifi/TourneyCGF.cgf"
set cmd1 "\002Tournament commands for #NintendoXG are\002"
set cmd2 "\0031@Tournament - Lets you see these Tourney options"
set cmd3 "\0031@tinfo - Lets you see the current tournament status\0031"
set cmd4 "\0031@find && @add -Lets you either find a nicks code or add your code to the tourey system\0031"
set cmd5 "\0031@request -You can send an Tournament request ,Then you can see that either an op will make it or the bot\0031"
set cmd6 "\0031@terror - You may send Problems that your having with the tournament by typing that or msg monie straight up\0031"
set cmd7 "\002Notice:\002 Ops have the following commands,also regular users cant see this"
set cmd8 "\0031@start -Ops can start the Tournament for any game\0031 \0031@end -Ops can end any tounament thats currently happening,but if its Monie the bot will not let you\0031"
set cmd10 "\0031To tell when you have won or lost or have a tie please type\0031"
set cmd11 "\0031/msg MLB won - Lets MLB know that you won\0031"
set cmd12 "\0031/msg MLB lose - Lets MLB know that you lose\0031"
set cmd13 "\0031/msg MLB tie -Lets MLB know that you had a tie\0031"
set Unplayedrounds 0



#####Global variables########
set Tourneymode 0
set Tourneyplayers 0
set Tourneyplayers 0
set Tourneystarttime [unixtime]
set Tourneyon 0
set Tourneystart 25
set Tourneycycletimer 25
set Tourneycycletime 30
set Tourneystopafter 5
set Tourneymax 4
set Tourneymode 0
###Scores and Ads
set Tourneywon "Nobody 0"
set Tourneyad 0

##File Checking##
if {![file exist $Tourneyfile]} {
catch {close [open $Tourneyfile w]}
}
if {![file exists $gamefile]} {
   catch {close [open $gamefile w]}
}
if {![file exist $TourneyCFGfile]} {
catch {close [open $TourneyCFGfile w]}
}

##Friendcodes section###
proc pub:add {nick uhost hand chan arg} {
   foreach {game code} [split $arg] {break}
  if {![string length $game] || ![string length $code]} {
      putserv "PRIVMSG $nick :Usage: @add <game> <code>"; return
   }
 set list [split [read [set fd [open $::gamefile r]]] \n]; close $fd
  if {![llength [lindex $list end]]} {
      set list [lreplace $list end end]
   }
   lappend list [list [md5 [string tolower $nick]] $game $code]
   puts -nonewline [set fd [open $::gamefile w]] [join $list \n]; close $fd
   putserv "NOTICE $nick :Code added"
}
proc find:nick {nick uhost hand chan arg} {
   set name [lindex [split $arg] 0]
   if {![string length $name]} {
      putserv "NOTICE $nick :Usage: @find <nick>"; return
   }
   set list [split [read [set fd [open $::gamefile r]]] \n]; close $fd
  if {![llength [set matches [lsearch -all -inline -glob $list [md5 [string tolower $name]]*]]]} {
      putserv "NOTICE $nick :Name not found."; return
   }
  foreach match $matches {
     foreach {x game code} $match {}
      putserv "NOTICE $nick :$name's code for $game is $code."
   }  
}

##Enabling and Disabling##
proc Tourneynoticeon {nick uhost hand chan text} {
global Tourneychan Tourneynotice Tourneybot
if {$Tourneynotice == 1} {
puthelp "PRIVMSG $Tourneychan :\002Notice:\002 Tournament Notice is already enabled"
}
if {$Tourneynotice == 0} { 
set Tourneynotice 1
puthelp "PRIVMSG $Tourneychan :\002Notice:\002 Tournament Notice is Now enabled"
}
}
proc Tourneynoticeoff {nick uhost hand chan text} {
global Tourneychan Tourneynotice Tourneybot
if {$Tourneynotice == 0} {
puthelp "PRIVMSG $Tourneychan :\002Notice:\002 Tournament Notice is already disabled"
}
if {$Tourneynotice == 1} {
set Tourneynotice 0 
puthelp "PRIVMSG $Tourneychan :\002Notice:\002 Tournament Notice is now disabled"
}
}

##The Matching and Challenge part###
proc Tourneyinit {nick uhost hand chan text} {
global Tourneychan Tourneybot Trounduser Tourneyon
if {($Tourneyon > 0)} {return}
set game [lindex $text 0]
putquick "PRIVMSG $Tourneychan :\00304\[\002$nick\!$uhost\00304\]\00304"
putquick "PRIVMSG $Tourneychan :Tournament for $game started"
set Tourneyon 1
Tourneyunbindcmd
Tourneypick
return
}
#Initializing the new game :)#
proc Tourneypick {nick uhost hand chan text} {
global Tourneychan Tourneyon Trounduser Tourneyversion Towner Tourneystart
putquick "PRIVMSG $Tourneychan :\00304$Tourneyversion by \002$Towner"
putquick "PRIVMSG $Tourneychan :Type @Join to Join the current Tournament - You have $Tourneystart seconds to join"
set Tourneystarttimer [utimer $Tourneystart Tourneybegin]
return
}
##Starting the Tournament##
proc Tourneybegin {nick uhost hand chan text} {
global Tourneychan Trounduser Towner Tourneystart Tourneyon Tourneyplayers
global Tourneystarttimer Tourneycycle game Tourneycycle Unplayedrounds
if {$Tourneyon == 0} {return}
if {[llength $Trounduser] == 4]} {

putquick "PRIVMSG $Tourneychan :Tournament for $game is Now full"
putquick "PRIVMSG $Tourneychan :Welcome we have $Tourneyplayers for $game Tournament Names are:$Trounduser"
return
}
Tourneycycle
return
}
proc Tourneycycle {nick uhost hand chan text} {
global Tourneychan Trounduser Towner Tourneystart Tourneyon
global Tourneystarttimer Tourneycycle game Tourneycycle Unplayedrounds
global Tourneymax Tourneymode
if {$Tourneyon == 0} {return}
set Tourneymode 4
set AdTime [expr $Tourneycycletime /2]
 set TourneyAdTimer [utimer $AdTime TourneyScoreAdvertise]
 set Tourneycycletimer [utimer $Tourneycycletime UnoNext]
 return
 }
 proc Tourneyjoin {nick uhost hand chan text} {
 global Tourneychan Tourneymode game Trounduser Tourneymax Tourneyplayers TourneyIDX
 if {($chan != $Tourneychan) ||($Tourneymode < 1)||($Tourneymode > 2)} {return}
 if {[llength $Trounduser] == $Tourneymax} {
 putquick "NOTICE $nick :We currently have $Tourneymax users please try again when the tourney is over"
 return
 }
 set pcount 0
while {[lindex $Trounduser $pcount] !=""} {
if {[lindex $Trounduser $pcount] == $nick} {
return
}

incr pcount
}

incr Tourneyplayers

lappend Trounduser $nick
lappend TourneyIDX $nick
putquick "PRIVMSG $Tourneychan :\00304[$nick]\00304 Joins Tournament:$game"
puthelp "NOTICE $nick :You may now leave a rating for your oppenets to see how skilled they are and if they have cheated or not,Just type @rate <nick> or @view rate <nick>"
}
I need some help for the @join part and after 30 seconds make it randomly mix the names and out put like
monie vs bob or something please help ??
New server irc.NintendoXG.com come and visit
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

When you learn how to indent your code, I'll think about actually reading it to help.
Post Reply