  | 
	
	
	
		Langly Newbie
 
  Joined: 07 Dec 2001 Posts: 4
 
  | 
		
		  
			
			   Posted: Fri Dec 07, 2001 9:31 pm   
  Random line trigger?   | 
			 
			
				I have a text file from which I'd like to get a random line sent to the MUD with a variable as a postfix. I've tried to get this done with #READ, like this:
 
 
#FILE 1 foobar.txt
 
#READ 1 %random(325) %1
 
 
The variable just doesn't get sent to the MUD with the line. What am I doing wrong? Any suggestions?
 
 
 Thanks in advance! | 
			 
		  | 
	
	
	  | 
		  
		 | 
	
	
		  | 
	
	
		Toetag Magician
 
  Joined: 10 Oct 2000 Posts: 356 Location: USA
  | 
		
		  
			
			   Posted: Fri Dec 07, 2001 10:11 pm      | 
			 
			
				Test in 6.21
 
 
Alias:
 
 
testsay
 
 
Command:
 
 
#FILE 1 foobar.txt
 
#var ran_num %random(1,10)
 
#READ 1 @ran_num
 
 
 
Killing a fly on a friends forhead may not be overkill, use a hatchet to make sure the job is done. | 
			 
		  | 
	
	
	  | 
		  
		 | 
	
	
		  | 
	
	
		Langly Newbie
 
  Joined: 07 Dec 2001 Posts: 4
 
  | 
		
		  
			
			   Posted: Sat Dec 08, 2001 12:08 am      | 
			 
			
				Yes, that works too but it still doesn't solve my problem how to get the %1 of the trigger to be sent to MUD with the #READ line.
  | 
			 
		  | 
	
	
	  | 
		  
		 | 
	
	
		  | 
	
	
		Troubadour GURU
 
  Joined: 14 Oct 2000 Posts: 556 Location: USA
  | 
		
		  
			
			   Posted: Sat Dec 08, 2001 12:12 am      | 
			 
			
				You are using the arguement option of the #READ command incorrectly.  The arguements are not appended to the line. What happens is that any parameter holders (%1..%99) in the line are expanded (filled) with the arguements. So if line 36 of file #1 is:
 
 
#SEND The quick brown %1 jumps over the lazy %2~.
 
 
 
then the command 
 
 
#READ 1 36 fox dog 
 
 
would send 
 
 
The quick brown fox jumps over the lazy dog. 
 
 
to the MUD.
 
 
Troubadour   | 
			 
		  | 
	
	
	  | 
		  
		 | 
	
	
		  | 
	
	
		Langly Newbie
 
  Joined: 07 Dec 2001 Posts: 4
 
  | 
		
		  
			
			   Posted: Sat Dec 08, 2001 12:28 pm      | 
			 
			
				It still doesn't work. If I use #SEND, nothing happens, with #say it echoes the line correctly to the screen, but the %1 appears only as "1". 
 
BTW, my zmud version is 5.55 if that makes any difference. | 
			 
		  | 
	
	
	  | 
		  
		 | 
	
	
		  | 
	
	
		Troubadour GURU
 
  Joined: 14 Oct 2000 Posts: 556 Location: USA
  | 
		
		  
			
			   Posted: Sat Dec 08, 2001 7:21 pm      | 
			 
			
				Ah, ok, I didn't understand what you were trying to do.  As I understand it now, this is a trigger action and the %1 is a parameter holder for something in the trigger pattern. You should use the %read function to retrieve your file record.
 
 
#FILE 1 foobar.txt
 
#SAY %read(1, %random(1, 325)) %1
 
 
This oughta do it.
 
 
Troubadour   | 
			 
		  | 
	
	
	  | 
		  
		 | 
	
	
		  | 
	
	
		Langly Newbie
 
  Joined: 07 Dec 2001 Posts: 4
 
  | 
		
		  
			
			   Posted: Sat Dec 08, 2001 11:05 pm      | 
			 
			
				Yeah, now it works perfectly :)
 
thanks! | 
			 
		  | 
	
	
	  | 
		  
		 | 
	
	
		  | 
	
	
		| 
		
		 | 
	
	
		 |