mIRC Home    About    Download    Register    News    Help

Print Thread
#170226 05/02/07 02:25 PM
Joined: Aug 2005
Posts: 128
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Aug 2005
Posts: 128
I suggest making an identifier to "unevaluate" a string, so you can correctly pass it in remotes to a /scid or /timer. For example, if you have in remotes: timer 1 1 join $1 and $1 contains something like #$someid() it will execute the $someid identifier instead of joining #$someid(). This thing exists in a lot of scripts, and there should be an easy way to "unevaluate" the string before passing it to a place where it will be evaluated twice.


Code:
alias -l real {
  ;; $chr(40) =  (
  ;; $chr(41) =  )
  ;; $chr(44) =  ,
  if (!$lock(decode)) return $+($,decode,$chr(40),$encode($1-,m),$chr(44),m,$chr(41))
  ;;;                           $ decode   (        data           ,      m    )
  else {
    return $1-
  }
}


This is the alias I've made long time ago for personal use, then I was doing timer 1 1 join $real($1) and everything was working fine. However, there are lots of scripters that don't think that "timer 1 1 join $1" might be a security issue, or they know but they're too lazy to fix. My workaround is not great either, since it won't work properly if $decode is disabled, but some other workarounds can be written to work fine with $decode too.
There should be something like $eval(somestring,-N) which will "unevaluate" N times so I'll do "timer 1 1 join $eval($1,-1)" and have no problems.
If you just want a simple script to join a channel 10 seconds after a user tells you to, I doubt you are going to write such an identifier yourself. Still, people won't know that they have to use $eval(,-1) before passing a variable to a timer or scid function, so I also suggest adding some more information into the help file in the timers section and Multi-Server section telling them to use this $eval(,-N) function before passing variables since they are evaluated two times.

Summary of my suggestion:
1. Adding $eval(something,-N) as an opposite of $eval(something,N)
2. Updating documentation and telling the users the risks about the double-evaluating of variables.

stefys99 #170228 05/02/07 02:48 PM
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031
Using your own example, try using this...

timer 1 1 join $!1

This also works for /scid

From the mirc help file...

Note: If you use a command that contains $identifiers, and you want the identifiers to be evaluated in the target connection, you must pass them as $!identifier to prevent them from being evaluated first in the current connection.

RoCk #170230 05/02/07 02:57 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
Using the $!identifier method can be extremely messy, $eval(code,-N) would be cleaner. See a previous discussion about it here for a full explanation of why.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
RoCk #170231 05/02/07 03:27 PM
Joined: Aug 2005
Posts: 128
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Aug 2005
Posts: 128
Originally Posted By: RoCk
Using your own example, try using this...

timer 1 1 join $!1

This also works for /scid

From the mirc help file...

Note: If you use a command that contains $identifiers, and you want the identifiers to be evaluated in the target connection, you must pass them as $!identifier to prevent them from being evaluated first in the current connection.

That won't work, $1 will be passed to the timer and $1 will be evaluated after one second, but after one second it won't exist anymore.
Example: //tokenize 32 hello world | timer 1 1 echo -a $!1

Also, sorry for the creating of the thread, I didn't know one like this already exists, but it looks like your thread is since 2004 and measures weren't taken so your suggestion was probably forgotten already.


Link Copied to Clipboard