mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2014
Posts: 35
M
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Oct 2014
Posts: 35
Hey, just found this bug, I don't know how to explain it but if you try this script you'll see that first echo will echo %var.#channel while the other echo that's on a timer will echo Hello

Code:
alias abc {
  set %var. $+ $chan Hello
  echo # 1 $+(%,var.,$chan)
  timer 1 1 echo # 2 $+(%,var.,$chan)
}


Edit: This also happens with /msg BTW.

Last edited by MattiSony; 22/02/16 09:06 AM.

Matti
Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
timers evaluate the command when they expire; resulting in double evaluation; this is intended.

If you want the literal text "%var.#channel" to echo, you'll need to escape it in the /timer command.

Code:
alias safe {
  return $!decode( $+ $encode($1-,m) $+ ,m)
}

alias abc {
  .timer 1 1 echo # 2 $safe( $+(%,var.,$chan) )
}


I am SReject
My Stuff
Joined: Oct 2014
Posts: 35
M
Ameglian cow
OP Offline
Ameglian cow
M
Joined: Oct 2014
Posts: 35
Actually I want what's stored in the variable %var.#channel
I just put a small timer on the msg to bypass it for now.


Matti
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Btw, the $safe identifier will be into the next version, you will not need this extra alias, mIRC will have $safe by default.


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
To evaluate, you can use the $eval identifer:
Code:
alias abcd {
  set $+(%,var.,name) example

  ;; evaluates the literal "%" + "var." + "name"
  echo -a This isn't evaluated: $+(%, var., name)

  ;; evaluates the literal text "%" + "var." + "name"
  ;; then evaluates the resulting text again (%var.name)
  echo -a This is evaluated: $eval( $+(%, var., name) , 2)
}


--

As westor mentioned, in the upcoming version(not released yet) the $safe() alias from my post will be a native identifer; thus the custom alias will no longer be needed

Last edited by FroggieDaFrog; 22/02/16 02:43 PM.

I am SReject
My Stuff

Link Copied to Clipboard