@edit #123764 1 9999 d 1 i ( header, 15 lines -- ScenicVista.muf, programmed by Jordan Greywolf Created 20 Dec 1996 - Last updated 10 Jan 1997 This program is intended to be installed in a single "holodeck" room by means of an action attached to the room and linked to the program. If the action is not attached to the room, and if the owners of the action and room are not the same, this program will not function properly, unless the room is set _vista?:yes. - In summary, this program allows a GM to quickly change the room description, and to keep a temporary set of "descriptions" to jump back to as needed. For use with roleplay, hopefully this will allow the GM to simulate changes of locations and to describe an area for the players' benefit without having to reiterate location details on a regular basis. Modified 10 April 2001 by BoingDragon Added ability to check for 'library' environment property used by the cambot system to determine where to store and read vista entries from. ) () lvar setting lvar loglib () : yes_envprop? ( d s -- 0|1 : returns 1 if property 's' is set 'y' in environment) envpropstr 1 strcut pop "y" stringcmp not ; () : tell me @ swap notify ; () : privileged? ( -- 0|1 : returns 1 if user is Wizard or owner ) me @ "w" flag? trigger @ owner me @ dbcmp or ; () : vista-okay? ( -- 0|1 : returns 1 if okay for this program to operate ) trigger @ location room? not if 0 exit then trigger @ owner trigger @ location owner dbcmp trigger @ owner "w" flag? trigger @ location "_vista?" getpropstr 1 strcut pop "y" strcmp not or or if 1 else 0 then ; () : vista-help me @ "." notify me @ "ScenicVista Help" notify me @ "----------------" notify "The 'Vista' command is a tool for gamemasters in roleplay" tell "sessions to quickly change the room description in a game" tell "room as a tool for helping the players keep track of the" tell "current IC location without requiring the players to move" tell "from room to room on the MUCK every time there's a scene" tell "change." tell "." tell "vista #help -- Shows this help message" tell "vista #list -- Lists currently stored scenes (first 60 chars)" tell "vista #edit {#}={old}={new}" tell ". -- Edits preset scene by number, replace {old}" tell ". text with {new} text" tell "vista #read {#} -- Shows text of existing scene without displaying to room" tell "vista #del {#} -- Deletes given scene number and compacts list" tell privileged? if "vista #clear -- Clears all non-permanent scenes" tell "vista #view -- Shows listing with creator info" tell then "vista #fix {#} -- Sets given scene to semi-'permanent' status" tell "vista #!fix {#} -- Removes 'permanent' status from a scene" tell "vista {text} -- Sets room's description to {text}, and" tell ". saves the description in a list, assigning it a number" tell "vista {#} -- Sets room's description to a preset scene" tell ". with the appropriate reference number" tell "vista #{#} -- Sets description to given room # from database" tell ; () : vistamax ( -- i : returns maximum scene # setting ) loglib @ "_vista/max" getpropstr atoi ; () : padtostr ( i1 i2 -- s : right-justifies integer i1 into string of length i2 ) swap intostr " " swap strcat 10 rot - strcut swap pop ; () : find-next ( i1 -- i1 i2 : returns next value or 0 if all to max are empty ) dup begin dup vistamax > if pop 0 break then loglib @ "_vista/scene#/" 3 pick intostr strcat getpropstr if break then 1 + repeat ; () : valid-scene? ( i -- i 0|1 : checks to see if scene # is in range ) dup not if 0 else dup vistamax > if 0 else 1 then then ; () : scene-owner? ( i -- i 0|1 : checks to see if you are creator of scene ) trigger @ "_vista/creator#/" 3 pick intostr strcat getpropstr atoi dbref me @ dbcmp not if 0 else 1 then ; () : shift-down ( i1 i2 s -- i1 i2 : shifts value from i2 to i1 on trigger ) loglib @ over 4 pick intostr strcat getpropstr ( get higher value ) loglib @ 3 pick 6 pick intostr strcat rot 1 addprop ( copy to low ) loglib @ swap 3 pick intostr strcat remove_prop ( remove high value ) ; () : set-max ( sets new _vista/max value) 1 begin loglib @ "_vista/scene#/" 3 pick intostr strcat getpropstr not if break then 1 + repeat loglib @ "_vista/max" rot 1 - intostr 1 addprop ; () : list-compact 1 begin dup vistamax > if pop break then loglib @ "_vista/scene#/" 3 pick intostr strcat getpropstr not if find-next dup not if pop break else "_vista/scene#/" shift-down "_vista/status#/" shift-down "_vista/creator#/" shift-down pop then then 1 + repeat set-max ; () : vista-list ( -- : lists current scenes stored on action) ( If "1" is stored in Setting variable, then this acts as "View" ) vistamax not if "No scenes are currently stored." tell exit then "." tell "ScenicVista Scene Listing (* = Fixed Scene)" tell "-------------------------------------------" tell 1 begin dup vistamax > if pop break then loglib @ "_vista/scene#/" 3 pick intostr strcat getpropstr dup if loglib @ "_vista/status#/" 4 pick intostr strcat getpropstr not if " " else "*" then 3 pick 3 padtostr swap strcat ") " strcat swap 60 strcut pop strcat tell setting @ if loglib @ "_vista/creator#/" 3 pick intostr strcat getpropstr dup not if ". {tag missing}" else atoi dbref name ". " swap strcat then tell then then 1 + repeat "{end of list}" tell ; () : get-scene-number ( -- i : returns scene # or 0 if things aren't right ) setting @ atoi valid-scene? not if pop "That is not a valid scene number in range." tell 0 exit then privileged? not if scene-owner? not if pop "You don't have permission to alter that scene." tell 0 exit then then ; () : vista-fix get-scene-number dup not if pop exit then loglib @ "_vista/status#/" 3 pick intostr strcat "y" 1 addprop "Scene #" swap intostr strcat " fixed to permanent status." strcat tell ; () : vista-unfix get-scene-number dup not if pop exit then loglib @ "_vista/status#/" 3 pick intostr strcat remove_prop "Scene #" swap intostr strcat " set to non-permanent status." strcat tell ; () : vista-read get-scene-number dup not if pop exit then "." tell "Scene #" over intostr strcat ":" strcat tell loglib @ "_vista/scene#/" rot intostr strcat getpropstr tell ; () : vista-delete get-scene-number dup not if pop exit then "You are about to delete Scene #" over intostr strcat "." strcat tell "Current setting is:" tell loglib @ "_vista/scene#/" 3 pick intostr strcat getpropstr tell "." tell "Type 'y' to delete, or anything else to cancel." tell read "y" stringcmp not if loglib @ "_vista/scene#/" 3 pick intostr strcat remove_prop "Scene #" swap intostr strcat " has been deleted." strcat tell list-compact else "Operation cancelled." tell then ; () : clear-unfixed 1 begin dup vistamax > if pop break then loglib @ "_vista/status#/" 3 pick intostr strcat getpropstr not if loglib @ "_vista/scene#/" 3 pick intostr strcat remove_prop loglib @ "_vista/creator#/" 3 pick intostr strcat remove_prop then 1 + repeat ; () : vista-clear "You are asking to remove all non-fixed scenes permanently." tell "Are you sure you want to do this?" tell "Type 'y' to clear, or anything else to cancel." tell read "y" stringcmp not if clear-unfixed list-compact "List has been cleared and compacted." tell else "Operation cancelled." tell then ; () : edit-fail-msg "Use in the format of 'vista {scene #}={oldtext}={newtext}.'" tell "For help, type 'vista #help'." tell ; () : vista-edit setting @ dup "=" instr dup not if pop pop edit-fail-msg exit then 1 - strcut 1 strcut strip swap pop get-scene-number dup not if pop pop exit then swap dup "=" instr dup not if pop pop pop edit-fail-msg exit then 1 - strcut 1 strcut swap pop strip swap strip dup not if pop pop pop edit-fail-msg exit then swap loglib @ "_vista/scene#/" 5 pick intostr strcat getpropstr swap rot subst loglib @ "_vista/scene#/" 4 pick intostr strcat rot 1 addprop "Scene #" swap intostr strcat " changed." strcat tell ; () : vista-menu ( s -- : branches to different commands) dup "h" stringcmp not if pop vista-help exit then dup "f" stringcmp not if pop vista-fix exit then dup "!f" stringcmp not if pop vista-unfix exit then dup "l" stringcmp not if setting @ if pop vista-read exit then pop 0 setting ! vista-list exit then dup "r" stringcmp not if pop vista-read exit then dup "v" stringcmp not if pop privileged? not if "You aren't allowed to use that command." tell else 1 setting ! vista-list then exit then dup "e" stringcmp not if pop vista-edit exit then dup "d" stringcmp not if pop vista-delete exit then dup "c" stringcmp not if pop privileged? not if "You aren't allowed to use that command." tell else vista-clear then exit then pop "That is not a recognized command. Type 'vista #help' for help." tell ; () : here-okay? ( -- 0|1 : checks to see if room is _vista?:yes ) loc @ "_vista?" getpropstr 1 strcut pop "y" stringcmp not if 1 else "This room has not been set _vista?:yes." tell "The operation cannot be performed." tell 0 then ; () : vista-set ( s -- : Sets new description for room and stores as new scene ) here-okay? not if pop exit then vistamax 1 + loglib @ "_vista/max" 3 pick intostr 1 addprop loglib @ "_vista/scene#/" 3 pick intostr strcat 4 pick 1 addprop loglib @ "_vista/status#/" 3 pick intostr strcat remove_prop loglib @ "_vista/creator#/" 3 pick intostr strcat me @ intostr 1 addprop "New scene added as #" swap intostr strcat "." strcat tell loc @ swap setdesc ; () : vista-scene ( i -- : Sets new desc for room from pre-stored scene ) here-okay? not if pop exit then valid-scene? not if pop "There is no such scene previously set." tell exit then loglib @ "_vista/scene#/" rot intostr strcat getpropstr dup not if pop "There is no description for that scene." tell exit then loc @ swap setdesc "Room description has been changed." tell ; () : vista-grab ( i -- : Sets room desc to match given room db# ) dbref dup room? not if pop "That is not a valid room dbref #." tell exit then dup owner me @ dbcmp not if dup "_public?" yes_envprop? not if "That room description has not been set '_public?:yes'." tell exit then then "_/de" "" 1 parseprop loc @ swap setdesc "Room description has been changed." tell ; () : main loc @ "library" envprop swap #-1 dbcmp not if loglib ! then loglib @ string? if loglib @ strlen 0 > if loglib @ atoi dbref loglib ! else TRIGGER @ loglib ! then else TRIGGER @ loglib ! then dup not if pop vista-help exit then dup atoi if atoi vista-scene exit then dup 1 strcut pop "#" stringcmp not if 1 strcut swap pop dup atoi if atoi vista-grab exit then dup " " instr dup not if pop "" setting ! else 1 - strcut strip setting ! then dup 1 strcut pop "!" stringcmp not if 2 strcut pop else 1 strcut pop then vista-menu else dup strlen 8 < if pop "Room descriptions are expected to be at least 8 characters" tell "long by this program. Type 'vista #help' for help with command" tell "syntax. If you were trying to set a new scene, then please" tell "make it at least 8 characters long. Sorry for any inconvenience." tell else vista-set then then ; . c q