Away Script 1.0

By Pwntage`Ninja on Aug 17, 2008

Some features:

The Away Button; F10:
-If you aren't away, when you press the F10 button it will set you away
-If you ARE away, it will have you return.
-You use this command if you don't have the dialog open.
-It uses the first Reason and Nick in both selective lists.
-If the above doesn't apply, as in you have not yet added a nick and/or reason, it will use "Stuff." as the default reason, and your nick with a "[a]" appended to the end.
Occurence of your nickname in chat/you're PM'd
It sends them a Private Message that you're away, for how long you've been away, and what reason.
Dialogs
The first dialog is a quicker to use than just 2 list boxes, and the 2nd dialog you can use to modify your reasons/nicks

on *:START: {
  timeridlecheck 0 1 /idlecheck
  write reasons.awy
  write nicks.awy
}
dialog a1 {
  title "Away Script"
  size -1 -1 69 49
  option dbu
  combo 1, 1 7 68 48, size drop
  combo 2, 1 24 67 50, size drop
  text "Reasons", 4, 21 0 25 7, center
  text "Nicks", 5, 21 18 25 6, center
  button "Modify", 6, 0 38 37 8
  button "Leave", 7, 39 35 30 7
  button "Return", 8, 39 42 30 7
}
on *:DIALOG:a1:sclick:6:/dialog -m a2 a2
on *:DIALOG:a1:sclick:7: {
  If (!$away) { set %returnnick $me }
  away $iif($did(1).seltext,$did(1).seltext,$iif($Read(reasons.awy,1),$Read(reasons.awy,1),Stuff.))
  nick $iif($did(2).seltext,$did(2).seltext,$iif($Read(nicks.awy,1),$Read(nicks.awy,1),$me $+ [a]))
  /amsg 4,1(15Away. Away for $iif($did(1).seltext,$did(1).seltext,$iif($Read(reasons.awy,1),$Read(reasons.awy,1),Stuff.)) 4)
}
on *:DIALOG:a1:sclick:8: {
  /amsg 4,1(15Back. Away for R:4(15 $+ $awaymsg $+ 4)15T:4(15 $+ $duration($awaytime) $+ 4))
  away
  nick %returnnick
  unset %returnnick
}
on *:DIALOG:a1:init:0: {
  If ($fopen(q)) { .fclose q }
  .fopen q reasons.awy
  While (!$ferr) && (!$feof) {
    did -a a1 1 $fread(q)
  }
  .fclose q
  If ($fopen(q)) { .fclose q }
  .fopen q nicks.awy
  While (!$ferr) && (!$feof) {
    did -a a1 2 $fread(q)
  }
  .fclose q
}
dialog a2 {
  title "Away Script"
  size -1 -1 94 79
  option dbu
  tab "Nicks", 1, 0 0 93 77
  tab "Reasons", 2
  list 3, 3 19 89 43, size
  button "Delete", 5, 3 69 29 7
  button "Clear", 6, 32 62 29 14
  button "Add", 4, 3 62 29 7
  button "Update", 7, 61 62 30 14, ok
}
on *:DIALOG:a2:sclick:7: {
  If ($dialog(a1)) {
    did -r a1 1,2
    If ($fopen(q)) { .fclose q }
    .fopen q reasons.awy
    While (!$ferr) && (!$feof) {
      did -a a1 1 $fread(q)
    }
    .fclose q
    If ($fopen(q)) { .fclose q }
    .fopen q nicks.awy
    While (!$ferr) && (!$feof) {
      did -a a1 2 $fread(q)
    }
    .fclose q    
  }
}
on *:DIALOG:a2:sclick:4: {
  set %awy $input($iif(%id = 1,Nick,Reason) to add to $iif(%id = 1,Nick,Reason) list?,evauid,Away Script,$cb(1))
  If ($len(%awy) > 0) {
    did -a a2 3 %awy
    write $iif(%id = 1,nicks,reasons) $+ .awy %awy
    If ($lines($iif(%id = 1,nicks,reasons) $+ .awy) > 0) { did -e a2 5,6 }
  }
  unset %awy
}
on *:DIALOG:a2:sclick:6: {
  set %Y/N $input(Are you sure you want to clear you $iif(%id = 1,Nick,Reason) list?,yvauwd,Away Script)
  If (%Y/N = $no) { unset %Y/N | halt }
  If (%Y/N = $yes) {
    unset %Y/N
    write -c $iif(%id = 1,nicks,reasons) $+ .awy
    did -r a2 3
    did -b a2 5,6
  }
}
on *:DIALOG:a2:sclick:5: {
  If (!$did(3).seltext) { halt }
  set %awy $iif(%id = 1,nicks,reasons) $+ .awy
  If ($fopen(q)) { .fclose q }
  .fopen q %awy
  %i = 1
  While (!$ferr) && (!$feof) {
    If ($fread(q) = $did(3).seltext) { write -dl $+ %i %awy }
    inc %i
  }
  did -d a2 3 $didwm(a2,3,$did(a2,3).seltext)
  unset %i %awy
  If ($lines($iif(%id = 1,nicks,reasons) $+ .awy) = 0) { did -b a2 5,6 }
}
on *:DIALOG:a2:sclick:1,2: {
  set %id $did
  xload
}
on *:DIALOG:a2:init:0: {
  If ($fopen(q)) { .fclose q }
  .fopen q nicks.awy
  While (!$ferr) && (!$feof) {
    did -a a2 3 $fread(q)
  }
  .fclose q
  set %id 1
  If ($lines(nicks.awy) = 0) { did -b a2 5,6 }

}
alias -l xload {
  did -r a2 3
  If ($lines($iif(%id = 1,nicks,reasons) $+ .awy) > 0) {
    If ($fopen(q)) { .fclose q }
    .fopen q $iif(%id = 1,nicks,reasons) $+ .awy
    While (!$ferr) && (!$feof) {
      did -a a2 3 $fread(q)
    }
    .fclose q
  }
  If ($lines($iif(%id = 1,nicks,reasons) $+ .awy) = 0) { did -b a2 5,6 }
  If ($lines($iif(%id = 1,nicks,reasons) $+ .awy) > 0) { did -e a2 5,6 }
}
alias f9 dialog -m a1 a1
alias f10 {
  If (!$away) {
    away $iif($read(reasons.awy,1),$read(reasons.awy,1),Stuff.)
    set %returnnick $me
    nick $iif($read(nicks.awy,1),$read(nicks.awy,1),$me $+ [a])
    /amsg 4,1(15Away. Away for $read(reasons.awy,1) 4)
  }
  If ($away) {
    /amsg 4,1(15Back. Away for R:4(15 $+ $awaymsg $+ 4)15T:4(15 $+ $duration($awaytime) $+ 4))
    away
    nick %returnnick
    unset %returnnick
  }
}
alias away {
  If (!$1) { timeridlecheck 0 1 /idlecheck }
  If ($1) { away $1- }
}
alias idlecheck {
  If ($idle >= 1500) && (!$away) {
    away Idle after 25 minutes of no action :] Cyaz!!!
    set %returnnick $me
    nick $iif($read(nicks.awy,1),$read(nicks.awy,1),$me $+ [a])
    amsg 4,1(15Away. Away for Idle after 25 minutes of no action :] Cyaz!!! 4)
  }
}
on *:TEXT:*:#: {
  If ($me isin $1-) && ($away) {
    If (!%fld. [ $+ [ $nick ] ]) { set -z %fld. [ $+ [ $nick ] ] 0 }
    If (%fld. [ $+ [ $nick ] ]) {
      If (%fld. [ $+ [ $nick ] ] < 5) { inc %fld. [ $+ [ $nick ] ] }
      If (%fld. [ $+ [ $nick ] ] >= 5) { halt }
    }
    .notice $nick 4,1(15I am currently Away. R:4(15 $+ $awaymsg $+ 4)15T:4(15 $+ $duration($awaytime) $+ 4))
  }
}
on *:OPEN:?:*: {
  If ($away) {
    If (!%fld. [ $+ [ $nick ] ]) { set -z %fld. [ $+ [ $nick ] ] 0 }
    If (%fld. [ $+ [ $nick ] ]) {
      If (%fld. [ $+ [ $nick ] ] < 5) { inc %fld. [ $+ [ $nick ] ] }
      If (%fld. [ $+ [ $nick ] ] >= 5) { halt }
    }
    .notice $nick 4,1(15I am currently Away. R:4(15 $+ $awaymsg $+ 4)15T:4(15 $+ $duration($awaytime) $+ 4))
  }
}

Comments

Sign in to comment.
TheWhistler   -  Jan 26, 2010

works good but the dialog is lil small , why on away , they never add in a place for nickpasswords on back to id there nick with, had to change f-keys to another , those was alread working, plus this one dosnt return you to your nick
on return

 Respond  
inti-garcia   -  Dec 10, 2008

How do i make it work? lol i hit f10 fine but how do i put my own reason?

 Respond  
T_Nick_T   -  Oct 07, 2008

Where does this go?

 Respond  
pwnisher3   -  Aug 20, 2008

i like mine

 Respond  
Neo_   -  Aug 17, 2008

Dialog's are way to small specially the buttons... fix them up + you dont really need the / on the amsg parts and up on the timer... it doesnt really do any justice.

5/10 from me

 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.