Meh, simple /away snippet. Load it into alias' or simple put the beginning 'Alias Away' and throw it into remotes. From there just type /away , or just /away if you are returning.
away {
if ($1-) {
if (!$away) {
tnick $me $+ $chr(124) $+ $$?="Please enter an Addon for your nick (away/sleep/brb):"
msg $active [Away] I am now away. Reason: $1- - Time: $time(hh:nn:sstt)
away $1-
halt
}
else { echo -a [Away] Error: You are already away - To return, just type: /away | halt }
}
elseif ($away) {
nick $mnick
msg $active [Away] I have returned from: $awaymsg ( $+ $duration($awaytime) $+ )
away
halt
}
else { echo -a [Away] Error: You are not away - To go away: /away reason | halt }
}
Also, I found a bug though. If you are not away and then you enter /away, you'll get the output of > [Away] I have returned from: (0secs)So you need to make the else an elseif to check that if you are in fact away instead:
elseif ($away) {
nick $mnick
msg $active [Away] I have returned from: $awaymsg ( $+ $duration($awaytime) $+ )
away
halt
}
This also ensures that you don't start the nick $mnick change and /away routine for nothing upon entering /away when you aren't away by accident.
Seeing all the halts, which aren't really needed, you might as well use goto if you fancy them:
away {
goto $iif($1-,x,y)
:x
if (!$away) {
tnick $me $+ $(|) $+ $$?="Please enter an Addon for your nick (away/sleep/brb):"
msg $active [Away] I am now away. Reason: $1- - Time: $time(hh:nn:sstt)
away $1-
}
else echo -a [Away] Error: You are already away - To return, just type: /away
halt
:y
nick $mnick
msg $active [Away] I have returned from: $awaymsg ( $+ $duration($awaytime) $+ )
away
halt
}
You know, I've just realized that the $$? isn't necessary, because you can specify it through $1 as such:
tnick $+($me,|,$1-)
so when you enter, for example, /away brb, the script will then change it to the temp nick Jethro|brb
I just don't see the necessity to go the extra mile to engage in a popup prompt, especially this is simply a self-trigger alias.
Well, it'll work, but according to RusselB, and I assisted someone at the forum awhile back, and I quote, "If you don't use the ! in front of the command in these circumstances, mIRC will just keep calling the alias rather than the internal command." That is to say, if your alias command is the same as mirc's default one. You can reference to this post below and you'll see what I mean:
http://www.hawkee.com/phpBB2/viewtopic.php?p=109349&highlight=#109349
/tnick is a command; it's not an identifier. MoshMage, I didn't make the rule; it's part of mIRC's coding grammar.