mIRC Home    About    Download    Register    News    Help

Print Thread
#238559 08/08/12 04:26 PM
Joined: Jan 2012
Posts: 54
J
Babel fish
OP Offline
Babel fish
J
Joined: Jan 2012
Posts: 54
Okay. So I'm trying to code a simple replacement script... but what I've come up with so far is rather limiting in what I can do with it, and it gives me some side effects.

on *:INPUT:*: {
if (/me == $1) { return }
elseif (/* iswm $1) {
$$1 $replace($2-,",",::,6::)
halt
}
}

The reason I have it like this is I use it for aliases for roleplay.

like instead of typing a character name or using an IRC nick..

I'll type..

/dude hey!

and it'll come out

<That Dude> hey!

Now my script replaces :: with a colored version and " takes away all colors for text. I would like to somehow make it work with brackets ... for thought bubbles like .o( blah ) but with mirc coding it recognizes ( ) for code... so I can't do that. D:

Also when I type / and hold control to show the command instead of USING it, it ignores the control key and uses the command anyway..

Just curious if anyone had suggestions. I know it's a bit ridiculous. smile

Oh and my aliases are something like

/dude say <That Dude> $1-

Last edited by Jaillynian; 08/08/12 04:28 PM.
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
For characters that can't be included directly, such as parentheses, just use the $chr() value for them.

( = $chr(40)
) = $chr(41)

For example:
$replace($1-,$chr(40),<,$chr(41),>)


Invision Support
#Invision on irc.irchighway.net
Joined: Jan 2012
Posts: 54
J
Babel fish
OP Offline
Babel fish
J
Joined: Jan 2012
Posts: 54
Thanks. That might help me with... part of my problem but not the rest sadly.

Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
OH MY LORD.

ON INPUT is not meant to parse commands. Don't implement your own command parser. This is what aliases are for. Use it:

Code:
alias dude say $replace($1-,",",::,6::)


/dude hey!

If you already have a dude alias, just add the $replace part to your existing code and then you don't need a crazy on input script to do what aliases are already meant to do.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Jan 2012
Posts: 54
J
Babel fish
OP Offline
Babel fish
J
Joined: Jan 2012
Posts: 54
Eh I have 300 dudes technically :P

Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Sounds like you should refactor them to use the same core code, then.

Code:
alias dude_text { return $replace($1-,",",::,6::) }
alias dude1 { say Something with $dude_text($1-) }
alias dude2 { say Something else with $dude_text($1-) }
alias dude3 { say Something else else with $dude_text($1-) }
alias dude4 { say Something else else else with $dude_text($1-) }
alias dude5 { say Something .... with $dude_text($1-) }
...


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
Joined: Jan 2012
Posts: 54
J
Babel fish
OP Offline
Babel fish
J
Joined: Jan 2012
Posts: 54
I'll test that out.

Tested it! Thanks. It works great.

Last edited by Jaillynian; 09/08/12 11:58 PM.
Joined: Jan 2012
Posts: 54
J
Babel fish
OP Offline
Babel fish
J
Joined: Jan 2012
Posts: 54
a friend of mine also pointed out something called regsub, saying it might turn off color coding after the second :: or so... but I have no idea how.. oh well I have things working in a way, so not gonna fuss.

Joined: Jan 2012
Posts: 54
J
Babel fish
OP Offline
Babel fish
J
Joined: Jan 2012
Posts: 54
I know I said I got it working before, but I felt like I should ask another question!

I want to make it work with $readini ... and I don't know how to do that at all.


Link Copied to Clipboard