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.
Old posts that have not been replied to for several years.
bobjuh
Master
Posts: 268 Joined: Wed Oct 03, 2001 8:00 pm
Location: Netherlands
Contact:
Post
by bobjuh » Mon Jun 30, 2003 3:57 pm
I have
This tcl script but here is a problem.
when there are Let's say 2 users in the bot 1 user a with global owner flags and the second user, user b with global master flags.
When a user joins the partyline you get
"1 owners, 2 masters, 2 ops and 0 bots [ 2 users ]"
I want it to say that there's 1 owner and 1 master.
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Mon Jun 30, 2003 8:03 pm
Make it check all the flags in descending order for each user only once...
Code: Select all
foreach user [userlist] {
if {[matchattr $user n]} {
incr n
} elseif {[matchattr $user m]} {
} etc...
}
egghead
Master
Posts: 481 Joined: Mon Oct 29, 2001 8:00 pm
Contact:
Post
by egghead » Tue Jul 01, 2003 2:26 am
user wrote: Make it check all the flags in descending order for each user only once...
Code: Select all
foreach user [userlist] {
if {[matchattr $user n]} {
incr n
} elseif {[matchattr $user m]} {
} etc...
}
And add "continue" statements, so that once a match is found the iteration jumps to the next user.
bobjuh
Master
Posts: 268 Joined: Wed Oct 03, 2001 8:00 pm
Location: Netherlands
Contact:
Post
by bobjuh » Tue Jul 01, 2003 4:25 am
Tnx it worked
Last edited by
bobjuh on Tue Jul 01, 2003 11:06 am, edited 2 times in total.
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Tue Jul 01, 2003 8:37 am
egghead wrote: And add "continue" statements, so that once a match is found the iteration jumps to the next user.
No need for that...tcl will do no more work in the if structure after one statement is true.
egghead
Master
Posts: 481 Joined: Mon Oct 29, 2001 8:00 pm
Contact:
Post
by egghead » Tue Jul 01, 2003 5:36 pm
user wrote: egghead wrote: And add "continue" statements, so that once a match is found the iteration jumps to the next user.
No need for that...tcl will do no more work in the if structure after one statement is true.
You are right! A mistake I made before on this forum. Prolly because of my dislikes of "elseif" structures
bobjuh
Master
Posts: 268 Joined: Wed Oct 03, 2001 8:00 pm
Location: Netherlands
Contact:
Post
by bobjuh » Tue Jul 08, 2003 10:06 am
Oke got that working now and also other part of the script.
Now the next thing.
I scripted that when a perm owner joins it will broadcast
*** (Chef, Botmaintainer) BoBjUh is online
(with normal owner it will only say Botmaintainer)
Bot is there now any way th get rid of the message
*** BoBjUh joined the party line.