mIRC Homepage
Posted By: kap raw away:*:{} - 23/01/20 07:15 PM
Has $numeric always been 0 when raw events are non-numeric? Or did it at one point return $null?

kind regards,

kap
Posted By: kap Re: raw away:*:{} - 23/01/20 08:04 PM
I'm asking because at the moment the script Peace and Protection (which is close to 18 years old and is a good thermometer for when mIRC changes), is firing on $numeric == 0 and not able to display raw away:*:{} or other raw <non-numeric> properly, resulting in strange output. It can be fixed in the PnP code, but I was thinking that if $numeric should be $null for non-numeric events, there wouldn't be an issue for me to report and I can leave the PnP code as it is.

for the curious:

script\rawdisp.mrc - line: 1651
https://github.com/solbu/Peace-and-...5feac8185/script/rawdisp.mrc#L1651-L1667


Code
; Also catches all (incl 307) while in the middle of a whois, unless prev halted
raw *:*:{
  if ($numeric !isnum) return
  if ($halted) return


  ; In a whois?
  _in.whois $1-


  var %pos = $findtok( 1   4  101 104 252 253 254 256 257 258 259 263 351 381 382 407 409 411 412 413 414 416 421 423 424 431 440 445 446 451 455 461 462 463 464 465 481 483 491 501 502 511,$numeric,1,32)
  var %raw =  $gettok(<sn sn> <sn sn>  sn  sn  sn <n   n   n   n>  e   b   b   b   b   n   b   b   b   b   e   b   b   b   b   b   b   b   e   e   b   e   e   e   e   b   b   e   b   b   b ,%pos,32)
  if (!%raw) %raw = b
  if (< isin %raw) $iif(($hget(pnp.config,rawroute) == -si2) || (s isin %raw),disps-div,dispa-div)
  set -u %::value $2
  $iif(s isin %raw,raw.theme,raw.themew) $right(00 $+ $numeric,3) $iif(n isin %raw,$color(norm),$iif(b isin %raw,$:c1,$:cerr)) $iif($2- == $null, ,$2-)
  if (> isin %raw) $iif(($hget(pnp.config,rawroute) == -si2) || (s isin %raw),disps-div,dispa-div)
  halt
}
Posted By: kap Re: raw away:*:{} - 23/01/20 11:12 PM
I think the simplest fix would be to change this line:
Code
raw *:*:{
  if ($numeric !isnum) return
 <snip>
}


to:

Code
raw *:*:{
  if ($event !isnum) return
  <snip>
}


But still my initial question remains...

regards
Posted By: kap Re: raw away:*:{} - 25/01/20 10:20 AM
Post in case someone else is having these issues with the PnP script:

Originally Posted by kap
...resulting in strange output.

Form the PnP forum: (https://www.kristshell.net/pnp/forum/viewthread.php?tid=270)
[Linked Image from image.ibb.co]

Posted By: Khaled Re: raw away:*:{} - 25/01/20 01:10 PM
Quote
Has $numeric always been 0 when raw events are non-numeric? Or did it at one point return $null?

As $numeric was added in 1996, and the scripting language has grown around it for almost 25 years, the only way to be sure would be to download older versions of mIRC to see how they work. That said, when it comes to backward compatibility, the furthest I would go back is to v6.35, as that is already over ten years old.
Posted By: kap Re: raw away:*:{} - 25/01/20 03:36 PM
Originally Posted by Khaled
As $numeric was added in 1996, and the scripting language has grown around it for almost 25 years, the only way to be sure would be to download older versions of mIRC to see how they work. That said, when it comes to backward compatibility, the furthest I would go back is to v6.35, as that is already over ten years old.


I just had a look through versions.txt and noticed this:
15/04/2017 - mIRC v7.48
Quote

Added CAP support for extended-join and account-notify. These are
enabled automatically on connect if available and provide the account
names of users in JOIN/ACCOUNT events. ACCOUNT events are not shown
but are used to update $ial().account. They trigger as RAW events.
18.Added CAP support for away-notify. This is automatically enabled if
available and makes the server send AWAY events to the client
indicating the away state of users on the same channels as you. AWAY
events are not shown but are used to set $ial().away. They trigger as
RAW events.
19.Added CAP support for account-tag. This is automatically enabled if
available and makes the server include the user's @acount=name in the
message-tag for messages sent by that user.
20.Added CAP support for invite-notify. This is automatically enabled if
available and makes the server send these events to the client for
users invited to their channel. These events are not shown but
trigger as RAW events.
21.Added CAP support for chghost. This is automatically enabled if
available and makes the server send user@host updates for nicknames
on the same channels to update the IAL. These events are not shown
but trigger as RAW events.


This is not that long ago. I am thinking maybe it was decided then that $numeric is to return 0 when these ACCOUNT/AWAY/etc events trigger?

But thanks for the reply! I'll have a look at older versions. I can dl them at https://mircscripts.net/oldversion/
Posted By: Khaled Re: raw away:*:{} - 25/01/20 06:20 PM
Quote
This is not that long ago. I am thinking maybe it was decided then that $numeric is to return 0 when these ACCOUNT/AWAY/etc events trigger?

That is certainly possible but... the only way to be sure would be to download older versions of mIRC to see how they work.

That is always the first step if you think something has changed. It usually only takes a few minutes and will answer your question quite quickly.

If you find that something has changed, I will then need to look at the source code changes between different versions, and possibly add debugging information, recompile them, create a test environment, get more information from you about a minimal script that reproduces the issue, the server command you are using to reproduce it, the server address you are using in case it is network/server-specific, and so on.
© mIRC Discussion Forums