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.

Gather script.

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
r
rt
Voice
Posts: 25
Joined: Fri Jul 08, 2005 4:00 pm

Gather script.

Post by rt »

Hi, could someone make these 3 commands please?

!add - !remove - !teams

!add - You can either !add or !add a/b - It'll randomlly pick you in a team if you don't type anything but !add - Providing the team randomly picked doesn't have 5 players it'll add it, else it'll add it to the other team, and !add a/b will add them providing the team is not full, itll tell them if full. When both teams are full it'll announce it in the channel and unset the vars(I wil sort the rest)

!remove - will remove you from a/b if they are in.

!teams - will do
[bot] Team 1: nick - nick - nick - untaken(for eg.) - nick Team 2: etc...

So basicially it'll list teams.

I can give you a bouncer if nessesary, would really appreciate it - I'm too confused to do it myself
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

didn't you already ask for such thing couple of months ago?
connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use

Code: Select all

 tag when posting logs, code
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Simply create an array for teams A and B

Code: Select all

array set teams {
 A {}
 B {}
}
and lappend to it on !add, lreplace on !delete and show on !list. Always check if the list is full by using [llength], example:

Code: Select all

if {[llength $teams(A)] < 5} {
 # we can add
}
to choose randomly between A and B

Code: Select all

set team [lindex {A B} [rand 2]]
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

I wouldn't choose randomly because that will lead to the bot adding more than 5 users on 1 team.

I would just check if A has less players than B, if it does, add to A, if it doesn't, add to B.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

ok

Code: Select all

if {[llength $teams(A)] < [llength $teams(B)]} {
 set team A
} elseif {[set size [llength $teams(A)]] == [llength $teams(B)] && $size < 5} {
 set team [lindex {A B} [rand 2]]
} {
 set team B
}
Post Reply