mIRC Home    About    Download    Register    News    Help

Print Thread
#95770 27/08/04 03:51 AM
Joined: Aug 2004
Posts: 2
A
Alkiser Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
A
Joined: Aug 2004
Posts: 2
Howdy,

I'm trying to develop some IRC scripts for my work and have hit a bit of a snag.

I'm trying to do a nick change and want it to read the current users nick and append the text I want after it. So I thought this would work:

nick $me_sometext but only get an error

$me_sometext Erroneous nickname.

I noticed that with passed in paramater variables it seems to work... ie.

/alias /cookie say Don't eat $1's cookie

so if I went /cookie Brian it would produce:

Don't eat Brian's cookie

Just curious why you can't append things to the predefined variables... or if there is a way.. how?

#95771 27/08/04 04:06 AM
Joined: Jun 2004
Posts: 87
B
Babel fish
Offline
Babel fish
B
Joined: Jun 2004
Posts: 87
wat do u mean append things i could help ya out here but ya gotta try to use dummer turms lol or explane more of wat ur trying to do (i suggest talk dummer lol)

#95772 27/08/04 04:13 AM
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
As a rule of thumb, assume the variable to not have the appending capabilites you see with $1. Almost all do not have the capability, with few exceptions. Whenever you wish to prefix ro append a value to an identifier, use either $+() (concatenation identifier) or the $+'s. Using your eexample, the following would also be acceptable:

alias cookie { say Don't eat $1's cookie }
alias cookie { say Don't eat $1 $+ 's cookie }
alias cookie { say Don't eat $+($1,'s) cookie }

The exceptions (generally) to these however are as follows:

Token identifiers - $1, $2, 3, ....
Directories -- $mircdir, $mididir, $mircexe, $mircini, etc
There are a few others, but just to give you the idea.

So again, to make your problem go away, use either $me $+ <text> or $+($me,<text>)


-KingTomato
#95773 27/08/04 04:27 AM
Joined: Aug 2004
Posts: 2
A
Alkiser Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
A
Joined: Aug 2004
Posts: 2
Thanks King, that worked out perfectly. Gives me a better understanding of mirc scripting aswell.

This certainly isn't the PHP programming I'm used to...


Link Copied to Clipboard