BloopyAFK away script - manage nicks across multiple networks

Published  Dec 15, 2013
Updated  Dec 15, 2013
0  0

Description

An away script which stores here and away nicknames for every network you're on, and allows you to switch nicks across all networks at once. You can also turn the script off for individual networks.

If you have the script enabled on a particular network and change your nick manually using the /nick command, the script will change it back within a minute. Set your desired nick using the script instead.

;
; Away script by Bloopy - http://www.bloopy.org
;
; - Set different here and away nicks across multiple networks
; - Go away or return with 2 clicks in a channel or server window
; - Set your away nick to the same as your here nick and it becomes a nick restorer
;     (eg. when you get reconnected with your alternate nick after a disconnection) 
;

on *:LOAD: {
  set %BloopyAFK.suffix [A]
  BloopyAFK.suffix

  set %BloopyAFK.status here

  scid -at1 BloopyAFK.init
}

alias BloopyAFK.suffix {
  var %suffix = $?="Enter the default suffix to add to your nickname when you go away, eg. [A] or ^away:"
  if (%suffix) {
    set %BloopyAFK.suffix %suffix
  }
}

on *:UNLOAD: {
  .timerBloopyAFK off
  unset %BloopyAFK.*
}

on *:CONNECT: {
  BloopyAFK.init
}

; initialise any uninitialised variables for a network
alias BloopyAFK.init {  
  if (!$timer(BloopyAFK)) {
    .timerBloopyAFK -oi 0 60 scid -at1 BloopyAFK.updatenick
  }

  set %BloopyAFK.server. [ $+ [ $cid ] ] $server($server).group
  if (!%BloopyAFK.server. [ $+ [ $cid ]  ]) {
    if ($network) {
      set %BloopyAFK.server. [ $+ [ $cid ] ] $network
    }
    else {
      set %BloopyAFK.server. [ $+ [ $cid ] ] $server
    }
  }

  if (!%BloopyAFK.state. [ $+ [ %BloopyAFK.server. [ $+ [ $cid ] ] ] ]) {
    set %BloopyAFK.state. [ $+ [ %BloopyAFK.server. [ $+ [ $cid ] ] ] ] on
  }

  if (!%BloopyAFK.herenick. [ $+ [ %BloopyAFK.server. [ $+ [ $cid ] ] ] ]) {
    set %BloopyAFK.herenick. [ $+ [ %BloopyAFK.server. [ $+ [ $cid ] ] ] ] $me
  }

  if (!%BloopyAFK.awaynick. [ $+ [ %BloopyAFK.server. [ $+ [ $cid ] ] ] ]) {
    set %BloopyAFK.awaynick. [ $+ [ %BloopyAFK.server. [ $+ [ $cid ] ] ] ] $me $+ %BloopyAFK.suffix
  }
}

alias BloopyAFK.toggleaway {
  if (%BloopyAFK.status == here) {
    set %BloopyAFK.status away
  }
  else {
    set %BloopyAFK.status here
  }

  scid -at1 BloopyAFK.updatenick
}

; check current nick on the network and make a change if needed
alias BloopyAFK.updatenick {
  if (%BloopyAFK.state. [ $+ [ %BloopyAFK.server. [ $+ [ $cid ] ] ] ] == on) {
    if (%BloopyAFK.status == here) {
      if ($me != %BloopyAFK.herenick. [ $+ [ %BloopyAFK.server. [ $+ [ $cid ] ] ] ]
          && $comchan(%BloopyAFK.herenick. [ $+ [ %BloopyAFK.server. [ $+ [ $cid ] ] ] ],0) == 0) {
        nick %BloopyAFK.herenick. [ $+ [ %BloopyAFK.server. [ $+ [ $cid ] ] ] ]
      }
    }
    else {
      if ($me != %BloopyAFK.awaynick. [ $+ [ %BloopyAFK.server. [ $+ [ $cid ] ] ] ]
          && $comchan(%BloopyAFK.awaynick. [ $+ [ %BloopyAFK.server. [ $+ [ $cid ] ] ] ],0) == 0) {
        nick %BloopyAFK.awaynick. [ $+ [ %BloopyAFK.server. [ $+ [ $cid ] ] ] ]
      }
    }
  }
}

alias BloopyAFK.togglestate {
  if (%BloopyAFK.state. [ $+ [ %BloopyAFK.server. [ $+ [ $cid ] ] ] ] == on) {
    set %BloopyAFK.state. [ $+ [ %BloopyAFK.server. [ $+ [ $cid ] ] ] ] off
  }
  else {
    set %BloopyAFK.state. [ $+ [ %BloopyAFK.server. [ $+ [ $cid ] ] ] ] on
  }
}

alias BloopyAFK.herenick {
  set %BloopyAFK.herenick. [ $+ [ %BloopyAFK.server. [ $+ [ $cid ] ] ] ] $$1
  BloopyAFK.updatenick
}

alias BloopyAFK.awaynick {
  set %BloopyAFK.awaynick. [ $+ [ %BloopyAFK.server. [ $+ [ $cid ] ] ] ] $$1
  BloopyAFK.updatenick
}

menu channel,status {
  BloopyAFK, $iif(%BloopyAFK.status == here, I'm going away, I'm baaaaaack!):BloopyAFK.toggleaway
  BloopyAFK Settings
  .$submenu($BloopyAFK.SettingsMenu($1))
  .Default away nick suffix ( $+ %BloopyAFK.suffix $+ ):BloopyAFK.suffix
  .Unload BloopyAFK.mrc: if ($?!="Are you sure you want to unload BloopyAFK?") unload -rs BloopyAFK.mrc
}

alias BloopyAFK.SettingsMenu {
  if ($status == connected) {
    if ($1 == end) { return - }
    elseif ($1 == 1) { return % $+ BloopyAFK.server. [ $+ [ $cid ] ] - $!iif(% $+ BloopyAFK.state. [ $+ [ % $+ BloopyAFK.server. [ $+ [ $cid ] ] ] ] == on, turn off, turn on) :BloopyAFK.togglestate }
    elseif ($1 == 2) { return % $+ BloopyAFK.server. [ $+ [ $cid ] ] - here nick ( $+ %BloopyAFK.herenick. [ $+ [ % $+ BloopyAFK.server. [ $+ [ $cid ] ] ] ] $+ ):BloopyAFK.herenick $!$?=" $+ %BloopyAFK.server. [ $+ [ $cid ] ] - nickname while here:" }
    elseif ($1 == 3) { return % $+ BloopyAFK.server. [ $+ [ $cid ] ] - away nick ( $+ %BloopyAFK.awaynick. [ $+ [ % $+ BloopyAFK.server. [ $+ [ $cid ] ] ] ] $+ ):BloopyAFK.awaynick $!$?=" $+ %BloopyAFK.server. [ $+ [ $cid ] ] - nickname while away:" }
  }
}

Screenshots

Comments

Sign in to comment.
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.