mIRC Home    About    Download    Register    News    Help

Print Thread
#196112 09/03/08 11:04 PM
G
gencha
gencha
G
In my script i have a list of identifier names that are supposed to be used to process messages a user writes.
These identifiers fulfill purposed like nick-completion, replacing acronyms or replacing common typos.

To illustrate, i have this alias in the script:
Code:
; Applies a single input processor to the globally stored input text
alias _applyProcessor {
  %g_inputText = $( $+( $, $1, %OPEN_PARANTHESIS, %g_inputTarget, %COMMA, %g_inputText, %CLOSE_PARANTHESIS ), 2 )
}


I found it to be the best solution to take a string, turn it into an identifier and apply it.

Sadly it needs $eval() (or $()), which results in unwanted behavior. Namely, it will replace the #-sign with the current channel name.

I wonder how to get around that. And help ideas are appreciated wink

#196114 09/03/08 11:24 PM
Joined: Jul 2006
Posts: 4,042
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,042
Try to use $chr(35) instead of #


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
G
gencha
gencha
G
Like, how? The user puts in the #.

#196117 10/03/08 12:03 AM
Joined: Sep 2005
Posts: 2,630
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,630
Try replacing the # characters with a character you know won't appear in the text, like a linefeed.

Code:
alias _applyProcessor {
  %g_inputText = $replace($( $+( $, $1, %OPEN_PARANTHESIS, %g_inputTarget, %COMMA, $replace(%g_inputText,$(#,),$lf), %CLOSE_PARANTHESIS ), 2 ),$lf,$(#,))
}


Whether this works perfectly will depend on what you're calling, what it does, and what it returns.

#196122 10/03/08 04:51 AM
Joined: Oct 2003
Posts: 3,641
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,641
# is barely the least of your concerns if you're evaluating non-code as mIRC script... you should take a hard look at your design.

G
gencha
gencha
G
Well, this is the first issue that popped up. Do you have a suggestion maybe?

#196156 10/03/08 11:31 PM
G
gencha
gencha
G
argv0 helped me solved this. This is the final solution:
Code:
alias _applyProcessor {
  %g_inputText = $( $+( $, $1, %OPEN_PARANTHESIS, %g_inputTarget, %COMMA, $( %g_inputText, 0 ), %CLOSE_PARANTHESIS ), 2 )
}


Link Copied to Clipboard