mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2006
Posts: 12
Z
Zarkov Offline OP
Pikka bird
OP Offline
Pikka bird
Z
Joined: Mar 2006
Posts: 12
hi, ive been scripting for a while now but just starting to learn sockets.
What im trying to do is to use a socket to connect to a server allow me to join the socket connection to a channel, which opens a window with a side listbox. I then get the list of users on the channel via the 353 raw numeric and populat the side listbox with the nicks.
In simple terms to recreate a channel window as mirc uses.

so far i have got everything working right except that the nicks in the list box do not sort as they do in the nicklist.
ie ~ or +q users at the top followed by & or +a then @ or +o etc etc.

is this feature available in the /window command and im missing something or is it not possible to efectivly recrate the channel window as used by mirc?

Thanks for your help smile
and ive searched the forums already and didnt find anything helpful.

Joined: Feb 2006
Posts: 54
T
Babel fish
Offline
Babel fish
T
Joined: Feb 2006
Posts: 54
when you create first the window use upper (S) sort the side-listbox

exampel: window -l20S @sock

this sould fix it! (Beyonce is the girl.)

Joined: Mar 2006
Posts: 12
Z
Zarkov Offline OP
Pikka bird
OP Offline
Pikka bird
Z
Joined: Mar 2006
Posts: 12
hi thanks but ive done that
i use this to create the window
Code:
 window -el15SRk0  

what i get is +h listed first
then +a
then +o
then +q
then +v
then normal users
also how can i read the nick colours thats set in the address bock colours tab? so i can colour the nicks
thanks again

Last edited by Zarkov; 03/03/06 04:43 PM.
Joined: Feb 2006
Posts: 54
T
Babel fish
Offline
Babel fish
T
Joined: Feb 2006
Posts: 54
are you add the nicks to the site list box one by one? like it sould be
using aline -ln @window %nick

nick color can be retrived be using $cnick(N/nick, M)
for more info /help $cnick

Last edited by tso29; 03/03/06 06:19 PM.
Joined: Mar 2006
Posts: 12
Z
Zarkov Offline OP
Pikka bird
OP Offline
Pikka bird
Z
Joined: Mar 2006
Posts: 12
yes, im getting the list of nicks via the raw numeric 353 when the bot joins the channel
Code:
 
on *:signal:raw_353:{
   var %nlcount 1
  while (%nlcount <= $calc($0 - 5)) {
    aline -l @ $+ $5 $remove($ [ $+ [ $calc(%nlcount + 5) ] ], :)
    inc %nlcount
  }
}

 

thanks for the nick colour info, will look at that now smile

Joined: Feb 2006
Posts: 54
T
Babel fish
Offline
Babel fish
T
Joined: Feb 2006
Posts: 54
i maked an alias to test it and it works fine here, i get the nicklist sorted exact like in mirc


Code:
 
when you open a channel window for the first time thoes switch must be include  -l15Sk0 

alias -l nicklist {
  var %a = $0
  while (%a) {
    aline -ln %chan $gettok($1-,%a,32)
    dec %a
  }
}
raw 353:*:{ 
  set %chan $+(@,$3)
  nicklist $gettok($6-,1,58) 
}



Note use aline -ln not just only aline -l (-n) switch is used to prevent a line from being added if it exists.

Joined: Mar 2006
Posts: 12
Z
Zarkov Offline OP
Pikka bird
OP Offline
Pikka bird
Z
Joined: Mar 2006
Posts: 12
Thnaks ill try this now, the only thing i can see that may make a difference is that your doint that in a channel window, i want to do it in a custom window not sure if that will make any difference but ill let you know.
my mistake lol i see your creating a var %chan with the name of the custom window. first glance thought it was $chan.
blush

Last edited by Zarkov; 04/03/06 07:27 AM.
Joined: Feb 2006
Posts: 54
T
Babel fish
Offline
Babel fish
T
Joined: Feb 2006
Posts: 54
I am doing this in a custom window i am only using the channel name to create this window smile @#mIRC

Joined: Mar 2006
Posts: 12
Z
Zarkov Offline OP
Pikka bird
OP Offline
Pikka bird
Z
Joined: Mar 2006
Posts: 12
Yeah i spotted it after i posted lol hence the edit smile
but ive just used your script and it still fails to sort the ops ,halfops, voices etc correctly.
Ive tried in both 6.16 and 6.17 and get exactly the same problem in both.

Im coding this in 6.17 and just thought it could have been a bug in there so tried on 6.16 aswell with same results.

what i get in a channel window is like
~Zarkov
&zark
@zar
%z
+me
anyone

and in the custom windowns list its like this
%z
&zark
@zar
~Zarkov
+me
anyone

its like its using the prefix as part of the nick and its sort order is different that for a nicklist

Joined: Feb 2006
Posts: 54
T
Babel fish
Offline
Babel fish
T
Joined: Feb 2006
Posts: 54
i tested with a socket and here it works it sorts corect like in mirc nicklist!,. lets start from the begin smile

first i realse you are using on *:signal:raw_353:{
use the on sockread event direct try the code below
Code:
  
on 1:sockread:ircsock:{
  if ($sockerr > 0) { return }
  :socketread
  sockread %ircsock
  tokenize 32 %ircsock
  if ($sockbr == 0) return
  if (%ircsock == $null) %ircsock = -
  if (353 == $2) {
  set %chan $+(@,$5)
  nicklist $gettok($6-,1,58) 
}
goto socketread

}
alias -l nicklist {
  if (!$window(%chan)) window -l15k0eS %chan
  var %a = $0
  while (%a) {
    aline -ln %chan $gettok($1-,%a,32)
    dec %a
  }
}


Joined: Mar 2006
Posts: 12
Z
Zarkov Offline OP
Pikka bird
OP Offline
Pikka bird
Z
Joined: Mar 2006
Posts: 12
tso29, thanks for the help and sorry for the delay in responding but ive been ill frown
ive tried your code, in6.16 & 6.17 it still fails to sort correctly
ill show you my full test script incase you can see anything ive done wrong at all.
Code:
 
alias connect {
  if ($sock(ircsock)) return
  sockopen ircsock $$1 $iif($2,$2,6667)
}
on *:sockopen:ircsock:{
  if ($sockerr) return 
  sockwrite -n ircsock NICK SOCK-TEST
  sockwrite -n ircsock USER MEME * * :HAHA
  sockwrite -n ircsock JOIN #achannel
}

on 1:sockread:ircsock:{
  if ($sockerr > 0) { return }
  :socketread
  sockread %ircsock
  echo -s %ircsock
  tokenize 32 %ircsock
  if ($sockbr == 0) return
  if (%ircsock == $null) %ircsock = - 
  if (353 == $2) {  
    set %chan $+(@,$5)
    nicklist $gettok($6-,1,58)
  }
  goto socketread
}
alias -l nicklist {
  if (!$window(%chan)) window -l15k0eS %chan
  var %a = $0
  while (%a) {
    aline -ln %chan $gettok($1-,%a,32)
    dec %a
  }
}

 


im wondering what this could be if you say it is sorting correctly on your client.
I have even tried to addtok the nicks and the use sorttok( ,c) to get a channel nick prefix sort order and that too sorts incorrectly.

Joined: Feb 2006
Posts: 54
T
Babel fish
Offline
Babel fish
T
Joined: Feb 2006
Posts: 54
you was actualy right i tested my code with dalnet IRCD
the have only ops and voice i was think if it sorts op and voice correct it must work with other modes too after you give my the server link i realse it fail to sort the i tested

then i joined a channel with mirc
window -l15S
and window -l15

$nick(#,1).pnick even this failed in a window with (S)
with now S is sorted correct in mirc at the moment i have not the time to test this with a socket i must leve now
but tonight i will try to find a sulution if there is still a need for , if you fixed before tonight let me now thanks smile

Joined: Mar 2006
Posts: 12
Z
Zarkov Offline OP
Pikka bird
OP Offline
Pikka bird
Z
Joined: Mar 2006
Posts: 12
Thanks, but ive exhusted my knowledge now and still cant see how to do it other than to parse each nick check the first char and if its a mode prefix add it to a var and then sort the var somehow to get the nicks in the right order and then fill the list box.
this seems like hard work to me and then leads me onto the next question of how would i control the adding or removing of nick prefixes when for example someone gets oped or deoped.
i think i will need to think real long and hard about this and see if i can work out anyway to sort the nicks manually

Joined: Feb 2006
Posts: 54
T
Babel fish
Offline
Babel fish
T
Joined: Feb 2006
Posts: 54
well actuali my friend it semse like mirc must first connect to a network to no now what channel modes are supported
becuse mirc get the prefix from the 005 Numeric PREFIX=(qaohv)~&@%+ and the are sortted in 005.
and i think with a socked you must do the same fineli

becuse even store nicks to var and try to sortem using $sorttok(sometok,32,c) will fail becuse mirc can not sort chan modes before it takes his info from 005 token.

and your right it is a hard work becuse you are tring to make and IRC client via mirc

about how to deal with events like join,op,nick,part etc
$fline(@name,wildtext,N,T) do the job. /help $fline to read more about


but it is still hard , but nothing is inposible!

one sulotion would be maby:
Code:
  
alias -l nicklist {
var %a = 1
while (%a <= $0) {
if ($mid(~&@%+,1,1) == $left($gettok($1-,%a,32),1)) iline -l %chan 1 $gettok($1-,%a,32)
elseif ($mid(~&@%+,2,1) == $left($gettok($1-,%a,32),1)) iline -l %chan 2 $gettok($1-,%a,32)
elseif ($mid(~&@%+,3,1) == $left($gettok($1-,%a,32),1)) iline -l %chan 3 $gettok($1-,%a,32)
elseif ($mid(~&@%+,4,1) == $left($gettok($1-,%a,32),1)) iline -l %chan 4 $gettok($1-,%a,32)
elseif ($mid(~&@%+,5,1) == $left($gettok($1-,%a,32),1)) iline -l %chan 5 $gettok($1-,%a,32)
else iline -l %chan 5 $gettok($1-,%a,32)
inc %a
 }
}

;but this is still not so easy like it looks like becuse all modes must be support on a channel. becuse if (~ and & not support on the channel) then iline 1 must be % you see its hard you must calc and check etc.. 

Last edited by tso29; 07/03/06 09:46 PM.
Joined: Mar 2006
Posts: 12
Z
Zarkov Offline OP
Pikka bird
OP Offline
Pikka bird
Z
Joined: Mar 2006
Posts: 12
Quote:
well actuali my friend it semse like mirc must first connect to a network to no now what channel modes are supported
becuse mirc get the prefix from the 005 Numeric PREFIX=(qaohv)~&@%+ and the are sortted in 005.
and i think with a socked you must do the same fineli


yes i agree, but the socket must be connected in order to join the channel smile
ill look into your code and thanks for all your help
i think ill have to parse each nick, check the first chat against $prefix and then store them seperately form non prefixed nick
then work out how to sort the prefixes


Link Copied to Clipboard