mIRC Home    About    Download    Register    News    Help

Print Thread
Evaluation of #-sign #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

Re: Evaluation of #-sign [Re: gencha] #196114 09/03/08 11:24 PM
Joined: Jul 2006
Posts: 3,558
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,558
Try to use $chr(35) instead of #


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Evaluation of #-sign [Re: Wims] #196115 09/03/08 11:30 PM
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 #.

Re: Evaluation of #-sign [Re: gencha] #196117 10/03/08 12:03 AM
Joined: Sep 2005
Posts: 2,876
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,876
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.

Re: Evaluation of #-sign [Re: gencha] #196122 10/03/08 04:51 AM
Joined: Oct 2003
Posts: 3,918
A
argv0 Offline
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"
Re: Evaluation of #-sign [Re: argv0] #196125 10/03/08 06:37 AM
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?

Re: Evaluation of #-sign [Re: gencha] #196156 10/03/08 11:31 PM
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 )
}