I play Discworld MUD and I decided to make a plugin that will enhance the item lists in shops.
This is an example snippet of a shop list:
I made a regex that captures the item name, the currency and the price (the last two may be used later for other purpose) like this:
My idea is to make every item entry a clickable link that can be right-clicked for a pop-up menu with command options such as |buy <Item>|browse <Item>|case <Item>|shoplift <Item>| etc.
I have some basic scripting knowledge but I would like some advise on what would be the best approach for realizing this? mxp? hyperlink? Is there a function dedicated to creating such thing?
Help and advice will be highly appreciated.
[EDIT] The currency and the price are captured in this case, but there are some currencies in the MUD with different formatting. I will have to come up with a better idea for capturing them properly, but for now this is far less important.
This is an example snippet of a shop list:
The following items are for sale:
A: a large watermelon for DjToon 25.00 (five left).
B: a medium watermelon for DjToon 17.50 (four left).
C: a small watermelon for DjToon 10.00 (seven left).
D: an overripe plum for DjToon 1.87 (four left).
E: a succulent pineapple for DjToon 6.00 (six left).
F: a juicy peach for DjToon 5.00 (five left).
G: an orange for DjToon 3.00 (seven left).
H: a juicy nectarine for DjToon 5.00 (three left).
I: a musk melon for DjToon 18.00 (five left).
J: a small lemon for DjToon 2.50 (four left).
I made a regex that captures the item name, the currency and the price (the last two may be used later for other purpose) like this:
^ [A-Z]{1,2}: ?a?n? (?<Item>.*) for (?<Currency>\w+) (?<Price>[\d.]+) \(\w+ left\)\.$My idea is to make every item entry a clickable link that can be right-clicked for a pop-up menu with command options such as |buy <Item>|browse <Item>|case <Item>|shoplift <Item>| etc.
I have some basic scripting knowledge but I would like some advise on what would be the best approach for realizing this? mxp? hyperlink? Is there a function dedicated to creating such thing?
Help and advice will be highly appreciated.
[EDIT] The currency and the price are captured in this case, but there are some currencies in the MUD with different formatting. I will have to come up with a better idea for capturing them properly, but for now this is far less important.