Jump to content

Archived

This topic is now archived and is closed to further replies.

chain

Away script W/highlights

Recommended Posts

  • Administrators
>; ###############################################

; ##                                           ##

; ## Away Script v1.0                          ##

; ## Designed and written by: Terror_nisse     ##

; ## Email: terror-nisse@hotmail.com           ##

; ## Made: 20.02.08                            ##

; ##                                           ##

; ## ----------------------------------------  ##

; ##                                           ##

; ## Updates in the future:                    ##

; ## - No plans yet.                           ##

; ##                                           ##

; ###############################################





alias -l c1 { return $+($chr(3),$iif($readini(away.ini,colors,1),$v1,14),$1-) }

alias -l c2 { return $+($chr(3),$iif($readini(away.ini,colors,2),$v1,13),$1-) }

alias -l c3 { return $+($chr(3),01,$1-) }

alias gone {

 .tokenize 32 $iif($1,$1-,No reason)

 if ($readini(away.ini,SetAway,reason)) { .echo -a $c2(>>>) $c3([ Error ]: You are already set as away.) }

 else {

   .away $c1(I am away) $+($chr(2),::,$chr(2)) $c1(Reason:) $c2($1-) $+($chr(2),::,$chr(2)) $c1(Left at:) $c2($time)

   .writeini -n away.ini SetAway time $ctime

   .writeini -n away.ini SetAway reason $1-

   .writeini -n away.ini SetAway me $me

   .writeini -a away.ini SetAway left $time

   scon -a amsg $c1(~>) $+($c1,$chr(91),$c2,$chr(32),AWAY,$chr(32),$c1,$chr(93)) $+($chr(31),I,$chr(31)) $c1(am now away.) $+($chr(2),$c2,::,$chr(2)) $+($c1,$chr(31),R,$chr(31),eason:) $c2($1-) $+($chr(2),$c2,::,$chr(2)) $+($c1,$chr(31),L,$chr(31),eft at:) $c2($time)

   if ($istok(ON,$readini(away.ini,nick,ccnick),32)) { scon -a nick $iif($readini(away.ini,nick,cnick),$v1,$+($mnick,$chr(124),AWAY)) }

 }

}

alias back {

 if (!$readini(away.ini,SetAway,reason)) { .echo -a $c2(>>>) $c3([ Error ]: You are already set as back.) }

 else {

   .away

   scon -a amsg $c1(~>) $+($c1,$chr(91),$c2,$chr(32),BACK,$chr(32),$c1,$chr(93)) $+($chr(31),I,$chr(31)) $c1(am now back.) $+($chr(2),$c2,::,$chr(2)) $+($c1,$chr(31),B,$chr(31),ack from:) $c2($readini(away.ini,SetAway,reason)) $+($chr(2),$c2,::,$chr(2)) $+($c1,$chr(31),I,$chr(31)) $c1(was gone for:) $c2($duration($calc($ctime - $readini(away.ini,SetAway,time)),2))

   if ($istok(ON,$readini(away.ini,nick,ccnick),32)) { scon -a nick $iif($readini(away.ini,SetAway,me),$v1,$mnick) }

   .remini Away.ini SetAway | .remini away.ini DonePublic | .remini away.ini DonePM | .remini away.ini DoneME

 }

}

on *:LOAD: { echo -a $c2(>>>) $c3([ Load ]: You just loaded $remove($script,$scriptdir) - Away script v1.0 by Terror_nisse.) }

on *:UNLOAD: { echo -a $c2(>>>) $c3([ Unload ]: You just unloaded $remove($script,$scriptdir) - Away script v1.0 by Terror_nisse.) }

menu * {

 .-

 Away by Terror_nisse

 .Main dialog:/dialog -dm away away

 .-

 .$iif($away,$style(2)) Set Away:/dialog -dm Awayd Awayd

 .$iif(!$away,$style(2)) Set Back:/back

}

dialog away {

 title "Away Script v1.0 by Terror_nisse"

 size -1 -1 135 165

 option dbu

 box "Away/Back", 1, 3 3 128 37

 button "Set Away", 2, 6 11 60 25, ok

 button "Set Back", 3, 68 11 60 25, ok

 box "When away...", 4, 3 40 128 105

 check "Use highlights", 5, 10 51 44 7

 box "Highlight on:", 6, 6 60 122 28

 check "Public highlight", 7, 10 70 46 7

 check "Private message", 8, 10 78 48 7

 check "/me highlight", 9, 65 70 40 7

 box "Nick to:", 10, 6 88 122 24

 check "Change nick", 11, 65 51 44 7

 edit "", 12, 10 97 114 11, autohs

 box "Highlight nicks:", 13, 6 112 122 30

 edit "", 14, 10 121 114 11, autohs

 text "NOTE: Seperate nicks by comma: nick,nick,nick", 15, 10 133 150 8

 button "OK", 16, 11 149 37 12, default ok

 button "Cancel", 17, 49 149 37 12, cancel

 button "Save", 18, 87 149 37 12

}

dialog AwayD {

 title "Enter a away message"

 size -1 -1 180 45

 option dbu

 box "Away message", 1, 3 3 174 23

 edit "", 2, 6 12 168 11, autohs

 button "OK", 3, 43 28 37 12, default ok

 button "Cancel", 4, 83 28 37 12, cancel

}

on *:dialog:away:sclick:2:{ .dialog -dm AwayD AwayD }

on *:dialog:away:sclick:3:{ .back }

on *:dialog:AwayD:sclick:3:{ .gone $iif($did(2),$v1,No reason) }

on *:dialog:away:init:*: {

 if ($istok($false,$exists(away.ini),32)) {

   .writeini -n away.ini highlight highlight on

   .writeini -n away.ini highlight pm on

   .writeini -n away.ini highlight public on

   .writeini -n away.ini highlight me on

   .writeini -n away.ini nick ccnick on

   .writeini -n away.ini nick cnick $+($mnick,$chr(124),Away)

   .writeini -n away.ini highlight nicks $+($mnick,$chr(44),$anick)

 }

 if (!$readini(away.ini,nick,ccnick)) { .did -b away 12 }

 if ($away) { .did -b away 2 }

 else { .did -b away 3 }

 .did -a away 12 $readini(away.ini,nick,cnick)

 .did -a away 14 $readini(away.ini,highlight,nicks)

 if ($istok(ON,$readini(away.ini,highlight,highlight),32)) { .did -c away 5 }

 else { .did -b away 7-9 | .did -b away 14 }

 if ($istok(ON,$readini(away.ini,nick,ccnick),32)) { .did -c away 11 }

 if ($istok(ON,$readini(away.ini,highlight,public),32)) { .did -c away 7 }

 if ($istok(ON,$readini(away.ini,highlight,pm),32)) { .did -c away 8 }

 if ($istok(ON,$readini(away.ini,highlight,me),32)) { .did -c away 9 }

}

on *:dialog:away:sclick:5:{

 if ($did(5).state) {

   .did -e away 7-9

   .did -e away 14

   .writeini away.ini highlight highlight on

 }

 elseif (!$did(5).state) {

   .did -b away 7-9

   .did -b away 14

   .remini away.ini highlight highlight

 }

}

on *:dialog:away:sclick:11:{

 if ($did(11).state) {

   .did -e away 12

   .writeini away.ini nick ccnick on

 }

 elseif (!$did(11).state) {

   .did -b away 12

   .remini away.ini nick ccnick

 }

}

on *:dialog:away:sclick:7:{

 if ($did(7).state) { .writeini away.ini highlight public on }

 elseif (!$did(7).state) { .remini away.ini highlight public }

}

on *:dialog:away:sclick:8:{

 if ($did(8).state) { .writeini away.ini highlight pm on }

 elseif (!$did(8).state) { .remini away.ini highlight pm }

}

on *:dialog:away:sclick:9:{

 if ($did(9).state) { .writeini away.ini highlight me on }

 elseif (!$did(9).state) { .remini away.ini highlight me }

}

on *:dialog:away:sclick:16-18:{

 .remove highlight.txt

 .writeini -n away.ini nick cnick $did(12)

 .writeini -n away.ini highlight nicks $did(14)

 .var %x = 1

 while (%x 
   .write highlight.txt $gettok($did(14),%x,44)

   .inc %x

 }

}

on *:TEXT:*:#:{

 if ($istok(ON,$readini(away.ini,highlight,public),32) && $away) {

   .fopen temphl highlight.txt | if (!$ferr) { while (!$feof) { if ($fread(temphl) isin $1-) {

         if ($readini(away.ini,DonePublic,$address($nick,3))) {

           if (!$window(away)) {

             .window @away

           }

           .aline -a @away $+($chr(91),$asctime(hh:nn),$chr(93)) $+($chr(60),$nick,$chr(62)) $1-

         }

         else {

           .notice $nick I am currently away $+($chr(2),::,$chr(2)) Reason: $+($chr(2),$readini(away.ini,SetAway,reason),$chr(2)) $+($chr(2),::,$chr(2)) Left at: $+($chr(2),$readini(away.ini,SetAway,left),$chr(2)) $+($chr(2),::,$chr(2)) Time gone: $+($chr(2),$duration($calc($ctime - $readini(away.ini,SetAway,time)),2),$chr(2)) $+($chr(2),::,$chr(2)) One time respond to highlight.

           .writeini -n away.ini DonePublic $address($nick,3) done

           if (!$window(away)) {

             .window @away

           }

           .aline -a @away $+($chr(91),$asctime(hh:nn),$chr(93)) $+($chr(60),$nick,$chr(62)) $1-

           break

         }

       }

     }

     .fclose temphl

   }

 }

}



on *:TEXT:*:?:{

 if ($istok(ON,$readini(away.ini,highlight,pm),32) && $away) {

   if ($readini(away.ini,DonePm,$address($nick,3))) {

     if (!$window(away)) {

       .window @away

     }

     .aline -a @away $+($chr(91),$asctime(hh:nn),$chr(32),PM,$chr(93)) $+($chr(60),$nick,$chr(62)) $1-

   }

   else {

     .msg $nick I am currently away $+($chr(2),::,$chr(2)) Reason: $+($chr(2),$readini(away.ini,SetAway,reason),$chr(2)) $+($chr(2),::,$chr(2)) Left at: $+($chr(2),$readini(away.ini,SetAway,left),$chr(2)) $+($chr(2),::,$chr(2)) Time gone: $+($chr(2),$duration($calc($ctime - $readini(away.ini,SetAway,time)),2),$chr(2)) $+($chr(2),::,$chr(2)) One time respond to private message.

     .writeini -n away.ini DonePm $address($nick,3) done

     if (!$window(away)) {

       .window @away

     }

     .aline -a @away $+($chr(91),$asctime(hh:nn),$chr(32),PM,$chr(93)) $+($chr(60),$nick,$chr(62)) $1-

   }

 }

}



on *:ACTION:*:?:{

 if ($istok(ON,$readini(away.ini,highlight,pm),32) && $away) {

   if ($readini(away.ini,DonePm,$address($nick,3))) {

     if (!$window(away)) {

       .window @away

     }

     .aline -a @away $+($chr(91),$asctime(hh:nn),$chr(32),PM,$chr(93)) $+($chr(3),06,$chr(42),$chr(32),$nick) $1-

   }

   else {

     .msg $nick I am currently away $+($chr(2),::,$chr(2)) Reason: $+($chr(2),$readini(away.ini,SetAway,reason),$chr(2)) $+($chr(2),::,$chr(2)) Left at: $+($chr(2),$readini(away.ini,SetAway,left),$chr(2)) $+($chr(2),::,$chr(2)) Time gone: $+($chr(2),$duration($calc($ctime - $readini(away.ini,SetAway,time)),2),$chr(2)) $+($chr(2),::,$chr(2)) One time respond to private message.

     .writeini -n away.ini DonePm $address($nick,3) done

     if (!$window(away)) {

       .window @away

     }

     .aline -a @away $+($chr(91),$asctime(hh:nn),$chr(32),PM,$chr(93)) $+($chr(3),06,$chr(42),$chr(32),$nick) $1-

   }

 }

}

on *:ACTION:*:#:{

 if ($istok(ON,$readini(away.ini,highlight,me),32) && $away) {

   .fopen temphl highlight.txt | if (!$ferr) { while (!$feof) { if ($fread(temphl) isin $1-) {

         if ($readini(away.ini,DoneMe,$address($nick,3))) {

           if (!$window(away)) {

             .window @away

           }

           .aline -a @away $+($chr(91),$asctime(hh:nn),$chr(93)) $+($chr(3),06,$chr(42),$chr(32),$nick) $1-

         }

         else {

           .notice $nick I am currently away $+($chr(2),::,$chr(2)) Reason: $+($chr(2),$readini(away.ini,SetAway,reason),$chr(2)) $+($chr(2),::,$chr(2)) Left at: $+($chr(2),$readini(away.ini,SetAway,left),$chr(2)) $+($chr(2),::,$chr(2)) Time gone: $+($chr(2),$duration($calc($ctime - $readini(away.ini,SetAway,time)),2),$chr(2)) $+($chr(2),::,$chr(2)) One time respond to description highlight.

           .writeini -n away.ini DoneMe $address($nick,3) done

           if (!$window(away)) {

             .window @away

           }

           .aline -a @away $+($chr(91),$asctime(hh:nn),$chr(93)) $+($chr(3),06,$chr(42),$chr(32),$nick) $1-

           break

         }

       }

     }

     .fclose temphl

   }

 }

}

Link to comment
Share on other sites



×
×
  • Create New...