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 

Gather script.

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


Joined: 08 Jul 2005
Posts: 25

PostPosted: Tue Feb 14, 2006 3:08 pm    Post subject: Gather script. Reply with quote

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
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Tue Feb 14, 2006 11:35 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Wed Feb 15, 2006 10:51 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Wed Feb 15, 2006 1:01 pm    Post subject: Reply with quote

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
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Wed Feb 15, 2006 1:05 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
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