All pastes #975573 Raw Edit

Miscellany

public text v1 · immutable
·published 2008-04-07 17:29 UTC
rendered paste body
;Away script by bob909 - Version 1.1
;To use the script: Either: Right-Click and Select 'Away System' or /a
;To set colours use: Either: Right-Click and Select 'Colour Settings' or /colour settings
;Butcher the script as much as you like but don't pass it off as your own
;I have checked the script as fully as possible and therefore accept no responsibility for any viruses being on your computer as a result of using this script
;If you want to talk to me PM me on Swiftirc (irc.swiftirc.net) or Code-Link (irc.codelink.info), nick: bob909


;########################Please Don't edit below this line otherwise up could mess the script up#############################
;########################Colour Settings#####################################################################################
;########################Section 1 Aliases###################################################################################
alias colour_time {
  if ($1 isnum 1-15) set %time-colour $1
  else echo -a You need to state a whole number between 1 & 15 (inclusive)
}

alias colour_reason {
  if ($1 isnum 1-15) set %reason-colour $1
  else echo -a You need to state a whole number between 1 & 15 (inclusive)
}

alias colour_other {
  if ($1 isnum 1-15) set %other-colour $1
  else echo -a You need to state a whole number between 1 & 15 (inclusive)
}

alias colour-settings {
  dialog -m colour colour
}

;alias cs {
;  colour-settings
;}

;#########################Section 2 - Dialog######################################
dialog colour {
  title "Colour Settings"
  size -1 -1 100 100
  option dbu
  button "OK", 1, 42 80 25 15, ok
  button "Cancel", 2, 70 80 25 15, cancel
  text "Time Colour:", 3, 10 10 30 13
  edit "6",4, 50 9 10 10
  text "Colour Reason:", 5, 10 25 40 13
  edit "6", 6, 50 24 10 10
  text "Other Reason:", 7, 10 40 40 13
  edit "6", 8, 50 39 10 10
  text "The numbers entered as default will give the away message the normal colour for the command /me", 9, 10 60 80 13
}

;#########################Section 3 - Dialog processing##################################
on *:DIALOG:colour:sclick:1: {
  if ($did(4) isnum 1-15) && ($did(6) isnum 1-15) && ($did(8) isnum 1-15) {
    set %time-colour $did(4)
    set %reason-colour $did(6)
    set %other-colour $did(8)
    echo -a This is an example away message to show you what yours will look like
    echo -a 6 $me $+($chr(3),%other-colour) is now away reason: $+($chr(3),%reason-colour,AFK,.) $+($chr(3),%other-colour) I left at $+($chr(3),%time-colour) $time
  }
  else echo -a The only numbers that will work in these edit boxes are 1-15 inclusive. What you have entered will not work
}


;##############################Main Part Of Script###############################
;##############################Section 1 - Aliases###############################
alias setaway {
  if (%reason-colour == $null) || (%other-colour == $null) || (%time-colour == $null) halt
  else {
    nick $+($1)
    writeini -n away.ini $network nick $me
    writeini -m away.ini $network previousawaynick $1
    away $2- 
    writeini -n away.ini $network reason $2-
    writeini -n away.ini $network time $time
    ame $+($chr(3),%other-colour) is now away reason $+($chr(3),%reason-colour,$2-,.) $+($chr(3),%other-colour) I left at $+($chr(3),%time-colour) $+($time,.)
    set %away 1
  }
}

alias back {
  nick $readini(away.ini,$network,nick)
  ame $+($chr(3),%other-colour) is now back from $+($chr(3),%reason-colour) $readini(away.ini,$network,reason). $+($chr(3),%other-colour) Left at $+($chr(3),%time-colour) $readini(away.ini,$network,time). $+($chr(3),%other-colour) I was away for $+($chr(3),%time-colour) $duration($awaytime)
  away
  set %away 0
  if ($timer($network) == $null) halt
  else $+(timer,$network) off
}

alias a {
  dialog -m away away
}

alias calctimer {
  writeini -n away.ini $network timer $calc($did(10)*60)
}

;#######################Section 2 - Dialogs########################

dialog away {
  title "Away System - v1.1"
  size -1 -1 140 150
  option dbu
  button "OK", 1, 100 130 20 15, Okay
  button "Set Away", 3, 25 130 30 15,
  button "Back", 4, 5 130 20 15, Back
  tab "Main", 13, 5 0 130 110
  tab "Announcing", 14
  ;  tab "Logger", 15
  text "Away Nickname:", 5, 10 50 56 13, tab13
  edit "AFK", 6, 10 80 115 25, tab13 multi
  text "Away Message:", 2, 10 70 40 8, tab13
  edit "", 7, 50 50 56 13, tab13
  check "Use previous away nickname?", 8, 10 35 90 13, tab13
  check "Change nick?", 16, 10 23 105 13, tab13
  text "Announce that you are away every:", 9, 10 40 90 13, tab14
  edit "0", 10, 100 38 13 10, tab14
  text "Min(s)", 11, 115 40 18 13, tab14
  check "Announce Mulitple Times?", 12, 10 53 100 13, tab14
  box "Nickname Control", 17, 8 15 110 53, tab13
  text "Status:", 19, 10 115 20 10
  edit "", 20, 30 115 30 10
  edit "", 21, 70 115 60 10

}


;###################################Section 3 - Dialog Processing########################

on *:DIALOG:away:sclick:12: {
  if ($did(12).state == 1) did -n $dname 10
  else did -m $dname 10
}

on *:DIALOG:away:sclick:3:{
  if (%away == 1) {
    did -vmra $dname 21 You are already away
    timer 1 3 did -rhv $dname 21
  }
  else {
    if ($did(7) == $null) {
      did -vmra $dname 21 No Away Nick Entered
      timer 1 3 did -rv away 21
    }
    else {
      did -mra $dname 20 Away
      if ($did(10) == 0) {
        setaway $did(7) $did(6)
      }
      else {
        setaway $did(7) $did(6)
        calctimer 
        $+(timer,$network) 0 $readini(away.ini,$network,timer) ame $+($chr(3),%other-colour) I am currently away. $+($chr(3),%reason-colour) For reason: $did(6). 6 (Announcing every $did(10) minutes)
      }
    }

  }
}

on *:DIALOG:away:mouse:1-21: {
  if (%away == 1) did -mra $dname 20 Away
  else did -mra $dname 20 Not Away
}

on *:DIALOG:away:init:0: {
  did -c $dname 16
  did -m $dname 21
  did -m $dname 10
  if (%away == 1) did -mra $dname 20 Away
  else did -mra $dname 20 Not away
}

on *:DIALOG:away:sclick:16: {
  if ($did(16).state == 1) did -rn $dname 7
  else did -mra $dname 7 $me
}

on *:DIALOG:away:sclick:8: {
  if ($did(8).state == 1) {
    did -m $dname 7
    did -ra $dname 7 $readini(away.ini,$network,previousawaynick)
  }
  else {
    did -rn $dname 7
  } 
}


on *:DIALOG:away:sclick:4:{
  if (%away == 0)  { 
    did -vmra $dname 21 You are not away!
    timer 1 3 did -rvh $dname 21
  }
  else {
    back
    did -vmra $dname 20 Not away
  }
}

on *:TEXT:*:?: {
  if (%away == 1) {
    inc %logger 
  }
}
;################################Section 4 - Popups########################

menu * {
  -
  .Away System:/a
  .Colour Settings:/colour-settings
}

;##############################Loading script##################################
on *:LOAD:{
  set %other-colour 6
  set %reason-colour 6
  set %time-colour 6
  dialog -m fcolour
}

dialog fcolour {
  title "Away system loaded - Enter Colours"
  size -1 -1 140 100
  option dbu
  button "OK", 1, 42 80 25 15, ok
  text "Time Colour:", 3, 10 10 30 13
  edit "6",4, 50 9 10 10
  text "Colour Reason:", 5, 10 25 40 13
  edit "6", 6, 50 24 10 10
  text "Other Reason:", 7, 10 40 40 13
  edit "6", 8, 50 39 10 10
  text "The numbers entered as default will give the away message the normal colour for the command /me", 9, 5 55 110 20
  text "Hi, This is my away system hope you like it. Any feed-back PM me (bob909) on SwiftIRC or Code-Link", 10, 65 10 75 45
}

on *:DIALOG:colour:sclick:1: {
  if ($did(4) isnum 1-15) && ($did(6) isnum 1-15) && ($did(8) isnum 1-15) {
    set %time-colour $did(4)
    set %reason-colour $did(6)
    set %other-colour $did(8)
    echo -a This is an example away message to show you what yours will look like
    echo -a 6 $me $+($chr(3),%other-colour) is now away $+($chr(3),%reason-colour) reason: AFK. $+($chr(3),%other-colour) I left at $+($chr(3),%time-colour) $time
  }
  else echo -a The only numbers that will work in these edit boxes are 1-15 inclusive. What you have entered will not work
}

;###########################Other Stuff########################################

on *:TEXT:*$me*:?: {
  if (%away == 1) msg $nick I am away at the moment. Reason: $readini(away.ini,$network,reason)
  else halt
}

on *:TEXT:*$me*:#: {
  if (%away == 1) msg $chan $nick, I am currently away. Reason: $readini(away.ini,$network,reason)
  else halt
}