|
MazdaFan Newbie
Joined: 05 Oct 2011 Posts: 2
|
Posted: 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? |
|
|
|
Fizgar Magician
Joined: 07 Feb 2002 Posts: 333 Location: Central Virginia
|
Posted: 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 |
|
|
|
MazdaFan Newbie
Joined: 05 Oct 2011 Posts: 2
|
Posted: 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.
|
|
|
|
|
|