mIRC Home    About    Download    Register    News    Help

Print Thread
#254521 14/08/15 03:57 PM
Joined: Aug 2015
Posts: 2
G
g00gl3 Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
G
Joined: Aug 2015
Posts: 2
Can help me please to add toks based on their team?

an alias $sortusers returns a window @users which contains

User1 Team1
User2 Team1
User3 Team1
User4 Team2
User5 Team2
User9 Team6
User10 Team6
User6 Team3
User7 None
User8 Team5

How can i split users into 2 vars with 5 slots?
if team1 has 6 users,throw the user on 2nd var.
Just to balance them.

Thanks.

Last edited by g00gl3; 14/08/15 05:39 PM.
g00gl3 #254528 14/08/15 08:38 PM
Joined: Jul 2006
Posts: 4,153
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,153
Hello, can you clarify what you mean?
You want to split 10 lines representing a player and its team, but how do you want to split, should it be based on the name of the team? Should it split randomly?

Maybe this? :

Code:
var %a 1,%r,%1,%2,%v
while ($line(@window,%a) != $null) {
  %v = $v1
  if ($r(0,1)) {
    if ($numtok(%1,44) == 5) %2 = $addtok(%2,%v,44)
    else %1 = $addtok(%1,%v,44)
  }
  else {
   if ($numtok(%2,44) == 5) %1 = $addtok(%1,%v,44)
   else %2 = $addtok(%2,%v,44)
  }
  inc %a
}
echo -a 1: %1
echo -a 2: %2


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Wims #254536 15/08/15 12:27 AM
Joined: Aug 2015
Posts: 2
G
g00gl3 Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
G
Joined: Aug 2015
Posts: 2
Yeah it should be based on the team but i am getting confused when the list looks like:

team1.team1.team1 // team2.team2.team2 // team3.team3.team3 // .team4

What to do in this case?


By the way,was getting the user like this
Code:
alias sort.team {
  return $gettok($line@teams,$1),1,32)
}

Last edited by g00gl3; 15/08/15 01:01 AM.
g00gl3 #254546 15/08/15 11:27 AM
Joined: Jul 2006
Posts: 4,153
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,153
He got helped on IRC.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard