mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Hi guys... it's been awhile. smile

I'm working to fix an issue in Invision for inclusion in our next patch, but am running into problems...

Here's the piece I'm working on:
Code:
          .timer 1 $iif((%chanscandly isnum),%chanscandly,2) if $!remove($ial( $+ [ $nick ] $+ ).mark, [ $chan ] ) != $!null $chr(123) echo $color(info) [ $chan ] $!ts < $+ [ $nick ] $+ > is also in channels $bracket($remtok($ial( $+ [ $nick ] $+ ).mark,$wildtok($ial( $+ [ $nick ] $+ ).mark,* $+ $chan,1,32),1,32)) $chr(125)


Ok, ignore the beginning as that all works fine. It's the part starting with $bracket that is a problem. Basically, this will output all the channels that the person is in that match your own channel. However, it will leave out the channel that you are already in. It also displays the op/voice/etc status for each channel.

Here is $bracket...
Code:
bracket { 
  if ($1- != $null) { 
    if ((http: !isin $1-) && ($chr(35) !isin $1-)) { return $c(1) $+ « $+ $c(2) $+ $1- $+ $c(1) $+ » } 
    else { return $c(1) $+ « $+ $c(2) $+ $chr(32) $+ $1- $+ $chr(32) $+ $c(1) $+ » } 
  }
}


Basically, it places brackets around the output using the colors the user has set up in their options. $c(1) and $c(2) are the color choices.

Ok, so... the problem. Originally, this piece of code used $!bracket because of the timer. This makes sense to me as you want it to evaluate after the timer goes off rather than when the timer is started. However, I get a * Invalid format: $bracket error if I try to include the !. What am I doing wrong?

Here is the full part of that script, including the one line that is a problem in case you want to look at how it's set up. I didn't change this part of the script. I only changed the part inside $bracket. I'm fixing the problems caused by how the original used $remove to remove the current channel name, which resulted in not removing the op/voice/etc status for that channel and incorrectly removing the current channel's name from channels that have a similar name.

Code:
on ^*:join:#:{
  var %curNetwork = $iNetwork
  if (%mfludjp [ $+ [ $chan ] ] == 1) { Halt }
  mflud join $chan
  if ($r.set(Invision,ChanScan) == On) {
    if ($chr(126) !isin $nick) {
      if (%whoisjoinflag [ $+ [ %curNetwork ] ] <= 3) || (%whoisjoinflag [ $+ [ %curNetwork ] ] == $null) {
        inc %whoisjoinflag [ $+ [ %curNetwork ] ] 1
        .timerwjf $+ %curNetwork -o 1 2 unset %whoisjoinflag [ $+ [ %curNetwork ] ]
        if ($r.whois($nick) == $null) && ($nick != $me) {
          w.whois $nick 1
          whois $nick
          .timer 1 $iif((%chanscandly isnum),%chanscandly,2) if $!remove($ial( $+ [ $nick ] $+ ).mark, [ $chan ] ) != $!null $chr(123) echo $color(info) [ $chan ] $!ts < $+ [ $nick ] $+ > is also in channels $bracket($remtok($ial( $+ [ $nick ] $+ ).mark,$wildtok($ial( $+ [ $nick ] $+ ).mark,* $+ $chan,1,32),1,32)) $chr(125)
        }
      }
    }
  }


There is more, but it's something different, so I left it off.

Just as a final note, this works sometimes, but not other times and I'm pretty sure it is because of that !... frown


Invision Support
#Invision on irc.irchighway.net
Joined: May 2006
Posts: 93
Babel fish
Offline
Babel fish
Joined: May 2006
Posts: 93
i'm not sure but the nick is insert in the ial only if it does some action(msg, me, nick, join ecc) after you enter the channel.
try to enter in a new chan and do //echo -a $nick(nickthatdoesn'tdonothingyet) and you will see * /echo: insufficient parameters
(it will works if the nickthatdoesn'tdonothingyet is on another channel)

Joined: Oct 2004
Posts: 8,330
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
It is in an on join, so the nick did do something. That part works fine.


Invision Support
#Invision on irc.irchighway.net
Joined: May 2006
Posts: 93
Babel fish
Offline
Babel fish
Joined: May 2006
Posts: 93
maybe it needs a little time before the nick is insert in the ial and the script is too fast... try to make a timer and see if it works

Joined: Oct 2004
Posts: 8,330
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Did you even read the line? It has a timer. Check my post count... I've been helping here a long time... I know a bit about scripting. smile


Invision Support
#Invision on irc.irchighway.net
Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
if youre gona have a long complex line like that, you're better off sticking it in an alias smile here's the timer method though, i simplified it a bit, and included a $decode/$encode combination for $nick and $chan, in case the channel/nick contains characters that would otherwise screw it up :>

Code:
//var %c = $!decode( $encode(#,m) ,m),%n = $!decode( $encode($nick,m) ,m) | .timer 1 $iif(%chanscandly isnum,$v1,2) if ($remove($ial( %n ).mark, %c )) echo -c i %c $!ts $+(<,$nick,>) is also in channels $!bracket($remtok($ial( %n ).mark,$wildtok($ial( %n ).mark,* $!+ %c ,1,32),1,32))


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Well, that works, but it doesn't explain when I get the error with $!bracket... frown


Invision Support
#Invision on irc.irchighway.net
Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
as far as i can see, in your original code it would try to evaluate an identifier named literally: '$chan,1,32),1,32))' - the $chan needed to be spaced at the end smile therefor, when the timer tried to run its command, there was a parenthesis mismatch resulting in an invalid format error :Z

you can see this for yourself if you do a /timers right after the timer is initiated

Last edited by jaytea; 20/08/06 06:33 PM.

"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Still not seeing it... there isn't a mismatch in parentheses unless perhaps you have you have $chan ,1,32 (with a space after $chan) but that's not required normally, so I can't see why that would be true.. And $bracket works... it's $!bracket that gives the error. I did try with $!+ instead of $+ (I didn't think to put the ! there), but it still gives the error. frown

It's not a big deal, but if you or someone else could fix the version I did (not changing it to use something like $decode/$encode) so I can see where the error is, that would be great.


Invision Support
#Invision on irc.irchighway.net
Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
Code:
$!bracket($remtok($ial( $+ [ $nick ] $+ ).mark,$wildtok($ial( $+ [ $nick ] $+ ).mark,* $+ $chan ,1,32),1,32))


the only fix required is that space smirk as soon as you add the ! to $bracket, the rules of identifiers no longer apply. $!bracket, and everything following it, is seen as plaintext all the way up until the next space. after that space, identifiers evaluate as they normally do, which is why $chan,1,32... is screwing up... it is not considered inside the $bracket() identifier at this stage

you can test all this yourself by //echo -a $!bracket(....), turn on identifier warning and see what's trying to be evaluated and such :|


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Oh, ok. I get it now. Thanks.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard