Gwen's DBC Decompile

From Gwen Morse's Wiki
Jump to: navigation, search
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; MUSH/MUX data-base cloning
; Based on a count script by Michael Hunger (mh14 at inf dot tu-dresden dot de)
; Expanded to clone by Gwen Morse (gwen dot morse at gmail dot com)
; Used OUTPREFIX examples provided by Kareila at chaoticMUX
;
; Handy little macro to @dec items incrementally in a database, one item at a time.
; Requires Wiz powers (or, will only @dec dbrefs you actually own).
;
; type: /dbc <number> 
; where <number> is the *last* number in the database you want to log.
; @stats will tell you last # in database.
;
; Macro tells you the number and name of each item being cloned, and then 
; @decompiles it to a log. Starts with #0
				  
/def -w -q -F dbc = \
;;; if a parameter was given
        /if ({#} > 0)%;\
           /log -w${world_name} off %;\
           /more off %;\
           /idler %;\
           /log -w %{DECDIR}/$[ftime("%Y-%m-%d", time())]_decompile_${world_name}.log %;\
;;; set variables (grabs from number entered)
           /set counter=-1%;\
           /set end_counter=%1 %;\
        /endif%;\
;;; if end reached end log
        /if (counter==end_counter) %;\
           /more off %;\
           /relog %;\
           /log -w off %;\
        /endif%;\
;;; if end not reached call itself in 2 (-2) seconds
        /if (++counter<=end_counter)%;\
		/send -w @pemit me = \%r\%r@@DBC> Now working with object #%counter, name: [edit(name(#%counter),\%b,_)] %; \
		/send -w @decompile #%counter %; \
		/repeat -w -2 1 /dbc%;\
        /endif%;\

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; /dbs <number>
;; works like dbc, except each object is written to a separate file.

/def -w -q -F dbs = \
;;; if a parameter was given
        /if ({#} > 0) %;\
           /log -w${world_name} off %;\
;;           /more off %;\
           /idler %;\
;;; set variables (grabs from number entered)
           /set counter= -1 %;\
           /set end_counter=%1 %;\
        /endif%;\
;;; if end reached end log
        /if (counter==end_counter) %;\
           /more off %;\
           /relog %;\
        /endif%;\
;;; if end not reached call itself in 2 (-2) seconds
        /if (++counter<=end_counter)%;\
	    /send -w @pemit me = DBS> Now working with object #%counter, name: [edit(name(#%counter),\%b,_)] %; \
	    /def -q -ag -n1 -p1000 -t'DBS> Decompile done!' dbs_hide %; \
	    /send -w @decompile #%counter %; \
	    /send OUTPUTSUFFIX DBS> Decompile done! %; \
            /send OUTPUTSUFFIX %; \
            /repeat -w -2 1 /dbs%;\
        /endif%;\
    
;;;    
;;;;;; DBC checks needed for DBC scripts

/def -p100 -qi -t'DBS> Now working with object *' dbs_start = \
    /log -w %{DECDIR}/dbs_${world_name}_%{counter}_%8.log

/def -p100 -qi -t'DBS> Decompile done!' dbs_end = \
    /log -w off