@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 program --- 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" 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 "You are set to not be able to hand/be handed things." .tell "To allow yourself to hand/be handed things type 'hand #ok'" .tell 0 exit then object @ thing? object @ program? or not if "You can only hand things or programs to people!" .tell 0 exit then object @ location me @ dbcmp not if "You can't hand an object you don't have!" .tell 0 exit then target @ location me @ location dbcmp not if "You can't hand to someone somewhere else!" .tell 0 exit then target @ player? target @ "Z" flag? target @ "_puppet?" getpropstr .yes? or or not if "Target is not a player or puppet." .tell 0 exit then target @ handOk? not if "Target 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 ( -- ) "hand [by Wog]" .tell "-------------------------------------------" .tell "Options: " .tell " hand #ok\r" " Allow people to hand things to you." strcat .tell " hand #!ok\r" " Disallow people to hand things to you." strcat .tell " hand to \r" " Hands to ." strcat .tell " qhand to \r" " Quietly hands to ." strcat .tell " hand #help\r" " This screen." strcat .tell " hand #props\r" " Properties used by hand." strcat .tell ; : doProps ( -- ) "hand [by Wog]" .tell "-------------------------------------------" .tell "Properties: [on you] [optional, if not present defaults used]" .tell " _hand/format -- what you see when you hand something" .tell " to someone" .tell " _hand/oformat -- what every else sees on a non-quiet hand" .tell " _hand/qformat -- what you see on a quiet hand" .tell " _hand/qoformat -- what the reciever of the object sees on a quiet hand." .tell "-------------------------------------------" .tell "'[o]' will be replaced with the name of the object being handed." .tell "'[m]' will run pronoun subs you for the person who hands" .tell " the object, like %..." .tell "'[t]' will run pronoun subs for the person who recieves" .tell " the object, like %..." .tell "(type 'man pronoun_sub' for information on pronoun subsitutions.)" .tell "Do note that omessages will be prefixed with the name of the handing" .tell " player." .tell "-------------------------------------------" .tell "Example: setting the _hand/oformat prop to " .tell " 'hands [o] to [t]N with [m]p greatest care.'" .tell me @ "would show everyone: %N hands Object to Wog with %p greatest care." pronoun_sub .tell "if 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 "You can now hand/be handed things." .tell exit then dup "#!o" stringpfx if pop goNotHandOk "You can now not hand/be handed things." .tell exit then dup " to " instr not if ">> 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 "I don't see that object here!" .tell exit then object @ #-2 dbcmp if "I don't know what you mean!" .tell exit then target @ #-1 dbcmp if "I don't see that furr here!" .tell exit then target @ #-2 dbcmp if "I don't know who you mean!" .tell exit then doHand ; . c q