@prog autosweep.muf 1 99999 d i ( Autosweep.muf... by Wog A program that players can set up on themselve with a visual interface to automatically sweep them home when they disconnect. {With a delay.} --- Change History ---------------------------------- v 1.0 02/24/00 Assignment of version number to programs. v 1.01 02/26/00 Modified program not to do anything when they are already home. --- Distrubution Information ------------------------ Copyright {C} Charles "Wog" Reiss This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or {at your option} any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. For a copy of the GPL: a> see: http://www.gnu.org/copyleft/gpl.html b> write to: the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA ) $def HEADER "~&120--- Autosweep by Wog ---------------------------------------" $ifdef __glowver $def .tell me @ swap ansi_notify $else $include $lib/ansi $def .tell ansi-tell $endif : isSetup? ( d -- i ) "_prefs/asweep/setup?" getpropstr .yes? ; : getMesg ( -- s ) me @ "_prefs/asweep/mesg" "(autosweep)" 1 parseprop dup strlen 0 = if pop "is automatically sent home." then me @ swap pronoun_sub me @ name " " strcat swap strcat ; : do-disconnect me @ isSetup? not if exit then me @ awake? if exit then (Ignore if still awake...) me @ "_prefs/asweep/time" getpropval sleep me @ awake? if exit then (Don't do it if they are awake now...) me @ location me @ getlink dbcmp if exit then getMesg .otell me @ dup getlink moveto ; : cmdRepl command @ "CMD" subst ; : doSetMesg "~&060Type in the message you wish to show when you are autoswept." .tell "~&060The current message will show as: ~&160" getMesg strcat .tell me @ "_prefs/asweep/mesg" getpropstr dup not if pop "~&020[This is the default message.]" .tell else me @ name " " strcat swap strcat dup getMesg strcmp not if "~&060[This parsed from: " swap strcat "]" strcat .tell else pop then then "~&050Pronoun subutitions and MPI will be parsed. The text \"" me @ name " \" will" strcat strcat .tell "~&050prepended automatically." .tell "~&130Enter '.' to not change the messsage or the new text for it." .tell read dup "." strcmp not if exit then me @ "_prefs/asweep/mesg" rot setprop ; : timeToStr "" swap dup 60 / intostr "m" strcat rot strcat swap 60 % intostr "s" strcat strcat ; lvar tmp $def DIGITS "0123456789" : extractTime -1 tmp ! dup "m" instr if "m" .split (before minutes, after minutes) swap atoi 60 * tmp ! then dup "s" instr if "s" .split (before seconds, after seconds) swap atoi tmp @ dup -1 = if pop 0 then + tmp ! (after seonds left, get rid of it.) pop else pop then tmp @ -1 = if (Unset, so far...) atoi 60 * tmp ! (Store the string that isn't processed in tmp) then tmp @ ; : doSetTime "~&060Enter the amount of time you wish the program to wait after" .tell "~&060you disconnect in minutes and/or seconds." .tell "~&060Examples: '1m30s', '1' (for one minute), '3m'" .tell me @ "_prefs/asweep/time" getpropval timeToStr "~&060Current value: ~&160" swap strcat .tell "~&130Enter '.' to leave unchanged, anything else to set." .tell read dup "." strcmp not if exit then extractTime "~&060Time set to: ~&160" over timeToStr strcat .tell me @ "_prefs/asweep/time" rot setprop ; : doSetup HEADER .tell me @ isSetup? not if doSetTime doSetMesg me @ "_prefs/asweep/setup?" "yes" setprop me @ "_disconnect/autosweeper" prog setprop "~&120>> Autosweep setup." .tell then begin "~&1601)~&060 Waiting time is: ~&160" me @ "_prefs/asweep/time" getpropval timeToStr strcat .tell "~&1602)~&060 Message will show as: ~&160" getMesg strcat .tell me @ "_prefs/asweep/mesg" getpropstr dup not if pop "~&020 [Default message.]" .tell else me @ name " " strcat swap strcat dup getMesg strcmp if "~&050 [Without MPI/Pronoun subs it's: " swap strcat "]" strcat .tell else pop then then "~&130Choose an option (1 or 2) or 0 to quit: " .tell read atoi dup 0 = if "~&120Done." .tell exit then dup 1 = if doSetTime then dup 2 = if doSetMesg then repeat ; : main "me" match me ! dup "Disconnect" strcmp not if do-disconnect exit then dup not if HEADER .tell me @ isSetup? if "~&120Autosweep is setup on you." .tell "~&060Timeout: ~&160" me @ "_prefs/asweep/time" getpropval timeToStr strcat .tell "~&060Message parses to: ~&160" getMesg strcat .tell me @ "_prefs/asweep/mesg" getpropstr dup not if pop "~&050 [Default message.]" .tell else me @ name " " strcat swap strcat dup getMesg strcmp if "~&050 [Without MPI/Pronoun subs it's: " swap strcat "]" strcat .tell else pop then then else "~&110Autosweep is NOT setup on you." .tell then "~&150Type CMD #help for help." cmdRepl .tell exit then dup "#h" stringpfx if HEADER .tell "~&160 This program will allow you to setup your charactor to be" .tell "~&160automatically sent home after you disconnect with an optional" .tell "~&160time delay and customizable messages.".tell "~&150Commands: " .tell "~&170 CMD #help ~&060-- This screen." cmdRepl .tell "~&170 CMD #setup ~&060-- Setup autosweep on you or edit your settings." cmdRepl .tell "~&170 CMD #remove ~&060-- Remove autosweep from you." cmdRepl .tell "~&170 CMD ~&060-- Tells how/if you have autosweep setup." cmdRepl .tell exit then dup "#s" stringpfx if doSetup exit then dup "#r" stringpfx if "~&030Remove? Confirm, please. (y/~&130N~&030)" .tell read .yes? if me @ "_prefs/asweep" remove_prop me @ "_disconnect/autosweeper" remove_prop "~&110>> Reset." .tell else "~&120>> Reset cancelled." .tell then exit then ; . c q @action autosweep;asweep=#0 @link asweep=autosweep.muf @set autosweep.muf=L