mAway - Multi Network Basic Away

By MoshMage on Jan 28, 2011

Screenshots

mAway is based on Popups and not on dialogs (they're too troublesome to make and code for such a simple thing.) and since i wanted something fast and easy to use, popups are the thing.

either popups or you can simply /maway <+[s]a,o|-b,B>
in which the plus sign (+) means go, minus (-) back.
a = all, o = active; b = all, B=active
s = silence.

so. i'm in a hurry, but i dont to bugger all /maway +sa Upping mAway.mrc ;D
echo:
[11:19] -MoshMage (PTnet)- goneAway: Upping mAway.mrc ;D
[11:19] -MoshMage (APnet)- goneAway: Upping mAway.mrc ;D
[11:20] -MoshMage (Linknet)- goneAway: Upping mAway.mrc ;D

multi-server away script
Alternative nick
Pager, and pager reply [for the lolz]
goes away if raw is triggered. read script for more info

mAway stands for moshAway
this is a oldie, i'm testing this 'post snippet' thing

; multi-away
; coded by MoshMage@PTnet/#PTScripting
;-
; loading: Place this file in /scripts folder
; rename-it to maway.mrc
; go back to mirc, type /load -rs $mircdirscripts\maway.mrc
; d0ne.
;-
; Desc: Multi-server away script. Basic options (alt nick and pager reply), catches for raw statements of away
;-
;
; /maway
; raw away triggers can be removed in lines 26 and 27, just comment them or delete.

on *:load:echo -a <multi-Away> Loaded! use Popups to surf around or /maway

on *:text:**:#:{ if ($me isin $1-) && (!page != $1) && ($away == $true) && ($nick !isin $getOpt(hiled,$network)) { notice $nick $awaymsg .You can use !page <page message> | writeini aopt.ini $network highlighted $addtok($getOpt(hiled,$network),$nick,32) } }
on *:text:**:?:{ if ($away == $true) && ($nick !isin $getOpt(hiled,$network)) { notice $nick $awaymsg .You can use !page <page message> | writeini aopt.ini $network highlighted $addtok($getOpt(hiled,$network),$nick,32) } }
on *:text:!page *:*:{
  if ($away == $true) && ($nick isin $getOpt(hiled,$network)) {
    writeini aopt.ini $network paged $addtok($readini(aopt.ini,$2,paged),$timestamp $nick $2- <;pbreak;>,32)
    notice $nick Your page has been recorded. $getOpt(pageReply,$network)
  }
}

raw 305:*:{ maway -sB }
raw 306:*:{ maway +so -rawAway- Idling for thousands of seconds. }

alias getOpt {
  if (!$1) || (!$2) { halt }
  else {
    if (pager == $1) { return $findtok($readini(aopt.ini,$2,paged),<;pbreak;>,0,32) }
    if (hiled == $1) { return $readini(aopt.ini,$2,highlighted) }
    if (pageReply == $1) { return $readini(aopt.ini,$2,pageReply) }
    if (nnick == $1) { return $readini(aopt.ini,$2,normalNick) }
    if (altnick == $1) { return $readini(aopt.ini,$2,awayNick) }
    if (altpass == $1) { return $readini(aopt.ini,$2,awayPass) }
    if (npass == $1) { return $readini(aopt.ini,$2,normalPass) }
    if (changenick == $1) { return $readini(aopt.ini,$2,changenick) }
    if (nickserv == $1) {
      if ($readini(aopt.ini,$2,nickserv)) { $readini(aopt.ini,$2,nickserv) $3 }
    }
  }
}
alias chngOpt {
  if (!$1) || (!$2) { halt }
  else {
    if (nnick == $1) { 
      var %dump $$?="your Normal nick is $readini(aopt.ini,$2,normalNick) " 
      writeini aopt.ini $2 normalNick %dump 
      var %dump2 $$?="Choose password for %dump2 "
      writeini aopt.ini $2 normalPass %dump2
    }
    if (altnick == $1) {    
      var %dump $$?="your AWAY nick is $readini(aopt.ini,$2,awayNick) " 
      writeini aopt.ini $2 awayNick %dump 
      var %dump2 $$?="Choose password for %dump2 "
      writeini aopt.ini $2 awayPass %dump2
    }
    if (changenick == $1) {
      if ($getOpt(changenick,$2) == 1) { writeini aopt.ini $2 changenick 0 }
      else { writeini aopt.ini $2 changenick 1 }
    }
    if (pReply == $1) {
      var %dump $$?="New page reply"
      writeini aopt.ini $2 pageReply %dump
    }
    if (nickserv == $1) {
      var %dump $$?="Place nickserv login command"
      writeini aopt.ini $2 nickserv %dump $getOpt(nnick,$network) $getOpt(npass,$network)
    }
  }
}
alias maway {
  if (!$1) { echo -a <multi-Away> Sintax Error: /maway <+[s]a,o|-b,B> <awayMsg> }
  else {
    if ($chr(43) isin $1) { 
      if (!$2) { <multi-Away> Sintax Error: /maway <+[s]a,o|-b,B> <awayMsg> | halt }
      ;echo -a <mAway> coder ref: plus signal has been used. $right($1,1) / $scon(0)
      ;ALL out
      if ($right($1,1) == a) { 
        var %x 1
        while (%x <= $scon(0)) {
          if ($scon(%x).network) {
            scid $scon(%x)
            if ($away != $true) {
              away Away atm: $2-
              if (s !isin $1) ame goneAway: $2-
              else echo -a 5 $+ $timestamp - $+ $me ( $+ $network $+ )- goneAway: $2-
              if ($getOpt(changenick,$scon(%x).network) == 1) {
                nick $getOpt(altnick,$scon(%x).network)
                getOpt nickserv $scon(%x).network $getOpt(altpass,$scon(%x).network)
              }
            }
          }
          inc %x
        }
        ;awaynick a
      }
      ;SPECIFIC out
      elseif ($right($1,1) == o) && ($away == $false) {
        away Away atm: $2-
        if (s !isin $1) ame goneAway: $2-
        else echo -a 5 $+ $timestamp - $+ $me ( $+ $network $+ )- goneAway: $2-
        if ($getOpt(changenick,$network) == 1) {
          nick $getOpt(altnick,$network)
          getOpt nickserv $network $getOpt(altpass,$network)
        }

        ;awaynick o
      }
    }
    elseif ($chr(45) isin $1) {
      ;echo -a <mAway> coder ref: minus signal has been used.
      ;ALL in
      if ($right($1,1) === b) {
        var %x 1
        while (%x <= $scon(0)) {
          if ($scon(%x).network) {
            scid $scon(%x)
            if ($away == $true) {
              var %duration $duration($awaytime,2)
              away
              if (s !isin $1) ame is back, away for %duration $+ .
              else echo -a 5 $+ $timestamp - $+ $me ( $+ $network $+ )- is back, away for %duration $+ .
              remini aopt.ini $scon(%x).network highlighted
              if ($getOpt(changenick,$scon(%x).network) == 1) {
                nick $getOpt(nnick,$scon(%x).network)
                getOpt nickserv $scon(%x).network $getOpt(npass,$scon(%x).network)
              }
              if ($getOpt(pager,$scon(%x).network)) { callpager $scon(%x).network }

            }
          }
          inc %x
        }
        ;awaynick b
      }
      ;SPECIFIC own
      if ($right($1,1) === B) && ($away == $true) {
        var %duration $duration($awaytime,2)
        away
        if (s !isin $1) ame is back, away for %duration $+ .
        else echo -a 5 $+ $timestamp - $+ $me ( $+ $network $+ )- is back, away for %duration $+ .
        remini aopt.ini $network highlighted
        if ($getOpt(changenick,$network) == 1) {
          nick $getOpt(nnick,$network)
          getOpt nickserv $network $getOpt(npass,$network)
        }
        if ($getOpt(pager,$network)) { callpager $network }

        ;awaynick B
      }
    }
  }
}
alias getAway {
  if ($1) { var %network $1 }
  var %x 1
  var %return
  while (%x <= $scon(0)) {
    if ($scon(%x).network) {
      scid $scon(%x)
      if ($away == $true) {
        inc %return
        var %return2 $addtok(%return2,$scon(%x),32)
      }
    }
    inc %x
  }
  return %return %return2
}

alias callpager {
  if (!$window(@Pager- $+ $1).name) { 
    set %pager.Network $1
    window -adfl @Pager- $+ $1 100 100 300 100 
  }
  var %x = 1 
  while (%x <= $getOpt(pager,$1)) { 
    var %w $calc(1+ %k)
    echo -s W %w
    var %c $readini(aopt.ini,$1,paged)
    echo -s C %c
    var %k $findtok(%c,<;pbreak;>,%x,32)
    echo -s K %k
    var %y $gettok(%c,%w - %k,32)
    echo -s Y %y
    var %z $remtok(%y,<;pbreak;>,0,32)
    echo -s Z %z
    aline @Pager- $+ $1 %z
    window -b @Pager- $+ $1
    inc %x
  }
  remini aopt.ini $1 paged
}
menu channel,status {
  mAway
  .$iif($away == $false,Go >,Back <):{
    if ($away == $true) { maway -B }
    else { var %dump $$?="Reason:" | maway +o %dump }
  }
  .-
  .Advanced
  ..$iif($away == $false,Go (silence) >,Back (silence) <):{
    if ($away == $true) { maway -sB }
    else { var %dump $$?="Reason:" | maway +so %dump }
  }
  ..-
  ..Go all
  ...normal:maway +a $$?="Reason:"
  ...silenced:maway +sa $$?="Reason:"
  ..back all
  ...normal:maway -b
  ...silenced:maway -sb
  ..cfg $chr(91) $+ $network $+ $chr(93)
  ...Away nick
  ....nick ( $+ $getOpt(nnick,$network) $+ ):chngOpt nnick $network
  ....alt nick ( $+ $getOpt(altnick,$network) $+ ):chngOpt altnick $network
  ....-
  ....$chr(91) $+ $iif($getOpt(changenick,$network) == 1,ON,OFF) $+ $chr(93) $iif($getOpt(changenick,$network) == 1,OFF,ON):chngOpt changenick $network
  ....Nickserv /command:chngOpt nickserv $network
  ...Pager Reply:chngOpt pReply $network
  .Status
  ..$iif($away == $true,Away for $duration($awaytime,2)):halt
  ..$iif($away == $true,$awaymsg):halt
  ..$iif($away == $true,$iif($idle,idle $duration($idle,2))):halt
  ..$iif($getOpt(pager,$network),$getOpt(pager,$network) $+ msg on Pager):callPager $network
  ..-
  ..$iif($gettok($getaway,1,32) > 0,Away in $gettok($getaway,1,32) $+ / $+ $scon(0) Networks,non-away in $scon(0) Networks):halt
}

Comments

Sign in to comment.
Jethro   -  Jan 30, 2011

MoshMage, I apologize for the off-topic posts in regard to Dean's misleading statement of "Regex doesn't belong to or is not made for mIRC." I just couldn't bear the fact that someone boasted a statement without yielding a proper explanation. Again, excuse me for using your thread space for pinpointing a matter.

 Respond  
MoshMage   -  Jan 30, 2011

everyone needs to chill the fuck out or I'll start pruning comments, you loud monkeys. Keep it in-topic and clean.

Please, this is a away snippet post not your Flaming Society or anyother General Discussion.

 Respond  
Jethro   -  Jan 30, 2011

One more thing, what you have quoted above are the reiteration of what PCRE is about and its comparison to PERL and TCL. You're not on the topic of explaining your initial point of why "Regex does not belong to, or is not made for mIRC." You've just re-posted a bunch of stuffs to make your own reply all "rhetorically resourceful." I know all well regex, as a whole, is universal supported by many programming languages.

 Respond  
Jethro   -  Jan 30, 2011

What does my post have to do with "genius?" In what way do I appear to act like one to you? Keep your opinions about me to yourself! You wise punk. You specifically said "Regex doesn't belong to mIRC" without adding any sort of explanation to support your claim. If mIRC adapts to regex, it supports the regex format it's been given to.

 Respond  
_Dean_   -  Jan 30, 2011

when i said that regex dont belong to mIRC, i meant, that regex was not made for mIRC,

Thanks for Philip Hazel for the PCRE regular expression library, copyright by the University of Cambridge, England.

Perl and Tcl regular expressions were derived from a regex library written by Henry Spencer, though Perl later expanded on Spencer's library to add many new features.Philip Hazel developed PCRE (Perl Compatible Regular Expressions), which attempts to closely mimic Perl's regular expression functionality and is used by many modern tools including PHP and Apache HTTP Server.

The use of regular expressions in structured information standards for document and database modeling started in the 1960s and expanded in the 1980s when industry standards like ISO SGML (precursored by ANSI "GCA 101-1983") consolidated.

its better u understand first, what ppl say, and then u act like a ''genius'' or scripting expert, in fact, regex dont belong to mIRC, mIRC adopted it, and suport it, but this language was not made exclusively for mIRC

 Respond  
Jethro   -  Jan 30, 2011

Dean Said:> regular expressions dont belong to mIRCDean, please don't be misleading. Regex belongs to mIRC and mIRC fully supports PCRE (Perl Compatible Regex), except for some character classes used mainly for mIRC. Do some homework before you make a bold statement on a subject.

 Respond  
MoshMage   -  Jan 30, 2011

Everyone needs to stop hading me links on Regex. I know those, i've read those and made no sense of it. Maybe it was because i was high as a kite or because i really didn't care about regex but i grew to 'not liking it'.

Like, if i had a everyday use for it - hell i'd lurve and eat regex. but i don't, yet at least, then i dont think it's something i need to read up JUST now.

 Respond  
_Dean_   -  Jan 30, 2011

but i could never understand regex. it's ugly and its language is a complete mess

regular expressions dont belong to mIRC, many other languages adopted regex, like
PHP, java, PERL, mIRC,python, ruby

so if many languages adopted it, i dont think its useless, or its a "complete mess"

there is another website with more examples

http://www.mircscripts.org/showdoc.php?type=tutorial&id=989

 Respond  
sunslayer   -  Jan 30, 2011

@MoshMage does a pretty good job of explaining regex

 Respond  
MoshMage   -  Jan 30, 2011

Jaytea now.. That's indeed an awesome comment. So, here it goes on explaining (and i rarely do explain my scripts) as it deserves one :)

So, at first the faulty nick catching thing was a problem. i was starting to mess with the things [as i said, this is.. old.] in text and whatnot. but then it hit me, it could be a function.
So, when i was coding the thing i decided to not for "nick" but leave it searching for "nick" in case of anyone making a funny remark about how suckyNickIs because it wont catch the attention of the user.

So, by having it look for nick i can see those funny remarks and it felt good having it that way.

Now, when people speak of nicks that look alike. I'll be honest, i've never seen that occur. EVER. pics or it didnt happen. (and, prove that those arent the same person)

Althought reading your comment it occured to me i could add a thing where it give the user the opp. to choose in what method to use.

Also, if you voice your thoughts like that.. you oughta be shut up most of the time or all hell will break loose on you x)

*note: and i dont know why, but i could never understand regex. it's ugly and its language is a complete mess i cannot make sence of such wild combination of punctuation (and, i never needed it irl)

 Respond  
jaytea   -  Jan 30, 2011

MoshMage, do you expect to be the only one who uses this script? the fact that you decided to share it with us leads me to believe otherwise. i'm sure you can understand how the likelihood of a weakness in a script presenting itself increases as it gets used by a greater number of people :P

false positives/negatives are just a subset of the ways in which a script can be faulty. an ambitious scripter who prides himself on creating well functioning scripts owes it to himself to try and minimize the number of faults in his code, especially if those faults can be predicted. now, if you find that the fault is too complicated to correct, or would otherwise require much more attention than it deserves, then by all means let it slide. but it's useful to try and include a brief comment about it, in case you wish to attend to it later, and so that a user knows what to expect.

there is a flip side to this, however. if i'm presenting what is meant to be a simple example to a fairly ignorant user, the number of obscure ways in which it could fail is always on my mind. nevertheless, it's probably best to not voice my thoughts in those particular cases; they would only serve to confuse the user.

so yeah, just some things to think about :P knowing all the ways in which your code can fail is not easy, and it's something you get better at with experience.

 Respond  
[85]   -  Jan 29, 2011

nice...

 Respond  
MoshMage   -  Jan 29, 2011

Also, why does everyone rant about false positives? I mean, what are the ODDS of "Mosh" and "Moshy" beeing in the same channel and not be the same person?!

So, here in PT we nickname the nickname this script will answer to "bitchMoshMagethere?" or just "MoshMageyy". And.. fuck the false positive. Also, this script is old. Also.. it's a away script ffs it isnt rocket science it can have false positives x)

 Respond  
Jethro   -  Jan 29, 2011

I, as that someone, am gonna tell you that while that regex works for the most part, it won't stop certain characters, especially the punctuation ones, from generating the false positives. If the $me consists of special characters like &Dean ^Dean, it will fail. I have a better one to solve such matter, but I will let you figure that out yourself, since you have no respect for other members of this community by addressing them by their nicknames.

 Respond  
_Dean_   -  Jan 29, 2011

about this

if ($me isin $1-)

someone will say to you about the "false positive" like

if your nick is "nick" then there is someone in room called "nicky" so it will trigger too, my advice is this

if $regex($1-,/\b $+ $me $+ \b/iS) {

of course someone will post another one

 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.