|  | 
	
	
		| Bardack Newbie
 
 
 Joined: 21 Jun 2010
 Posts: 1
 
 
 | 
			
			  |  Posted: Mon Jun 21, 2010 5:54 pm 
 SWMud scripting issue
 
 |  
				| I'm having some issues trying to get a trigger to grab target ID numbers to fire.  I've tried * * (*) * (%d) * (%d) * (%d) * (%d) *
 * * (*) * (%d) * (%d)* (%d )* (%d)
 TIE Fighter (*) (%d) * (%d) * (%d) *
 
 All of which work sporadically but none of them are reliable but the top one is the most consistent.
 The lines being parsed are below, trying to run all 3 just ends up with commands being spammed wildly.
 
 
 
 
	  | Code: |  
	  | Object Description               ID     Dist     X     Y     Z -------------------------------------- -------- ------  ----- ----- -----
 Planet Newbiway (Newbiway)                 ****    103   1000     0     0
 TIE Fighter (tie 7)                       33114    504   -781   591  -197
 TIE Fighter (tie 4)                       60250    219   -432   901     0
 -------------------------------------- -------- ------  ----- ----- -----
 Location: The Newbiway System          Current Vector:  -1000     0     0
 |  
 EDIT (MattLofton):added code tags to show the spacing
 |  | 
	
	  |  | 
	
		|  | 
	
		| MattLofton GURU
 
 
 Joined: 23 Dec 2000
 Posts: 4834
 Location: USA
 
 | 
			
			  |  Posted: Mon Jun 21, 2010 7:47 pm 
 |  
				| you need to spend more time with the Pattern Matching helpfile, but you'll want something like this: 
 #trigger {^($name:[%w%s]) ~(($shortname:[%w%s%d])~)%s($id:[%d~*])%s($dist:%d)%s($X:%d)%s($Y:%d)%s($Z:%d)$} {code}
 
 () = put this into the %1...%99 variables so I can use them in the code
 $varname: = same as (), but puts it into a local variable
 [] = continuous string of only these characters (allows the use of wildcards)
 ~ = used to prevent Cmud from using the next character as a wildcard or other specially-defined character
 %w = continuous string of only letters, both upper and lower case
 %s = continuous string of only whitespace
 %d = continuous string of only numbers (includes negative numbers)
 ^ = only match from the beginning of the line
 $ (the last one) = only match from the end of the line
 |  | 
	
	  | 
		    
			  | _________________ EDIT: I didn't like my old signature
 |   |  | 
	
		|  | 
	
		|  | 
	
		|  |