Pederson's Decompile

From Gwen Morse's Wiki
Jump to: navigation, search
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; This section contains two macros for the mu* client TinyFugue. The two macros are:
;;; * /decompile <object>
;;; * /dec-all <player>

;;; Source: Marvin Pederson (http://web.archive.org/web/19990508023527/http://amtgard.com/~marvin/#Client)
;;; Re-written by Gwen Morse with help from the Softcode Mailing List.
;;; Additional help from Kareila at ChaoticMUX (UNIX /sh check and OUTPUTSUFFIX usage)

;;; /decompile <object>
;;; This command will open a log file, @decompile an object, and close the log file, all in one smooth step.

;; If-else check for Windows vs. *Nix-type OS.
;; Since /sh is broken under windows, if this command fails
;; it will save the log in an alternate directory that
;; would need to already exist.


/def -qi -p100 -t'TF> Now working with object *' da_first= \
  	      /log -w %{DECDIR}/working/%8.log %;\

/def -qi -p100 -t'TF> Object ready!' dec_ready = \
	/log -w off %; \

;;
;; Take out the /relog below if you're not using my autologger.
;;

/def -qi -p100 -t'TF> Decompile done!' dec_finish= \
	/relog %;\
	/more off %;\

/def -qi decompile = \
    /more off %; \
    /log -w off %; \
    /send @pemit me = TF> Now working with object [num(%*)], name: [edit(name(%*),\%b,_)] %; \
    /def -agqi -n1 -p1000 -t'TF> Decompile done!' dec_hide_first %; \
    /send @decompile %* %; \
    /send OUTPUTSUFFIX TF> Decompile done! %; \
    /send OUTPUTSUFFIX


;;; /dec-all <player>
;;; This command will @decompile all objects of that player's owned items (player, objects, rooms, exits) 
;;; into separate files. Note that this is subject to the output limit of the mu* being high enough to 
;;; avoid loss of data. In other words, while the command does work, the mu* may not be able to handle it if the 
;;; player has even one or two large objects. Use with caution.

;;; Comments from Gwen: I've used this but it breaks with large objects, as described above.
;;; Using the Outputsuffix is supposed to at least partially mitigate this issue. I don't know if it 
;;; actually works, yet.

;;; exit names with triangle brackets < > break creating a log name (at least under windows).

/def -q dec-all-play = \
    /log -w off %; \
;;   	/more off %; \
        /send @pemit me=TF DEC DIR> \[mudname\(\)\]-\[edit\(name\(*%*\),\%b,_\)\] %; \
	      /send @pemit me=TF DEC CHAR> \[mudname\(\)\]-\[edit\(name\(*%*\),\%b,_\)\] %; \
        /send @dolist \[search\(%*\)\] = \
                \{@pemit me= DEC> \%r\%rNow working with object ##, name [edit(name(##),\%b,_)]; \
                  @decompile ##; \
                  @pemit me=DEC> Object ready!}


;;;;;; DEC checks needed for Dec-all script

/def -p100 -qi -t'DEC> Now working with object *' dec_start = \
    /log -w %{DECDIR}/decall_${world_name}_%8.log

/def -p100 -qi -t'DEC> Decompile done!' dec_end = \
    /log -w off f