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 

Tournament help please??

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
monie089
Halfop


Joined: 29 Jul 2006
Posts: 76

PostPosted: Sun Sep 10, 2006 2:50 pm    Post subject: Tournament help please?? Reply with quote

Code:

##########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
Back to top
View user's profile Send private message Send e-mail
rosc2112
Revered One


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

PostPosted: Mon Sep 11, 2006 7:07 pm    Post subject: Reply with quote

When you learn how to indent your code, I'll think about actually reading it to help.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
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