simple but effective away script

By a13x on Oct 31, 2008

simple but effective away script
copy and paste into a new mirc script file
/away "reason" , will mark you as away, give an away msg on all chans on all netws, if someone highlights you, query's you or notices you it will send a one time away msg to them,
/back to send back msg to all chans all netws, no longer marked as being away, says how long you were gone and reason
/brb does same as away but it says you will brb instead of away
updates:
will set you away if you dont type anything for 10 mins
when you join a netw it will check if you are away and if you are mark you as away on that netw
if you use the /away /brb or /back command when you are allready/not away then it will echo error message
updated:
new colour scheme
updates:
if you just type /away or /brb with no reason it will set reason as away or brb
quit message added if you dont type any message it will type preset message

1st snippet so go easy on me :D
any suggestions would be nice

alias away { if (!%away) { 
    if ($1 == $null) { 
    set %away Away }
    else { set %away $1- }
    gamsg 14I am now away10! 14Reason: 10 $+ %away
    set %awaytime $ctime 
  scon -at1 !away %away } 
  elseif (%away) { 
  echo -a 2>10>7Error10<2< 14You are allready 10Away }
}
alias back { if (%away) { gbmsg 14I am now back from: 10 $+ %away 14- I was away for 10 $+ $duration($calc($ctime - %awaytime)) 
    unset %away
    unset %pm.*
  scon -at1 !away }
  elseif (!%away) {
  echo -a 2>10>7Error10<2< 14You are not 10Away }
} 
alias brb { if (!%away) { 
    if ($1 == $null) { 
    set %away Brb }
    else { set %away $1- }
    gbrbmsg 14Be right back from: 10 $+ %away 
    set %awaytime $ctime 
  scon -at1 !away %away } 
  elseif (%away) { 
  echo -a 2>10>7Error10<2< 14You are allready 10Away }
}
on *:TEXT:*:?:{  
  if (%away) && (!%pm. [ $+ [ $nick ] ]) { 
    set %pm. $+ $nick $true 
    msg $nick 2>10>7Away10<2< 14I am currently 10away14, I have been away for 10 $duration($calc($ctime - %awaytime)) 14, leave me a message and i will reply when i get back - 2(one time response to private message) 
  }
}
on *:NOTICE:*:?:{ 
  if (%away) && (!%pm. [ $+ [ $nick ] ]) { 
    set %pm. $+ $nick $true 
    notice $nick 2>10>7Away10<2< 14I am currently 10away14, I have been away for 10 $duration($calc($ctime - %awaytime)) 14, leave me a message and i will reply when i get back - 2(one time response to notice)
  }
} 
on $*:text:$($+(/,$me,|,$mnick,/iS)):#:{ 
  if (%away) && (!%pm. [ $+ [ $nick ] ]) { 
    set %pm. $+ $nick $true | notice $nick 2>10>7Away10<2< 14I am currently 10away14, I have been away for 10 $duration($calc($ctime - %awaytime)) 14, leave me a message and i will reply when i get back - 2(one time response to highlight)
  }
}
alias gamsg scon -at1 /amsg 2>10>7Away10<2< $$1-
alias gbmsg scon -atl /amsg 2>10>7Back10<2< $$1-
alias gbrbmsg scon -atl /amsg 2>10>7Brb10<2< $$1-
on *:INPUT:*:{
  .timeraway 0 1200 autoaway
}
alias autoaway {
  if (!%away) {
    away auto away after 20 mins idle
  }
}
on *:CONNECT:{ if (%away) {
    !away %away
  }
}
alias quit { 
  if ($1 == $null) { 
    amsg 2>10>7AMSG10<2< 14bye 
  !quit Going offline, memo me and ill get back to you } 
  else { 
    amsg 2>10>7AMSG10<2< 14 $+ $1-
    !quit Going offline, memo me and ill get back to you
  }
}

Comments

Sign in to comment.
xt24   -  Apr 13, 2009

good script

 Respond  
RusselB   -  Nov 09, 2008

if anyone got something to add on to block the msgs to certain chans on certain netws would be nice The only way to do this, is to loop through the channels that you are on and then check if the channel (via the loop) is one you want to send the message to or not.
For an idea on how to do this, check my Common Channel Message snippet http://www.hawkee.com/snippet/2746/

 Respond  
a13x   -  Nov 09, 2008

the on connect means when i connect tot a new netw and if %away is set meaning im away itll set an away reason and mark as away on the new netw, i made it to be simple :D
edited it for new colour theme, the old one was abit boring
also debugged some problems

 Respond  
irchainscriptz   -  Nov 07, 2008

Yes very true indeed RusselB, and i like simple away's as i just did one for a friend simple away dialog. has away and has %dur and name change....simple but yet to the point.but keep working on it a13x.

 Respond  
RusselB   -  Nov 07, 2008

To my knowledge, it's impossible for you to be away on a network before you connect to it, and this makes sense from a logical point of view, since you have to be connected to the network in order to mark yourself away.

 Respond  
a13x   -  Nov 07, 2008

oh yeh i musta put them in that aswel by accident lol
added an on connect so when you connect and your away it marks you as being away on that netw, i also added a couple of missing } brackets :D

 Respond  
guest598594   -  Nov 03, 2008
  if (!%away) && (!%pm. [ $+ [ $nick ] ]) { 

That's saying "if (%away == $null && %pm. [ $+ [ $nick ] ] != $null)"

You only use ! to negate it.

if (%away) --> if (%away != $null) --> "if %away has a value"
if (!%away) --> if (%away == $null) --> "if %away doesn't have a value (or zero)"

So you shouldn't have the ! in checking %away

 Respond  
a13x   -  Nov 03, 2008

kk script edited to use !%away (didnt know about that one ty) and taken out pipes (good point about debugging / editing)
yes it does presume that if you are away on one network, then you are away on all networks.
that is because normally im either active irc (all networks i use) or not active on all networks, of course if you wanted to make it individual networks you can just remove all the the scon -at1 from the script :D
if anyone got something to add on to block the msgs to certain chans on certain netws would be nice as i havent done while loops yet and dont have the time (at the moment) to try some out.

 Respond  
RusselB   -  Nov 01, 2008

Personally I hate codes that use pipes | to separate commands when braces work.
This is due to the fact that a line with (for example) 5 commands on one line separated with pipes will show that one line if there's a problem with any of the 5 commands.
Using braces allows each command to be put on a different line, therefore only giving the line of the command that's not working in an error message.
Makes codes, imo, easier to debug, fix, and/or alter.

Also noted that this presumes that if you are away on one network, then you are away on all networks.

 Respond  
guest598594   -  Oct 31, 2008

When checking if things are $null, you can just negate it with !.

Ex:

if (%away != $null) && (%pm. [ $+ [ $nick ] ] == $null) {

can be

if (%away) && (!%pm. [ $+ [ $nick ] ]) {
 Respond  
a13x   -  Oct 31, 2008

if anyone got something to add on to block the msgs to certain chans on certain netws would be nice

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.