All pastes #464390 Raw Edit

Def's Away System

public text v1 · immutable
#464390 ·published 2007-04-29 13:55 UTC
rendered paste body
;########################
;# Away Script By Def669#
;########################
menu * {
  Def's Away System (/away.con): /away.con
}
alias brb {
  if (%awaynick == $null) {
    set %reasonaway $1-
    /dialog -mo setname setname
    halt
  }
  else {
    set %awaystatus on
    set %backnick $me
    set %awayfrom $ctime
    if ($1- == $null) set %reasonaway No Reason Specified
    else set %reasonaway $1-
    /away %reasonaway
    if (%logging == on) || (%logging == $null) /ame is away: %reasonaway ~ Left At: $asctime(HH:nn:ss) ~ Logger: On
    if (%logging == off) /ame is away: %reasonaway ~ Left At: $asctime(HH:nn:ss) ~ Logger: Off
    /nick %awaynick
    if (%logging == on) {
      write awaylog.txt -- ++ --
      write awaylog.txt Away Session Started - $+ %reasonaway $+ - $asctime(HH:nn:ss) ~ $date
      write awaylog.txt -- ++ --
    }
  }
}
alias back {
  if (%awaystatus == on) {
    /ame is back from: %reasonaway ~ Gone For: $duration($calc($ctime - %awayfrom))
    /nick %backnick
    /away
    /unset %backnick
    /unset %awaystatus
    /unset %reasonaway
    /unset %awayfrom
    if (%logging == on) {
      /dialog -mo logview logview
      write awaylog.txt -- ++ --
      write awaylog.txt Away Session Ended - $+ %reasonaway $+ - $asctime(HH:nn:ss) ~ $date
      write awaylog.txt -- ++ --
    }
  }
  else { 
    echo -a 04You are not away!
  }
}
on *:text:*:#:{
  if (%logging == on) {
    if (%awaystatus == on) write awaylog.txt $asctime(HH:nn:ss) ~ $nick ~ $chan >> $1-
  }
}
on *:join:#:{
  if (%logging == on) {
    if (%awaystatus == on) write awaylog.txt $asctime(HH:nn:ss) ~ $nick Joined $chan $+ .
  }
}
on *:part:#:{
  if (%logging == on) {
    if (%awaystatus == on) write awaylog.txt $asctime(HH:nn:ss) ~ $nick Parted $chan $+ .
  }
}
on *:quit:{
  if (%logging == on) {
    if (%awaystatus == on) write awaylog.txt $asctime(HH:nn:ss) ~ $nick Quit The Server.
  }
}
dialog Away {
  title "Def's Away System"
  size -1 -1 184 95
  option dbu
  edit "", 1210, 2 72 67 10, read
  text "You have been away for:", 1211, 2 64 67 8
  text "Your Time:", 1212, 2 45 28 8
  edit "", 1213, 2 53 67 10, read
  button "Go Away", 1214, 90 43 76 12
  button "Come Back", 1215, 90 56 76 12
  button "View Log", 1216, 90 69 76 12
  edit "", 1217, 3 12 175 10
  text "Enter an away reason:", 1218, 4 2 57 8
  text "Away Nick:", 1219, 3 23 34 8
  edit "", 1220, 2 32 50 10
  text "Current Nick:", 1221, 90 23 34 8
  edit "", 1222, 90 32 50 10
  button "Logging on/off", 1223, 90 82 76 11
  button "?", 1224, 168 45 12 8
  button "?", 1225, 168 57 12 8
  button "?", 1226, 168 70 12 8
  button "?", 1227, 168 83 12 8
  button "?", 1228, 143 33 12 8
  button "?", 1229, 55 33 12 8
  button "?", 1230, 69 2 12 8
}
dialog DSAhelp {
  title "DAS - Help"
  size -1 -1 135 47
  option dbu
  text "", 1210, 3 3 127 30
  button "Exit", 1211, 49 37 37 9, cancel
}
dialog setname {
  title "Please Set An Away Nick"
  size -1 -1 122 37
  option dbu
  text "Nick:", 1210, 6 3 25 8
  edit "", 1211, 6 11 106 10
  button "Ok", 1212, 41 23 37 12, Ok
}
dialog logconfig {
  title "Logging Configuration"
  size -1 -1 125 31
  option dbu
  text "This enables you to enable/disable logging ~ default is On.", 1210, 3 5 74 23
  button "On", 1211, 82 4 37 12
  button "Off", 1212, 82 16 37 12
}
dialog logview {
  title "View Log?"
  size -1 -1 102 49
  option dbu
  text "Do you want to view your log from all your sessions?", 1210, 7 5 89 16
  button "Yes", 1211, 15 28 37 12, ok
  button "No", 1212, 54 28 37 12, cancel
}
alias logging {
  /dialog -mo logconfig logconfig
  if (%logging == on) || (%logging == $null) did -b logconfig 1211
  if (%logging == off) did -b logconfig 1212
}
on *:dialog:Away:sclick:1224-1230:{
  if ($did == 1224) set %helpinfo Sets you as away to server and sends a message to all channels that you are away.
  if ($did == 1225) set %helpinfo Sets you as back from away and sends a message to all open channels.
  if ($did == 1226) set %helpinfo Open the log file so you can see what happened while you where away.
  if ($did == 1227) set %helpinfo Allows you to set logging either on or off.
  if ($did == 1228) set %helpinfo The nick you are currently using.
  if ($did == 1229) set %helpinfo What your nick will be set to when you are set as away.
  if ($did == 1230) set %helpinfo The reason you are going away for, if left empty you will have to enter a message.
  /away.help
}
alias /away.help {
  dialog -mo DSAhelp DSAhelp
  did -ra DSAhelp 1210 %helpinfo
}
on *:dialog:Away:sclick:1223:{
  /logging
}
on *:dialog:logconfig:sclick:1211:{
  did -e logconfig 1212
  /set %logging on
  did -b logconfig 1211
  echo -a 04Logging is now ON
}
on *:dialog:logconfig:sclick:1212:{
  did -e logconfig 1211
  /set %logging off
  did -b logconfig 1212
  echo -a 04Logging is now OFF
}
on *:dialog:Away:sclick:1216:{
  /run -rs awaylog.txt
}
on *:dialog:logview:sclick:1211:{
  /run -rs awaylog.txt
}
on *:dialog:Away:sclick:1215:{
  if (%awaystatus == $null) {
    echo -a 04Your Not Away!
  }
  else {
    /back
  }
}
on *:dialog:Away:sclick:1214:{
  if ($did(1217) == $null) {
    /echo -a 04Enter a reason first
  }
  elseif ($did(1220) == $null) {
    dialog -x Away
    dialog -mo setnick setnick
  }
  else {
    /brb $did(1217)
  } 
}
alias Away.Con {
  /dialog -mo away away
  did -ra Away 1213 $time
  if (%awayfrom == $null) did -ra Away 1210 You are not away!
  else did -ra Away 1210 $duration($calc($ctime - %awayfrom))
  /did -ra Away 1220 %awaynick
  /did -ra Away 1222 $me
  /did -ra Away 1217 %reasonaway
}
on *:dialog:setname:sclick:1212:{
  if ($Did(1211) == $null) {
    echo -a 04You Must choose a nick to use!
    halt
  }
  else {
    set %awaynick $did(1211)
    /brb %reasonaway
  }
}