Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Langly
Newbie


Joined: 07 Dec 2001
Posts: 4

PostPosted: 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!
Reply with quote
Toetag
Magician


Joined: 10 Oct 2000
Posts: 356
Location: USA

PostPosted: 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.
Reply with quote
Langly
Newbie


Joined: 07 Dec 2001
Posts: 4

PostPosted: 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.
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: 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
Reply with quote
Langly
Newbie


Joined: 07 Dec 2001
Posts: 4

PostPosted: 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.
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: 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
Reply with quote
Langly
Newbie


Joined: 07 Dec 2001
Posts: 4

PostPosted: Sat Dec 08, 2001 11:05 pm   
 
Yeah, now it works perfectly :)
thanks!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net