| View previous topic :: View next topic |
| Author |
Message |
rt Voice
Joined: 08 Jul 2005 Posts: 25
|
Posted: Tue Feb 14, 2006 3:08 pm Post subject: Gather script. |
|
|
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 |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Tue Feb 14, 2006 11:35 pm Post subject: |
|
|
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] tag when posting logs, code |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Wed Feb 15, 2006 10:51 am Post subject: |
|
|
Simply create an array for teams A and B
| Code: | 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: | if {[llength $teams(A)] < 5} {
# we can add
} |
to choose randomly between A and B
| Code: | | set team [lindex {A B} [rand 2]] |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
metroid Owner
Joined: 16 Jun 2004 Posts: 771
|
Posted: Wed Feb 15, 2006 1:01 pm Post subject: |
|
|
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. |
|
| Back to top |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Wed Feb 15, 2006 1:05 pm Post subject: |
|
|
ok
| Code: | 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
} |
_________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
|