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
danr62
Beginner


Joined: 17 May 2003
Posts: 20
Location: USA

PostPosted: Tue Jun 24, 2003 3:14 am   

trouble with a script
 
The mud I play displays vials in the following manner, when probed:

The pinewood vial is small cheap container.
It has 147 months of usefulness left.
It is strangely weightless.
It bears the distinctive mark of Rurin.
An elixir of health sloshes about in it.


The first line is the description, which is usually multiple lines, I used this one for simplicity's sake.

What I want to do is create a script that probes all my vials, and displays only the contents, then echoes back the vnum of each vial after it gets probed, so I can get a quick inventory of my vials. To accomplish this, I have a variable that looks like this:

#alias vl {#forall {@vials} {probe %i; #gagblock; #echo %i}}

What ends up happening is that all the vials in the @vials list get examined, but only the first has the #gagblock.
Reply with quote
danr62
Beginner


Joined: 17 May 2003
Posts: 20
Location: USA

PostPosted: Tue Jun 24, 2003 3:42 am   
 
One more thing, I do have a seperate trigger that puts a #CR after 'It bears the distinctive mark of', which ends the #gagblock, but I need to make it so that trigger is only active while this alias is running. I put the #cr trigger in a script called vials, and edited the vl alias like this:

#alias vials {#t+ vials; #forall {@vials} {probe %i; #gagblock; #echo %i}; #t- vials

Now, the first vial gets #gagblocked in it's entirety, and the #cr in the vials class doesn't work at all
Reply with quote
danr62
Beginner


Joined: 17 May 2003
Posts: 20
Location: USA

PostPosted: Tue Jun 24, 2003 4:55 am   
 
Ok, figured out the problem, the script was parsing faster than the text was being recieved from the mud, thus the class was already disabled before the vials were examined. Just had to throw in a few #wait commands, and everyting works fine
Reply with quote
tbone235
Apprentice


Joined: 02 Nov 2002
Posts: 107
Location: Australia

PostPosted: Tue Jun 24, 2003 7:44 am   
 
try to avoid wait commands, and have a look at alarms, or use a seperate trigger to close the class.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Jun 26, 2003 6:16 am   
 
#AL vl {#VAR VialContents "";#VAR VialCounter 1;#T+ Vials;probe %item( @Vials, @VialCounter)}
#TR Vials {^The * vial is } {#GAG}
#COND {^It has %d %w of usefulness left.} {#GAG} {Within|Param=1}
#COND {^It is strangely weightless.} {#GAG} {Within|Param=1}
#COND {^It bears the distinctive mark of} {#GAG} {Within|Param=1}
#COND {^(*) sloshes about in it.} {#ADDKEY VialContents %item( @Vials, @VialCounter) {%1};#IF (@VialCounter < %numitems( @Vials)) {#ADD VialCounter 1;probe %item( @Vials, @VialCounter)} {#T- Vials;#SHOW %expanddb( @VialContents, %crlf, ": "} {Within|Param=1}

This assumes that the display of each vial can't be interrupted. If that's not the case, you'll probably want to increase the Param value for the Within conditions.

No guarantees, I haven't tested it and don't intend to (no active characters on Achaea at this time).
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