Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Lua ➜ How To ...

How To ...

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Ves   (8 posts)  Bio
Date Mon 11 Oct 2010 02:57 AM (UTC)
Message
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.
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #1 on Mon 11 Oct 2010 03:43 AM (UTC)
Message
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.
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #2 on Mon 11 Oct 2010 04:42 AM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


14,798 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.