Simple shop trigger

by Unknown

Back to Mechanic's Corner.

Unknown2007-01-08 02:22:22
Hey everyone, I have a simple trigger that I would like to share with everyone. Tired of scanning down a list of items in a shop, looking for the right vnum, and typing in that vnum with each item you want to buy? Well, thanks to the power of Zmud and MXP, you don't have to anymore, just use this simple trigger and you can simplify the process tremendously!

CODE

#trigger {(%w)(%d)} {#sub {~ %1%2 ~}}


Now, whenever you see a vnum, say vial1234, whether in a shop or info here or whatever, it will be turned into a hyperlink. If you click the link, it will probe the item in question, if you right click, it will have a menu that will say probe, buy, and get, and you just have to click on your choice to execute the action. Much better than typing out vnums!
Veonira2007-01-08 02:30:16
Oohhh, that's very cool. If only I used zmud tongue.gif
Kharaen2007-01-08 03:51:51
Niiiiiiice. I'll be using this baby now smile.gif
Richter2007-01-08 06:11:08
This is amazing, I love it!
Richter2007-01-08 06:25:57
One problem, it affects my items when I do II, makes it hard to deal with them.
Elysiana2007-01-08 07:02:14
This is awesome. I can see there's a lot of capabilities zmud has that I still need to explore!
Shorlen2007-01-08 12:32:34
QUOTE(Richter @ Jan 8 2007, 01:25 AM) 370499
One problem, it affects my items when I do II, makes it hard to deal with them.

That's easy to stop, and there's two ways to do it. The simplest is to replace what you have with the following:

CODE
#trigger "shopitemtrig" {(%w)(%d)} {#sub {~ %1%2 ~}} "" {disable}

(in other words, name it and disable it, and do:)

#alias wares {#t+ shopitemtrig;~wares %-1;#alarm "shoptrigalarm" +10 {#t- shopitemtrig}}

The above will turn on the trigger when you type WARES, but then turn it back off after ten seconds. Feel free to adjust the time, or set up something else that will turn it off on other circumstances. You can even do:

CODE
#alias wares {#t+ shopitemtrig;~wares %-1}
#alias ii {#t- shopitemtrig;~ii %-1}
#alias ih {#t- shopitemtrig;~ih %-1}

(instead of the wares alias above)
Gwylifar2007-01-08 15:17:28
Instead of aliasing wares it might be better to do it with triggers, like so:

CODE
#trigger "tShopItemLink" {(%w)(%d)} {#sub {~ %1%2 ~}} "" {disable}
#trigger {^Proprietor: } {#t+ "tShopItemLink";#alarm {+10} {#t- "tShopItemLink"}}

If someone already has wares aliased for some reason, aliasing wares again can cause Bad Things, but this should work fine either way.
Unknown2007-01-08 16:08:45
QUOTE(Richter @ Jan 7 2007, 10:25 PM) 370499

One problem, it affects my items when I do II, makes it hard to deal with them.



I left it that way on purpose so that you could select "probe" from II and IH and also get from IH. If you don't want to use it like that then what the others suggested is good.
Unknown2007-01-08 19:44:21
CODE

#trigger {(%w)(%d)} {#sub {~ %1%2 ~}}


I just realized I made this a little bit redundant, instead of using "probe %2...." "probe %1%2....." it's best to just use "probe %1%2...." and leave out the second set of quotes all together, the first set is for the command, and the second is for the text, but if you leave out the second, the text just defaults to the command.
Richter2007-01-09 06:08:09
QUOTE(Daruin @ Jan 8 2007, 08:08 AM) 370615

I left it that way on purpose so that you could select "probe" from II and IH and also get from IH. If you don't want to use it like that then what the others suggested is good.


I copy/paste a lot using double click then ctrl+c, which is why it was a problem.
Unknown2007-01-09 07:30:47
another option is to use the #menu command, which doesn't turn things into hyperlinks

#menu {probe %selword|buy %selword|get %selword|eat %selword}
Ekard2007-01-09 09:07:10
I was using menu and had mane usefull commands there but i didnt know you can do hyperlinks.
Will test it when i get back to home. Seems useful.
Kharaen2007-01-11 15:58:58
Could someone put up code like this for messages? That'd be extremely useful.
Gwylifar2007-01-11 16:54:14
What do the messages look like and what do you want to have happen to them?
Kharaen2007-01-11 18:20:54
QUOTE
#51 Kharaen: 09/30 19:40 "A healthy, young animal. Coarse, blac...


I remember this one message code where you clicked on the name, and saw all the messages by that person, clicked on the number to read the message, right clicked to delete it.
Unknown2007-01-13 00:36:16
QUOTE(Kharaen d'Attai @ Jan 11 2007, 12:20 PM) 372181

I remember this one message code where you clicked on the name, and saw all the messages by that person, clicked on the number to read the message, right clicked to delete it.


The second two are easy enough. Try this:

#trigger {~#(%d) (%w):} {#sub {~~#%1 %2:~}}

Left click the message or the name to read it, right click for the menu which will let you delete it. In order to do the first part (click the name to see all messages by that person) you would have to have a more complicated script to store a data record of each message number and who sent it...it's not all that horribly complicated to write, but probably more effort than it's worth for the benefit.
Sylphas2007-01-15 09:29:26
I should see if I can roll something like that into my horridly unwieldy message system. It already stores them all into a text file, why not add searching? *chin*
Unknown2007-01-16 17:36:11
Ok, I just switched to Cmud, and this shop script isn't compatable. The reason is that in Cmud, text within quotes is not expanded. Zuggsoft should make it so that MXP commands are an exception to this, but otherwise I don't know if there are any workarounds.
Unknown2007-01-16 22:06:24
Try curly brackets {} instead of quotes "". Zugg's not going to make syntax exceptions. That's what got him into so much trouble in zMUD, which has far too many special cases and little quirks. tongue.gif