mIRC Home    About    Download    Register    News    Help

Print Thread
#196112 09/03/08 11:04 PM
Joined: Nov 2004
Posts: 22
G
gencha Offline OP
Ameglian cow
OP Offline
Ameglian cow
G
Joined: Nov 2004
Posts: 22
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

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
Try to use $chr(35) instead of #


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Nov 2004
Posts: 22
G
gencha Offline OP
Ameglian cow
OP Offline
Ameglian cow
G
Joined: Nov 2004
Posts: 22
Like, how? The user puts in the #.

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
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.

Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
# 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.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Nov 2004
Posts: 22
G
gencha Offline OP
Ameglian cow
OP Offline
Ameglian cow
G
Joined: Nov 2004
Posts: 22
Well, this is the first issue that popped up. Do you have a suggestion maybe?

Joined: Nov 2004
Posts: 22
G
gencha Offline OP
Ameglian cow
OP Offline
Ameglian cow
G
Joined: Nov 2004
Posts: 22
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