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.

need help with a cupbot !add !remove and !whois system

Old posts that have not been replied to for several years.
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

need help with a cupbot !add !remove and !whois system

Post by r0t3n »

Ok, i have made the script now, it works, but now im at the stage of making the !add !remove and !whois team system. Can anyone give me any ideas who to store the team information like teamname and the nicknames of the people in that team. Also any ideas how to go with the !whois and !remove system aswell, i guess i can use a [string match *teamname* $blah] or something, please just give me your ideas. Also, if someone parts a channel, how can i search the teams to see if that person is in a team, and if they part, the bot deletes that team from the cup because of that person parted the channel. Please help, not asking for you to write the script, just your ideas.

Thanks in advance!!
r0t3n @ #r0t3n @ Quakenet
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

you are in dire need to learn how to manipulate Tcl lists

obviously, your teams need to be represented with lists, and you should know how to add, delete, and replace list element(s)
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

Hmm, i dont know much about lists. But, i guess i use:

list - to create the new list
linsert - to insert the elements
lreplace - to replace any elements
lsearch - to search the list

Thats al i know, i dint know how to use all of them. Could you please help me with these commands.

lsearch -exact *$text* $list - would that work. Please help

Thanks in advance!!
r0t3n @ #r0t3n @ Quakenet
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Read lsearch.
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

ok, i read lsearch, but dont understand what the script would look like.

Code: Select all

bind pub - !add cup:add

proc cup:add {nick host hand chan text} {
if {![channel get $chan "cup"]} {
putserv "PRIVMSG $chan :Error: $nick there is no cup runnnig."
} elseif {[channel get $chan "cup"]} {
set teamname [lindex [split $text] 5]
set p1 [lindex [split $text] 1]
set p2 [lindex [split $text] 2]
set p3 [lindex [split $text] 3]
set p4 [lindex [split $text] 4]
if {([channel get $chan "s_cup_type"] == 5on5)} {
blah
} elseif 4on4 2on3 2on2 1on1 etc {
blah
} else {
list $teamname $nick $p1 $p2 $p3 $p4
putserv "PRIVMSG $chan :$nick signed up $p1 & $2 & $p3 & $p4 as team: $teamname."
}
}

Would that work, please help

Thanks in advance!! im a nuub and list operations! 
r0t3n @ #r0t3n @ Quakenet
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

Also, can anyone tell me why this script says i have no access, even when i have given myself the global and channel +C flag for cupadmin.

Code: Select all

proc cup:start {nick host hand chan text} {
if {[matchattr $hand C|C $chan]} {
if {[channel get $chan "cup"]} {
putserv "PRIVMSG $chan :Error: Cup is already running."
} elseif {![channel get $chan "cup"]} {
set cup(slots,$chan) [lindex [split $text] 1]
set cup(type,$chan) [lindex [split $text] 0]
set cup(prize,$chan) [join [lrange [split $text] 2 end]]
if {($cup(type,$chan) != "5on5") && ($cup(type,$chan) != "4on4") && ($cup(type,$chan) != "3on3") && ($cup(type,$chan) != "2on2") && ($cup(type,$chan) != "1on1") && ($cup(type,$chan) == "")} {
putserv "NOTICE $nick :Error: Please enter a correct cup type. ( 5on5 or 4on4 or 3on3 or 2on2 or 1on1 )"
} elseif {($cup(slots,$chan) != "4") && ($cup(slots,$chan) != "8") && ($cup(slots,$chan) != "16") && ($cup(slots,$chan) != "32") && ($cup(slots,$chan) == "")} {
putserv "NOTICE $nick :Error: Please enter a correct slot entry. ( 4 or 8 or 16 or 32 )"
} elseif {($cup(prize,$chan) == "")} {
putserv "NOTICE $nick Error: Please enter a prize. ( prize can be anything )"
} else {
channel set $chan +cup
channel set $chan s_cup_slots $cup(slots,$chan) 
channel set $chan s_cup_type $cup(type,$chan) 
channel set $chan s_cup_prize $cup(prize,$chan) 
channel set $chan s_cup_teams 0
channel set $chan s_cup_admin $nick
channel set $chan s_cup_HLTV None set
channel set $chan s_cup_maps de_dust2
putserv "PRIVMSG $chan :The $chan [channel get $chan "s_cup_type"] is now on with [channel get $chan "s_cup_slots"] slots."
putserv "PRIVMSG $chan :Your admin is [channel get $chan "s_cup_admin"] and the map is [channel get $chan "s_cup_maps"]."
putserv "PRIVMSG $chan :Bot by #cupcentrum join to request your bot."
} else {
putserv "NOTICE $nick :Error: you do not have access to this command."
}   
}
}
} 
Thanks in advance!!
r0t3n @ #r0t3n @ Quakenet
User avatar
YooHoo
Owner
Posts: 939
Joined: Thu Feb 13, 2003 10:07 pm
Location: Redwood Coast

Post by YooHoo »

Tosser^^ wrote:Also, can anyone tell me why this script says i have no access, even when i have given myself the global and channel +C flag for cupadmin.
does the bot recognizes your hostmask?
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

i think i found the error:

Code: Select all

if {[matchattr $hand C|C $chan]} { 
should be

Code: Select all

if {[matchattr $hand |C $chan]} { 
Otherwise it means you need global and channel flag +C
r0t3n @ #r0t3n @ Quakenet
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Actually, that would return 1 if you have a global C flag or a $chan C flag. (the first if statement)
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

so, whats the error then Sir_Fz if you dont mind helping me ;p
r0t3n @ #r0t3n @ Quakenet
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

First, try to have a nice format in your scripts. Read this post from the 'Tip of the day' topic.
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

ok. But Sir_Fz i dont understand. What is the error. Are you saying its a layout error, bracket error or script error?
r0t3n @ #r0t3n @ Quakenet
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

No, I'm saying write your code in a good format so we would want to help you.
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

ok. Thanks Sir_Fz ill do that tomorrow
r0t3n @ #r0t3n @ Quakenet
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

ok, here we are Sir_Fz the script is sorted and ready for you

Code: Select all

proc cup:start {nick host hand chan text} {
  if {[matchattr $hand |C $chan]} {
    if {[channel get $chan "cup"]} {
      putserv "PRIVMSG $chan :Error: Cup is already running."
      } elseif {![channel get $chan "cup"]} {
      set cup(slots,$chan) [lindex [split $text] 1]
      set cup(type,$chan) [lindex [split $text] 0]
      set cup(prize,$chan) [join [lrange [split $text] 2 end]]
      if {($cup(type,$chan) != "5on5") && ($cup(type,$chan) != "4on4") && ($cup(type,$chan) != "3on3") && ($cup(type,$chan) != "2on2") && ($cup(type,$chan) != "1on1") && ($cup(type,$chan) == "")} {
        putserv "NOTICE $nick :Error: Please enter a correct cup type. ( 5on5 or 4on4 or 3on3 or 2on2 or 1on1 )"
        } elseif {($cup(slots,$chan) != "4") && ($cup(slots,$chan) != "8") && ($cup(slots,$chan) != "16") && ($cup(slots,$chan) != "32") && ($cup(slots,$chan) == "")} {
        putserv "NOTICE $nick :Error: Please enter a correct slot entry. ( 4 or 8 or 16 or 32 )"
        } elseif {($cup(prize,$chan) == "")} {
        putserv "NOTICE $nick Error: Please enter a prize. ( prize can be anything )"
        } else {
        channel set $chan +cup
        channel set $chan s_cup_slots $cup(slots,$chan) 
        channel set $chan s_cup_type $cup(type,$chan) 
        channel set $chan s_cup_prize $cup(prize,$chan) 
        channel set $chan s_cup_teams 0
        channel set $chan s_cup_admin $nick
        channel set $chan s_cup_HLTV None set
        channel set $chan s_cup_maps de_dust2
        putserv "PRIVMSG $chan :The $chan [channel get $chan "s_cup_type"] is now on with [channel get $chan "s_cup_slots"] slots."
        putserv "PRIVMSG $chan :Your admin is [channel get $chan "s_cup_admin"] and the map is [channel get $chan "s_cup_maps"]."
        putserv "PRIVMSG $chan :Bot by #cupcentrum join to request your bot."
        } else {
        putserv "NOTICE $nick :Error: you do not have access to this command."
      }   
    }
  }
}   
i sorted out the layout.
r0t3n @ #r0t3n @ Quakenet
Locked