How To ...

Posted by Ves on Mon 11 Oct 2010 02:57 AM — 3 posts, 18,338 views.

#0
Hello,

I wanted to write something to store a bunch of variables.

I want to store the following:

The following beings are in your entourage:
A simpering Sycophant#309909, a sharp-toothed gremlin#406665, a bloodleech#405041, a chaos orb#406735, a dervish#359545, an ethereal firelord#316659, a humbug#406843, a bubonis#406885, a chimera#406830, Vraet#317671, a worm#406925, a soulmaster#407037, a green slime#407078, a minion of chaos#406879, a chaos storm#406881, a chaos hound#188622.

Each creature's number below "The following beings are in your entourage:"

I tried using wildcards but it was having issues with the multiple lines. I know there is a much cleaner way to do it with scripting. Anyone able to help?

Basically want to store them in variables so I can see which creatures im missing. etc.
Netherlands #1
Basically, you'll want to do this in three parts. I am assuming all the different entities are on a seperate line, as that is how the last IRE mud I played showed that. If it is all on the same line, you'll need a different approach and this outline won't be of much help.

1. A trigger that matches the first 'beginning' line The following beings are in your entourage:, clears your current entourage and enables a triggergroup which I'll call entourage_triggers for clarity.

2. A trigger that matches a single line of your chaos entities, which starts out disabled and has entourage_triggers as its group. Make it a regular expression along the lines of ^\s*(.+?)#(\d+), and use a script that adds it.

3. Have another trigger that matches whatever follows this, also disabled by default and also the same group, which disables the entourage_triggers group.

I didn't give you the exact script because IRE games are pretty scriptheavy in nature, and having you work your way through the problem to get it to do what you want will help you far more in the long run. Although, in my experience, there's quite a few MUSH users on those games, so you might be able to have one of them help you in more detail (seeing how they know the game better than I would).

Feel free to ask any more questions though, preferably with a bit more detail and showing what you have tried.
Australia Forum Administrator #2
A multi-line trigger might do it in your case.

Template:post=10581
Please see the forum thread: http://gammon.com.au/forum/?id=10581.


If the trigger searched for "^The following beings are in your entourage:\n" followed by pretty-much what I had in the other post, then that should fetch the whole lot, up to the period, as one piece of text. Then you could do a similar thing, replace newlines by spaces, and then do a string.gmatch to extract out the mob names and numbers.