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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
MazdaFan
Newbie


Joined: 05 Oct 2011
Posts: 2

PostPosted: Fri Nov 04, 2011 12:34 pm   

Scripting Question
 
Ok, the task is as follows.

I have a bunch of items that I want to search. As a search is performed on each item, if they contain certain things (coins, potions, what ever), I want the script to get those items.

What I have so far is:


Code:
items = %param(1)
ItemCount = 0
#LOOP 1,@items {ItemCount = %i;#SEND look in %{i}.item;#SEND search %{i}.item}


where the alias is searchitems X where X is the number of items to search.

I have triggers set up to "get <trigger item> @ItemCount.item"

The problem is, that it sends the entire loop to the MUD before any searches are performed therefore the triggers never fire at the appropriate item. I'm looking for a way to send one "look in;search" command at a time so that the triggers will fire at the appropriate time. I've tried #WAIT XXX in the loop, but it still just sends the whole thing at once. Suggestions?
Reply with quote
Fizgar
Magician


Joined: 07 Feb 2002
Posts: 333
Location: Central Virginia

PostPosted: Fri Nov 04, 2011 1:16 pm   
 
You could try using #waitfor rather than #wait like below.
Code:
items = %param(1)
ItemCount = 0
#LOOP 1,@items {ItemCount = %i;#SEND look in %{i}.item;#SEND search %{i}.item;#waitfor {{nothing|something}}}


nothing would be the string returned when your search turns up nothing.
something would be the string returned when your search finds something.

You can use wildcards just like in a trigger when making the patterns.
_________________
Windows Vista Home Premium SP2 32-bit
AMD Athlon Dual Core 4400+ 2.31 GHz
3 GB RAM
CMUD 3.34
Reply with quote
MazdaFan
Newbie


Joined: 05 Oct 2011
Posts: 2

PostPosted: Fri Nov 04, 2011 3:58 pm   
 
That worked well, thank you. Now I've got some triggers to work on, but I appreciate your help.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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