@prog hand.muf 1 9999 d i ( hand.muf -- by Wog This is my take on a hand proggie. Create an action called 'hand;qhand' linked to this proggie. --- Change History ---------------------------------- v 1.0 02/24/00 Assignment of version number to programs. v 1.1 17 Jan 2007 Allow only things and programs to be handed. --- 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 handOkProp "_hand/hand_ok" $ifdef __glowver $def .tell me @ swap ansi_notify $else $include $lib/ansi $def .tell ansi-tell $endif var object var target : getPropOrDefault ( obj prop default -- string ) -3 rotate getpropstr dup not if pop exit else swap pop exit then ; : parse ( string -- result ) "%" "[t]" subst target @ swap pronoun_sub "%" "[m]" subst me @ swap pronoun_sub object @ name "[o]" subst ; : handOk? ( p -- i ) handOkProp getpropstr .yes? ; : checkPrems ( -- 1 / 0 ) me @ handOk? not if "~&110You are set to not be able to hand/be handed things." .tell "~&120To allow yourself to hand/be handed things type 'hand #ok'" .tell 0 exit then object @ thing? object @ program? or not if "~&110You can only hand things or programs to people!" .tell 0 exit then object @ location me @ dbcmp not if "~&110You can't hand an object you don't have!" .tell 0 exit then target @ location me @ location dbcmp not if "~&110You can't hand to someone somewhere else!" .tell 0 exit then target @ player? target @ "Z" flag? target @ "_puppet?" getpropstr .yes? or or not if "~&110Target is not a player or puppet." .tell 0 exit then target @ handOk? not if "`&110Target player not hand-ok." .tell 0 exit then 1 ; : prefixOString ( s -- s' ) me @ name " " strcat swap strcat ; : doHand ( -- ) checkPrems not if exit then command @ "q" instring 0 = if me @ "_hand/format" "You hand [o] to [t]N." getPropOrDefault parse .tell me @ "_hand/oformat" "hands [o] to [t]N." getPropOrDefault parse prefixOString .otell else me @ "_hand/qformat" "You hand [o] to [t]N." getPropOrDefault parse .tell me @ "_hand/qoformat" "hands [o] to you quietly." getPropOrDefault parse prefixOString target @ swap notify then object @ target @ moveto ; : goHandOk ( -- ) me @ handOkProp "yes" setprop ; : goNotHandOk ( -- ) me @ handOkProp remove_prop ; : doHelp ( -- ) "~&120hand [by Wog]" .tell "~&120-------------------------------------------" .tell "~&150Options: " .tell "~&170 hand #ok\r" "~&160 Allow people to hand things to you." strcat .tell "~&170 hand #!ok\r" "~&160 Disallow people to hand things to you." strcat .tell "~&170 hand to \r" "~&160 Hands to ." strcat .tell "~&170 qhand to \r" "~&160 Quietly hands to ." strcat .tell "~&170 hand #help\r" "~&160 This screen." strcat .tell "~&170 hand #props\r" "~&160 Properties used by hand." strcat .tell ; : doProps ( -- ) "~&120hand [by Wog]" .tell "~&120------------------------------------------------------------" .tell "~&150Properties: ~&050[on you] [optional, if not present defaults used]" .tell "~&170 _hand/format ~&160-- what you see when you hand something" .tell "~&160 to someone" .tell "~&170 _hand/oformat ~&160-- what every else sees on a non-quiet hand" .tell "~&170 _hand/qformat ~&160-- what you see on a quiet hand" .tell "`&170 _hand/qoformat ~&160-- what the reciever of the object sees on a quiet hand." .tell "~&120------------------------------------------------------------" .tell "~&030'[o]' will be replaced with the name of the object being handed." .tell "~&030'[m]' will run pronoun subs you for the person who hands" .tell "~&030 the object, like %..." .tell "~&030'[t]' will run pronoun subs for the person who recieves" .tell "~&030 the object, like %..." .tell "~&030(type '~&130man pronoun_sub~&030' for information on pronoun subsitutions.)" .tell "~&030Do note that omessages will be prefixed with the name of the handing" .tell "~&030 player." .tell "~&120------------------------------------------------------------" .tell "~&030Example: setting the _hand/oformat prop to " .tell "~&030 'hands [o] to [t]N with [m]p greatest care.'" .tell "~&030would show everyone: " "~&070%N hands Object to Wog with %p greatest care." me @ swap pronoun_sub strcat .tell "~&030if you were handing 'Object' to Wog." .tell ; : main ( -- ) dup "#he" stringpfx if pop doHelp exit then dup "#pr" stringpfx if pop doProps exit then dup "#ok" stringpfx if pop goHandOk "~&120You can now hand/be handed things." .tell exit then dup "#!o" stringpfx if pop goNotHandOk "~&130You can now not hand/be handed things." .tell exit then dup " to " instr not if "~&120>> Bad command format! Type 'hand #help' for help." .tell exit then " to " .split (object name, target name) match target ! match object ! object @ #-1 dbcmp if "~&110I don't see that object here!" .tell exit then object @ #-2 dbcmp if "~&110I don't know what you mean!" .tell exit then target @ #-1 dbcmp if "~&110I don't see that furr here!" .tell exit then target @ #-2 dbcmp if "~&110I don't know who you mean!" .tell exit then doHand ; . c q @action hand;qhand=#0 @link hand=hand.muf