mIRC Home    About    Download    Register    News    Help

Print Thread
#108540 20/01/05 05:42 PM
Joined: Dec 2004
Posts: 81
N
Babel fish
OP Offline
Babel fish
N
Joined: Dec 2004
Posts: 81
I've searched this site and others (if there's something on here related to this I apologize). I'm trying to do a nickname display when I recieve the names from the server (raw 353) and display it to the channel in an alignment. Basically displaying three nicknames per line.

#108541 20/01/05 07:57 PM
Joined: Sep 2004
Posts: 237
Fjord artisan
Offline
Fjord artisan
Joined: Sep 2004
Posts: 237
Errr..... well this will give you your nick and the first 2 other nicks....... raw 353:*:{ /echo -a $4 $5 $6 } ... I imagine you would have to make a loop..... i'll see what i can come up with.

#108542 20/01/05 08:08 PM
Joined: Dec 2004
Posts: 81
N
Babel fish
OP Offline
Babel fish
N
Joined: Dec 2004
Posts: 81
Right but listing multiples of 3 and figuring out the calculations is what I'm stuck on. I've tried setting the entire nameslist to a variables %names and using $deltok but didn't proceed.

#108543 20/01/05 08:42 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
Right but listing multiples of 3 and figuring out the calculations is what I'm stuck on. I've tried setting the entire nameslist to a variables %names and using $deltok but didn't proceed.


you want something like
Code:
Bob                         Bill                         Brian
john                        Johnnythegreatbignickname    jenny
etc


If so its treally down to if u use a equally sized character font (fixedwidth i think there called, all characters are same width) or not to if its going to be easy or hard, alos if u well ever get it perfectly alligned.

If its a fixedwidth font, and say the network max nick len is 40 you can just use $left($gettok(%names,N,32) $+ $str($chr(160),40),40) < that well add hardspaces to the end of the name upto 40 characters.

if its variable width fonts it becomes heaps more complexe
%window is the window your in, so you can use $chan or what ever for this. %textsize is a pixel width of each column.

$wrap($gettok(%names,N,32) $+ $str($chr(160),200),$window(%window).font,$window(%window).fontsize,%textsize,0,1)
^
And those wont always lineup due to this giving you the closest number of characters that fit in the %textsize number of pixels, so following ones well start rom that slightly outa linement position. You can improove that slightly using this

var %t = $wrap($gettok(%names,N,32) $+ $str($chr(160),200),$window(%window).font,$window(%window).fontsize,%textsize,0,1)
inc N
var %t = $wrap(%t $+ $gettok(%names,N,32) $+ $str($chr(160),200),$window(%window).font,$window(%window).fontsize,$calc(%textsize * 2),0,1)
inc N
var %t = $wrap(%t $+ $gettok(%names,N,32) $+ $str($chr(160),200),$window(%window).font,$window(%window).fontsize,$calc(%textsize * 3),0,1)

%t now holds 3 nicks spaced out, but it still wont be perfectly in line everytime.

PS: N represents what ever value your using to represent what nick to read from %names, and I assumed names was spaced delimited, as seen in the gettoks using 32.

I also dont know if there is a cleaner way of getting aligned lists, in a plain window without using TABS, but the above has worked for me up tell now.

#108544 20/01/05 08:51 PM
Joined: Dec 2004
Posts: 81
N
Babel fish
OP Offline
Babel fish
N
Joined: Dec 2004
Posts: 81
Right, I can easily do the aligment, that's not what I'm worried about. I'm talking about the calculations used to generate the actual list (3 nicknames per line). I should say capturing the nicknames in a variable (the first 3, the next 3, and so on) then performing the alignment displays. Basically I'm just curious as how I would gather the first three, the second three, and so on into a variable each time the loop, reloops. If you need me to be more clearer, I can try, lol.

#108545 20/01/05 09:05 PM
Joined: Jan 2005
Posts: 75
Z
Babel fish
Offline
Babel fish
Z
Joined: Jan 2005
Posts: 75
This is mine, but in 5 lines at a time

Code:
 alias  joinsync  {
  if ($me !ison $1) { halt }
  set %i 0
  set %nicks ""
  set %num 5
  echo $1 11,15 $+ $str($chr(160),2) $+ stats $+  $+ $str($chr(160),23) 09: 14[09~10!01 $+ $nick($1,0,~) $+ 14] 14[09&amp;10!01 $+ $nick($1,0,&amp;) $+ 14] 14[09.10!01 $+ $nick($1,0,.) $+ 14] 14[09@10!01 $+ $nick($1,0,@) $+ 14] 14[09%10!01 $+ $nick($1,0,%) $+ 14] 14[09+10!01 $+ $nick($1,0,+) $+ 14] 14[09*10!01 $+ $nick($1,0,*) $+ 14] 14[09^10!01 $+ $nick($1,0,^) $+ 14] 14[09T10!01 $+ $nick($1,0,a) $+ 14]
  echo $1 11,15 $+ $str($chr(160),7) $+  $+ $str($chr(160),15) $+ 10­­­­­—­­­­­—­­­­­—­­­­­—­­­­­—­­­­­—­­­­­—­­­­­—­­­­­—­­­­­—­­­­­—­­­­­—­­­­­—
  :loop
  inc %i
  if (%i &gt; $nick($1,0,a)) {
    if (%nicks != $null) {
      if ($numtok(%nicks,32) &gt;= 1) { set %nicks %nicks | echo $1 11,15 $+ $str($chr(160),2) $+ names $+ $str($chr(160),20) 01| %nicks | goto end }
    }
    goto end
  }
  set %nicks %nicks  14[ $+ $xnick4($nick($1,%i),$1) $+ 14]
  :next
  if (%i == %num) {
    echo $1 11,15 $+ $str($chr(160),2) $+ names $+ $str($chr(160),20) 01|  %nicks
    set %num $calc(%num + 5)
    set %nicks ""
    goto loop
  }
  goto loop
  :end
  echo $1 00,15 $+ $str($chr(160),7) $+  $str($chr(160),13) 01­­­­­—­­­­­—­­­­­—­­­­­—­­­­­—­­­­­—­­­­­—­­­­­—­­­­­—­­­­­—­­­­­—­­­­­—­­­­­—
  echo $1 11,15 $+ $str($chr(160),3) $+ sync $+  $+ $str($chr(160),23) 09:10 $1 was synched in  $calc(($ticks - %sync) / 1000) secs!! | remini data.ini joinsync $1
} 
alias xnick4 {
  var %a $iif($2,$2,$chan),%b $iif($1 !isreg %a,$left($nick(%a,$1).pnick,1)) $+ $1
  return $str(€,$calc(13 - $len(%b))) $+ $iif($1 !isreg %a,$+(09,$left(%b,1),01,$mid(%b,2,12)),$+(01,$mid(%b,1,13)))
}

then you need to add this 

Code:
 on *:join:#: {
  set %sync $readini data.ini joinsync #
  if (%sync == $null) { writeini data.ini joinsync # $ticks }
} 

#108546 20/01/05 09:29 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
DOH!

RAW 353:*:echo -a 352 $1-
RAW 366:*:echo -a 366 $1-
well i just did a /hop and got

353 DaveC = #channelname nick1 nick2 nick3 nick4 etc etc
...
353 DaveC = #channelname nick1 nick99 nick100 etc etc
...
366 DaveC #channelname End of /NAMES list.

so...
Code:
RAW 353:*:{
  tokenize 32 $3 %old.352.names $4-
  while ($4) {
    aliase.to.display.three.names $1-4
    tokenize 32 $1 $5-
  }
  set -u2 %old.352.names $2-
}
RAW 366:*:{
  if (%old.352.names != $null) {
    aliase.to.display.three.names $2 %old.352.names $chr(160) $chr(160)
  }
  unset %old.352.names
}


ill leave the aliase.to.display.three.names to you $1 passed to it is the channel and $2 $3 $4 are the 3 names

[edit]
I read this and thought i better explain what im doing... ALSO CORRECT THE ERROR >>> set -u2 %old.352.names $2-
Code:
RAW 353:*:{
  tokenize 32 $3 %old.352.names $4-
  ;^ dump the stuff of the new list we dont need, namely DaveC = and add any names not done from the last 353
  ;
  while ($4) {
    ;^ if there is a $4 then we have the channel name and 3 names still so do a loop
    ;
    aliase.to.display.three.names $1-4
    ;^ call the display 3 names alias telling it channel and 3 names
    ;
    tokenize 32 $1 $5-
    ;^ dump the 3 names just displayed and loop back
    ;
  }
  set -u2 %old.352.names $2-
  ;^ store any names left over
}
RAW 366:*:{
  if (%old.352.names != $null) {
    ;^ if names left over at end proccess them
    ;
    aliase.to.display.three.names $2 %old.352.names $chr(160) $chr(160)
    ;^ call the display 3 names alias telling it channel and 3 names (blank fill last two name spots with hardspaces incase they are needed)
    ;
  }
  unset %old.352.names
  ;^ unset the still to process list
  ;
}


Last edited by DaveC; 20/01/05 09:41 PM.
#108547 20/01/05 10:11 PM
Joined: Dec 2004
Posts: 81
N
Babel fish
OP Offline
Babel fish
N
Joined: Dec 2004
Posts: 81
Thanks! I almost had it working before checking back here:
Code:
alias 1test {
  %test = nycdiesel ChatStats Ook @bamaboy @[-maverick-] Prospero Tweeder [AFX] Sheik Ami Kev_UK @[SoftWare] xhaker k3rnel @|3|acK_Kn|G||T @setile
  echo -a $gettok(%test,0,32)
  var %idx 0 , %idx2 0, %names
  while (%idx &lt; $numtok(%test,32)) {
    inc %idx
    while (%idx2 &lt; 3) {
      inc %idx2
      %names = %names $gettok(%test,%idx2,32)
      %test = $deltok(%test,%idx2,32)
      echo -s DELETED $gettok(%test,%idx2,32) from :%test:
    }
    echo -s %names
    unset %names
    %idx2 = 0
  }
}

#108548 20/01/05 11:43 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
I actually wrote something similar to that in here that using the 353 just collected all the name, then on the 366 displayed them, problem with that is a variable in mirc can only have a length around 950 characters, so on a big channel thats gonna go belly up, so i did that one instead.

I wasnt exactly sure what your code was going to do in the end, i think it was ment to add to %Names as they came in on the 353, there were a few small errors but one i noticed was this...
%test = $deltok(%test,%idx2,32)
echo -s DELETED $gettok(%test,%idx2,32) from :%test:

You cant get the token after its deleted becuase its not there
$deltok(a b c d,3,32) makes a b d
then
echo $gettok(a b d,3,32) displays d

those lines would need to be around the otherway, so you display what you are deleting on the next line.

#108549 21/01/05 12:52 AM
Joined: Jan 2005
Posts: 75
Z
Babel fish
Offline
Babel fish
Z
Joined: Jan 2005
Posts: 75
i forgot to add in
Raw 366:*:{ set %sync $readini data.ini joinsync $2 | joinsync $2 | halt }


Link Copied to Clipboard