All pastes #463628 Raw Edit

Def's Away System

public text v1 · immutable
#463628 ·published 2007-04-29 01:06 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
    set %reasonaway $1-
    /away $1-
    if (%logging == on) || (%logging == $null) /ame is away: $1- ~ Left At: $asctime(HH:nn:ss) ~ Logger: On
    if (%logging == off) /ame is away: $1- ~ 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 {
  /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 -- ++ --
  }
}
on *:text:*:#:{
  if (%logging == on) {
    if (%awaystatus == on) write awaylog.txt $asctime(HH:nn:ss) ~ $nick >> $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 89
  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, 141 23 40 19
}
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 195 31
  option dbu
  text "This enables you to enable/disable logging ~ default is On.", 1210, 27 3 142 8
  button "On", 1211, 27 16 37 12
  button "Off", 1212, 132 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: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
  }
}