|  | 
	
	
		| Darklord Beginner
 
 
 Joined: 29 Jan 2008
 Posts: 17
 
 
 | 
			
			  |  Posted: Sat Mar 08, 2008 1:25 am 
 #add outfit %1
 
 |  
				| I cant seem to get %1 from a equ list 
 [ left finger   ]  [100] Olog'Hai Signet Ring
 [ right finger ]  [100] Olog'Hai Signet Ring
 [ neck 1       ]  [100] Pendant of Spirits
 [ neck 2       ]  [100] Pendant of Spirits
 [ torso         ]  [100] the body armor of the Purple Dragon
 [ head         ]  [100] a Kingly Crown
 
 
 Tried this
 Pattern: [ left finger   ]  [(%d)] (%w)
 #add outfit %2
 
 but I dont get %2, dont care what %d is, but that can be 1 to 100, so using %d
 
 I have a feeling its the [ ] in the pattern, but I dont know how to handle them
 |  | 
	
	  |  | 
	
		|  | 
	
		| Arminas Wizard
 
 
 Joined: 11 Jul 2002
 Posts: 1265
 Location: USA
 
 | 
			
			  |  Posted: Sat Mar 08, 2008 1:49 am 
 |  
				| You are correct that it is the [ and ]'s that are causing the problem. 
 Just use a tilda, "~", before them to make Zmud see them as ordinary characters instead of special ones.
 
 ~[ left finger   ~]  ~[(%d)~] (%w)
 |  | 
	
	  | 
		    
			  | _________________ Arminas, The Invisible horseman
 Windows 7 Pro 32 bit
 AMD 64 X2 2.51 Dual Core, 2 GB of Ram
 |   |  | 
	
		|  | 
	
		| Vijilante SubAdmin
 
  
 Joined: 18 Nov 2001
 Posts: 5187
 
 
 | 
			
			  |  Posted: Sat Mar 08, 2008 1:52 am 
 |  
				| Small changes to the pattern to correct it to match.  Since you didn't care what the %d was I remove the capture of it.  Anchored the pattern to both start and end of line, the end of line anchor is mostly superfluous, but I think there is an optimization in the matching engine that uses it. I also adjusted the final capture to pick up all words. 
 The #ADD command does both numeric computation and concatenation.  Since you are passing it text it would preform a concat, however you supplied no seperator in your script.  The lack of a seperator would make it hard to determine which words should be grouped together or which characters formed a word. Considerthissentenceandshouldfinditisnothardtoreadsinceyoucanparsethemeaningofwords.  The change to #ADDITEM provides a seperator that is used in many other commands and functions, and will work much better for you.
 
 Pattern: ^~[ left finger ~] ~[%d~] (*)$
 #ADDITEM outfit {%1}
 |  | 
	
	  | 
		    
			  | _________________ The only good questions are the ones we have never answered before.
 Search the Forums
 |   |  | 
	
		|  | 
	
		| Darklord Beginner
 
 
 Joined: 29 Jan 2008
 Posts: 17
 
 
 | 
			
			  |  Posted: Sat Mar 08, 2008 1:30 pm 
 |  
				| Thanks to both of  you for repling to this post. However, I tried both of your samples and I'm still not able to populate the 'outfit' variable. 
 I tested the pattern and it returns pattern matches but nothing is added to 'outfit'
 |  | 
	
	  |  | 
	
		|  | 
	
		| Darklord Beginner
 
 
 Joined: 29 Jan 2008
 Posts: 17
 
 
 | 
			
			  |  Posted: Sat Mar 08, 2008 2:16 pm 
 |  
				| Well correction to this, things seem to work after you walk away for a few. I got it working to some degree using Arminas example. 
 It only adds the first word of the string tho, ie "Olog'Hai" from "Olog'Hai Signet Ring" which will work
 
 Note: to get to work, I had to insure the spacing was correct where blank spaces are found.
 
 Thanks again guys, you guys rock
 Darklord
 |  | 
	
	  |  | 
	
		|  | 
	
		| JQuilici Adept
 
 
 Joined: 21 Sep 2005
 Posts: 250
 Location: Austin, TX
 
 | 
			
			  |  Posted: Sat Mar 08, 2008 2:30 pm 
 |  
				| Ok...let's boil this down to essentials: 
 
 Start zMUD
Hit ESC to dismiss the session window and start an empty session in offline mode
Type the following at the command line, and hit return:
 
 
	  | Code: |  
	  | #trig {^~[ * ~] ~[%d~] (*)$} {#additem outfit {%1}} |  Note that I'm throwing away both the slot name (the * in the first set of brackets) and that numeric code (the %d in the second set of brackets).  If you want to keep either one, put parens around it and shift the %n numbers appropriately.
 Hit Ctrl-R to turn off command parsing on the command line (so we can paste in your sample output w/o escaping all the special characters)
 Paste the sample output into the command line and hit return:
 
 
 
	  | Code: |  
	  | [ left finger ] [100] Olog'Hai Signet Ring [ right finger ] [100] Olog'Hai Signet Ring
 [ neck 1 ] [100] Pendant of Spirits
 [ neck 2 ] [100] Pendant of Spirits
 [ torso ] [100] the body armor of the Purple Dragon
 [ head ] [100] a Kingly Crown
 |  Hit Ctrl-R again to turn command parsing back on
 Type the following at the command line, and hit return:
 
 
 When I do that, I get the following output:
 
 
 
	  | Code: |  
	  | Olog'Hai Signet Ring|Pendant of Spirits|the body armor of the Purple Dragon|a Kingly Crown |  ...which looks about right.
 
 One note: it is important to use the curly braces around the %1 in the trigger body, so that multiple-word items are added correctly (rather than just the first word of the item).
 
 Second note: #additem suppresses duplicates - if you want to include the duplicates in the list twice, the trigger should instead be:
 
 
 
	  | Code: |  
	  | #trig {^~[ * ~] ~[%d~] (*)$} {outfit=%additem({%1},@outfit)} |  which results in the following value of @outfit:
 
 
 
	  | Code: |  
	  | Olog'Hai Signet Ring|Olog'Hai Signet Ring|Pendant of Spirits|Pendant of Spirits|the body armor of the Purple Dragon|a Kingly Crown |  
 EDIT: Heh...looks like we crossposted.  Check my notes for the solution to your first-word problem.
  |  | 
	
	  | 
		    
			  | _________________ Come visit Mozart Mud...and tell an imm that Aerith sent you!
 |   |  | 
	
		|  | 
	
		| Darklord Beginner
 
 
 Joined: 29 Jan 2008
 Posts: 17
 
 
 | 
			
			  |  Posted: Sun Mar 09, 2008 3:30 pm 
 |  
				| Thanks again guys, whats the best way to remove, 'the', 'a', 'an', 'some' from {%1} if it appears at the start of {%1} 
 |  | 
	
	  |  | 
	
		|  | 
	
		| Fang Xianfu GURU
 
  
 Joined: 26 Jan 2004
 Posts: 5155
 Location: United Kingdom
 
 | 
			
			  |  Posted: Sun Mar 09, 2008 3:42 pm 
 |  
				| var=%subregex(%1,"^(a|an|the|some) ","") 
 |  | 
	
	  |  | 
	
		|  | 
	
		| Darklord Beginner
 
 
 Joined: 29 Jan 2008
 Posts: 17
 
 
 | 
			
			  |  Posted: Sun Mar 09, 2008 3:50 pm 
 |  
				| I love this place, yall are the best. 
 Fang that worked fine until it sees an item begins with 'a' so I
 var=%subregex(%1,"^(a |an |the |some ) ","") added a space after each.
 |  | 
	
	  |  | 
	
		|  | 
	
		| Fang Xianfu GURU
 
  
 Joined: 26 Jan 2004
 Posts: 5155
 Location: United Kingdom
 
 | 
			
			  |  Posted: Sun Mar 09, 2008 4:02 pm 
 |  
				| You'll want to remove the space at the end in that case, or it won't match - there'll be two spaces in a row, which don't occur in the text. 
 |  | 
	
	  |  | 
	
		|  | 
	
		|  | 
	
		|  |