Crystal Market Grab

From Gwen Morse's Wiki
Jump to: navigation, search

This macro depends on the Grab macro. This is not needed by people wanting to use the collection of CrystalMUSH/CrystalDREAMS macros. Instead it's merely provided as an illustrative example of how to use the Grab macro.

;;; This is not needed by people wanting to use the collection of 
;;; CrystalMUSH/CrystalDREAMS macros. Instead it's merely provided as an 
;;; illustrative example of how to use the Grab macro.
;;;
;;; As per the original author: 
;;; After a question like this appeared quite often, thought it would be nice
;;; to have a macro (file) that is able to cope with several solutions like
;;; this.
;;; Generally a concept like the one Adrian proposed can be used to accomplish
;;; such a thing. I tried to combine several macros I wrote to catch lines of
;;; text from the mud into one powerful macro that is able to cope with many
;;; situtations (and is extensible).

;;; For your problem the solution using this macro file should be as simple as
;;; this:


/def -F -t"*Crystal Market values*" trig_market_values = \
	/trig_grab -b"*color:*" -vcrystal_color -e"{}" -aCwhite -M/echo%;\
	/trig_grab -b"*shape:*" -vcrystal_shape -e"{}" -aCwhite -M/echo%;\
	/trig_grab -b"*size:*" -vcrystal_size -e"{}" -aCwhite -M/echo

/def -F -t"*Data last updated:  *" -mglob trig_marked_date = \
	/let update_date=%-3%;\
	/if (update_date!~market_last_update_date) \
; to save market_last_update_date over sessions you may write it to an
; file and load it after tf starts or also set is as a property in you
; char
	/set marked_last_update_date=%update_date%;\
; do anything with the variables crystal_color, crystal_shape,
; crystal_size here
	/endif%;