mIRC Home    About    Download    Register    News    Help

Print Thread
escape character #240243 09/01/13 08:51 PM
Joined: Aug 2012
Posts: 57
Maelish Offline OP
Babel fish
OP Offline
Babel fish
Joined: Aug 2012
Posts: 57
If I do something like this:

Quote:

on *:FILESENT:*.*:/msg #channel I sent the file to $nick.


It'll drop $nick because there is a period. I know that I have to remove the period. However, is there an escape character I can put there so the period would show up?


Find Gamers, my player finder for tabletop RPGers and Wargamers.
Re: escape character [Re: Maelish] #240244 09/01/13 09:35 PM
Joined: Feb 2011
Posts: 326
K
KindOne Offline
Fjord artisan
Offline
Fjord artisan
K
Joined: Feb 2011
Posts: 326
Code:
on *:FILESENT:*.*:msg #channel I sent the file to $nick $+ .

You don't need to use "/" inside of scripts.
If this is for multiple channels might want to look into using "$chan" instead of "#channel".

/help $+

Examples:
Shows "Hello":
Code:
//echo -ag H $+ e $+ l $+ l $+ o 

Show your main nick:
Code:
//echo -ag My name is $mnick $+ . 



irc.swiftirc.net #msl (mIRC Scripting Language)
Re: escape character [Re: Maelish] #261267 25/08/17 02:07 PM
Joined: Aug 2012
Posts: 57
Maelish Offline OP
Babel fish
OP Offline
Babel fish
Joined: Aug 2012
Posts: 57
It's been a long time since I've looked at this. It's my fault for not being clear. So let's ask this again but a different way.

The goal is to have use color codes or bold in statements similar to those below. I've noticed however that when using them, it seems to break things.

The first line has no control characters. The second have bold wrapped around them.
Code:
say test $$1, text
say test $$1, text
say test $$1 , text
say test $$1 $+ $chr(44) text

Produces this:
Code:
test username, text
test $$1, text
test $$1 , text
test $$1, text


Usually you'd use an escape sequence in most scripting languages, like the `\` in php. Is there an escape character or escape sequence for mirc scripting? If not, how would you get around that little irritation?


Find Gamers, my player finder for tabletop RPGers and Wargamers.
Re: escape character [Re: Maelish] #261269 25/08/17 04:06 PM
Joined: Jan 2004
Posts: 1,234
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,234
Mirc is very liberal when allowing names of aliases. $nick3 is a valid alias name, so when you touch things to $nick you're either getting blank or getting an identifier warning that you used an invalid warning. If you want to have extraneous stuff touching the name of an alias, there are a few cases like $mircdirtest where test displays along with the display of the pathname, but for the most part if you want to have something touching an identifier/variable/alias/command name, use $+(stuff,$$1,other stuff) to concatenate.

If you want an escape character to have special symbols not treated as such, you can use $chr(124) or for to have the pipe symbol displayed without being something which allows 2 commands on the same line. You can sometimes use $eval() to escape characters like the pipe symbol, but it doesn't always give expected results, and can't escape all characters. i.e. these don't work:

//echo -a $eval( , 1 )
//echo -a $eval($chr(40) #channel,2)

and this works
//echo -a $( ) )
but this doesn't
//echo -a $( ( )

But that's not an escape character in your context where you're wanting to have stuff touching an $identifier or %variable without being interpreted as being part of the name.

Edit:
//echo -a $( ) )
is not working, it is simply showing the trailing parenthesis past the $( )


Last edited by maroon; 25/08/17 04:12 PM.