| 
	
		|  |  
		| mornick Newbie
 
 
 Joined: 03 Dec 2009
 Posts: 2
 
 
 | 
			
			  |  Posted: Fri Dec 04, 2009 4:10 am 
 Automatic data capture for equipment databases
 
 |  
				| I am currently trying to create an automated data capturing scheme for identified equipment on a mud. 
 I have a couple of issues that I haven't been able to figure out from the documentation included with Cmud:
 
 1) Is it possible to treat variables to be sent to the database as a string of words in such a manner that you can append additional data to the string for several different flags in order to populate a field of the type "Option List"?
 2) Can one trigger activate several times on one line of output? (See example, i.e. capture several distinct Item flags or anti flags...)
 3) Is it possible to capture information across several lines of text? (I.e. could I possibly capture the entire identify report and include it as a "Memo" type field in the database.)
 4) Is it possible to capture a "Text" field and then have the database automatically evaluate the field and extract several numbers and/or flags from it? (e.g. Is it possiblet to record all "AFFECTS: X by Y" without having to make a separate trigger for each specific stat, skill and characteristic in the game?)
 
 I'll include some samples of identify output from the mud here below:
 
 Object: 'Carilian Breast Plate'
 Keywords 'breast plate carilian', Item type: ARMOR
 Can be worn on :TAKE BODY
 Item is: MAGIC BLESS DONATED
 Anti flags: !MAGE !THIEF
 Weight: 35, Value: 0
 AC-apply is 15
 Can affect you as :
 Affects : SKILL_PARRY By 2
 level limit: Earl
 
 Object: 'Underwater Lantern'
 Keywords 'underwater lantern', Item type: LIGHT
 Can be worn on :TAKE HOLD
 Item will give you following abilities:  FREE-ACTION WATER-BREATH
 Item is: MAGIC BLESS DONATED
 Weight: 1, Value: 0
 Can affect you as :
 Affects : ARMOR By -2
 level limit: 38
 
 Object: 'The Eternal Flame'
 Keywords 'eternal flame', Item type: LIGHT
 Can be worn on :TAKE HOLD
 Item is: MAGIC DONATED
 Anti flags: !MAGE !CLERIC !THIEF
 Weight: 1, Value: 5000
 Can affect you as :
 Affects : CON By 1
 Affects : STR By 1
 Affects : DAMROLL By 1
 Affects : SKILL_SECOND_ATTACK By 1
 level limit: 9
 
 Object: 'Carved Oak Cuisses'
 Keywords 'carved oak cuisses', Item type: ARMOR
 Can be worn on :TAKE LEGS
 Item is: DONATED
 Item can be only worn by: evil warrior
 Weight: 5, Value: 0
 AC-apply is 12
 Can affect you as :
 Affects : SKILL_PUNCH By 2
 Affects : HEALTH By 2
 Affects : CON By 2
 level limit: Baron
 
 Object: 'Leather Backpack'
 Keywords 'pack backpack leather', Item type: CONTAINER
 Can be worn on :TAKE ABOUT HOLD
 Item is: NOBITS
 Weight: 5, Value: 5000
 Can affect you as :
 Affects : ARMOR By -3
 level limit: Baron
 
 Object: 'Dirt covered wormskin'
 Keywords 'wormskin dirt dirty', Item type: WORN
 Can be worn on :TAKE ABOUT
 Item is: MAGIC
 Weight: 2, Value: 550
 Can affect you as :
 Affects : ARMOR By -1
 Affects : DEX By 1
 Affects : WIS By 1
 Affects : HIT By 5
 Affects : MANA By 5
 level limit: 12
 
 Object: 'testament'
 Keywords 'testament', Item type: SCROLL
 Can be worn on :TAKE HOLD
 Item is: NOBITS
 Weight: 1, Value: 1000
 Level 20 spells of:
 strength
 word of recall
 sense life
 level limit: 0
 
 All help appreciated. Cheers!
 |  |  
	  |  |  
		|  |  
		| MattLofton GURU
 
 
 Joined: 23 Dec 2000
 Posts: 4834
 Location: USA
 
 | 
			
			  |  Posted: Fri Dec 04, 2009 5:18 am 
 |  
				| 1)Probably via stringlist or a comma-delimited list (which is how you inputted them in the definition.)  Not real sure, though. 
 2)yes.  It's one of the check boxes on the Edit Trigger window
 
 3)Yes.  See Multi-state triggers, #CONDITION, and Trigger Options.
 
 4)No.  The database doesn't do any trigger/setting execution.  See #3 (specifically for Affects you'll want to look at manual states and the #STATE command).
 |  |  
	  | 
		    
			  | _________________ EDIT: I didn't like my old signature
 |   |  |  
		|  |  
		| Rahab Wizard
 
 
 Joined: 22 Mar 2007
 Posts: 2320
 
 
 | 
			
			  |  Posted: Fri Dec 04, 2009 3:28 pm 
 |  
				| Additional comments: 1)  You may also want to check the %concat() function.  You could append text to the end of your string with that function.
 4)  You could either do it with triggers, or with the %match() or %regex() functions.
 
 To expand on Matt's explanation for 3):
 You could do this with multistate triggers, or a couple other methods.  To do this, you need to have an identifiable line which will trigger the start of the capturing, and another identifiable line to turn off the capturing and initiate the processing of the captured stuff.  To do this, you have a trigger for the start line, and a secondary state to that trigger with either a blank pattern that appends %line or a "(*) pattern that appends %1, to whatever is receiving the captured lines.  This second state needs to be set to loop somehow, for example by setting it to type LoopLines, with a parameter of 99.  Then you create a separate trigger for the endline which does a "#state triggername 0", where triggername is the name of the first trigger.
 
 An alternative method is to create a class which defaults to disabled.  Within this class, you create triggers and variables to capture all of the information, e.g. a trigger which captures the "Item will give you following abilities" value into a variable within that class.  Inside the class you also have a trigger which catches the closing line that signals the end of the identify lines.  This trigger inserts the values from the variables into your database, then disables the class.  Finally, outside the class, you have a trigger for the line that signals the start of the identify lines, which enables the class.
 |  |  
	  |  |  
		|  |  
		| mornick Newbie
 
 
 Joined: 03 Dec 2009
 Posts: 2
 
 
 | 
			
			  |  Posted: Sat Dec 05, 2009 12:55 am 
 |  
				| Thanks guys. That's a lot to take on board. I'll have a look into it tonight I think. 
 Cheers!
 |  |  
	  |  |  
		|  |  
		|  |  
		|  |  
  
	| 
 
 | You cannot post new topics in this forum You cannot reply to topics in this forum
 You cannot edit your posts in this forum
 You cannot delete your posts in this forum
 You cannot vote in polls in this forum
 
 |  |