Welcome to the Builder Academy

Question Command triggers using counted items

More
14 Dec 2014 23:44 #5145 by Parnassus
I have a trigger which prevents sacrificing certain items. It purges the item instead since saccing gives certain benefits which I felt was unreasonable for such an easy-to-get item. However, I've found that it's possible to get around this by dropping two and saccing the second one.

Is there a way to check for a number followed by a period if the period is followed by the target word? In this example, the object is bread. The command is sac, the argument is bread. What if I wanted to sac 2.bread? Is there a way to separate the 2 from the .bread? And what if it were 21.bread? The first character wouldn't work then because that would be 2.bread even though that wasn't what was meant. I've also found that if I drop one of my bread, then one with another vnum, then mine again, then the other again, it will always sac my bread first, no matter where on the line it occurs.

Please Log in or Create an account to join the conversation.

More
16 Dec 2014 00:39 #5155 by Rumble
Try this:
if %cmd.mudcommand% == sacrifice

That should catch all instances of the command.

Rumble
The Builder Academy
tbamud.com 9091
rumble@tbamud.com

Please Log in or Create an account to join the conversation.

More
17 Dec 2014 02:00 #5158 by Parnassus
But I don't want it to happen in every instance. For instance, if one of my breads is on the floor and a loaf of bread (different vnum) is also on the floor, I want my bread to be affected when the player types "sac bread" but the other one to not be affected when "sac bread" is typed. If there are 2 instances of my bread on the floor, I want the trigger to hit if the player types "sac bread" or "sac 2.bread".

Please Log in or Create an account to join the conversation.

More
17 Dec 2014 03:19 #5159 by Rumble
You can give it a unique alias or check the vnum of the object.

Rumble
The Builder Academy
tbamud.com 9091
rumble@tbamud.com

Please Log in or Create an account to join the conversation.

More
18 Dec 2014 21:39 #5161 by Parnassus
That still won't work for 2.bread, 3.bread especially if they all have the same vnum.

Please Log in or Create an account to join the conversation.

More
19 Dec 2014 01:54 #5162 by Parnassus
Actually, I think I'm being distracted by non-essentials.

Using examples from:
www.tbamud.com/forum/3-building/3761-tri...-text-variables#4666
%echo% CAR: %speech.car%
%echo% CDR: %speech.cdr%

This will take apart a line of words, separated by spaces.

%echo% CONTAINS: %speech.contains(test)%
%echo% CHARAT 3: %speech.charat(3)%

I can use these to check for a .

So now the question is, if I find a ., can I use it to separate the string? Is there a way to read what is to the left of the . (such as 2.bread or 12.bread) and delete the . itself along with the phrase to the left? That would give me a number that I can use as %arg%.

Please Log in or Create an account to join the conversation.

Time to create page: 0.201 seconds