mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2003
Posts: 22
M
Marco Offline OP
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Jan 2003
Posts: 22
the current code is outputting the data on the file like this:
<? $ircnicks = "

<b>@AM</b>,

<b>@Ark</b>,

<b>@Chris</b>,

<b>@And_M</b>,
";

$mostnicks = "14";

$totalnicks = "14 "; ?>

this causes me an php error frown I need to mak ethis code appears like this to avoid it
<?
$ircnicks = "<b>@AM</b>,<b>@Ark</b>";
$mostnicks = "14";
$totalnicks = "14 ";
?>
here is teh current code
Code:
/getnicks { var %x = 1
write -c nicks.php &lt;? $chr(36) $+ ircnicks = "
while (%x &lt;= $nick(#orange,0)) {
if ($nick(#orange,%x) isop #orange) {
write -a nicks.php &lt;b&gt;@ $+ $nick(#orange,%x) $+ &lt;/b&gt; $+ , }
elseif ($nick(#orange,%x) ishop #orange) {
write -a nicks.php &lt;b&gt;&lt;i&gt; $+ $chr(37) $+ $nick(#orange,%x) $+ &lt;/i&gt;&lt;/b&gt; $+ , }
elseif ($nick(#orange,%x) isvoice #orange) {
write -a nicks.php &lt;i&gt; $+ $chr(43) $+ $nick(#orange,%x) $+ &lt;/i&gt; $+ , }
else { write -a nicks.php $nick(#orange,%x) $+ , }
inc %x
}
set %lastnick $read(nicks.php,$lines(nicks.php))
write -d $+ $lines(nicks.php) nicks.php
set %lastnickchars $calc($len(%lastnick) - 1)
set %nocommanick $left(%lastnick,%lastnickchars)
write -a nicks.php %nocommanick
write -a nicks.php " $+ $chr(59)
set %totalnicks $calc($lines(nicks.php) - 2)
if (%record.users == $null) { set %record.users $nick(#orange,0) }
else {
if ($nick(#orange,0) &gt; %record.users) {
  set %record.users $nick(#orange,0)
}
}
write -a nicks.php $chr(36) $+ mostnicks = $chr(34) $+ %record.users $+ $chr(34) $+ $chr(59)
write -a nicks.php $chr(36) $+ totalnicks = $chr(34) $+ %totalnicks $chr(34) $+ $chr(59) ?&gt;


Im new to this and any help I could get is appreciated !
Thanks in advance !

Joined: Jan 2003
Posts: 94
S
Babel fish
Offline
Babel fish
S
Joined: Jan 2003
Posts: 94
For the first part:

Code:
/getnicks { 
  var %x = 1,%f = nicks.php
  while (%x &lt;= $nick(#orange,0)) {
    var %n = $nick(#orange,%x)
    if (%n isop #orange) var %a = %a $+(&lt;b&gt;@,%n,&lt;/b&gt;)
    elseif (%n ishop #orange) var %b = %b $+(&lt;b&gt;&lt;i&gt;,$chr(37),%n,&lt;/i&gt;&lt;/b&gt;)
    elseif (%n isvoice #orange) var %c = %c $+(&lt;i&gt;+,%n,&lt;/i&gt;)
    else var %d = %d %n
    inc %x
  }
  var %abcd = $replace($+(%a,%b,%c,%d),$chr(32),$chr(44)

  write -c %f $+(&lt;? $chr(36),ircnicks = ",%abcd)


%abcd will give you all the names with commas seperating them...
i couldnt make out the second part.


-
E-Mail: mirc_sabby@hotmail.com
Network: irc.enterthegame.com
Channel: #Helpdesk
Joined: Jan 2003
Posts: 22
M
Marco Offline OP
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Jan 2003
Posts: 22
thanks a lot smile

Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Just a simplification of Sabby's script. Both scripts will run into problems once you get enough people into #orange, though. Variables can only be ~940 characters or so, depending on the length of the variable name (max length: 943), which is why I made it a two-character (% + n) variable name, switching the rest of the variables to follow the minimalist style, but adding explanatory comments at the beginning.
Code:

getnicks { 
  [color:#006600];  %n = nicks list
  ;  %f = filename
  ;  %c = $chan
  ;  %x = loop index[/color]
  var %n, %f = nicks.php, %c = #orange, %i = 1
  while ($nick(%c, %i).pnick) {
    %n = $addtok(%n, $+(&lt;b&gt;,$ifmatch,&lt;/b&gt;), 44)
    inc %i
  }
  if ($nick(%c, 0) &gt; %record.users) set %record.users $ifmatch
  write -c %f &lt;?
  write %f    $ $+ ircnicks = $+(",%n,";)
  write %f    $ $+ mostnicks = $+(",%record.users,";)
  write %f    $ $+ totalnicks = $+(",%$nick(%c,0),";)
  write %f    ?&gt;
}

Variable maximum length is 946, including the %, the variable name, a space and the value. You can figure it more easily by subtracting the length of your variable name from 944. Thus, %[color:840017]nick[/color] is 4 characters, and can hold 940 maximum characters. %[color:840017]nicklist.for.channel.#orange[/color] is 28 characters long and can hold 916 characters. You are adding <b></b>, to each nick (8 characters) plus a possible 9th one for the @+% channel prefix.

On EFnet, where there is a maximum of 9 characters per nick, you're talking about nick + prefix + <b></b>, = 9 + 1 + 8 = 18, which means that you can hold 52 nicks of maxed length in that variable before you are approaching the overflow point and start getting * /set: line too long. On DALnet, where the maximum length of a nick is 30 characters, you can only hold 24 nicks of maxed length (they won't all be, but the possibility exists that the first 25 nicks in #orange on DALnet might indeed have 30 characters apiece) before you're in danger of overflowing the variable.


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
Joined: Jan 2003
Posts: 22
M
Marco Offline OP
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Jan 2003
Posts: 22
Thanks for the code Hammer it works pretty nice ! smile


Link Copied to Clipboard