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 ➜ Help using Lua tables.

Help using Lua tables.

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


Posted by Thanubrius_Black   (2 posts)  Bio
Date Mon 21 Aug 2006 07:57 PM (UTC)

Amended on Mon 21 Aug 2006 07:58 PM (UTC) by Thanubrius_Black

Message
Hi. I'm very new to this. Just in my second week of learning Lua (and programming in general) and I'm trying to create a combat system for the MUD, Aetolia.

Say I'd like to create a table, called "herb_affs", that stores afflictions (various ailments, etc that my character can receive which could lead to his death) along with their corresponding cures, and have in that table a list of all known afflictions in Aetolia that are curable by herbs.


I'd like for this list to be prioritized, first off.

e.g.

herb_affs = {}

herb_affs.paralysis = bloodroot
herb_affs.stupidity = goldenseal


I'd want my system to cure paralysis before stupidity.

Also, how would I go about making a stringlist of the afflictions my character currently possesses?

How would I go about removing items from that stringlist?
How would I go about adding items to it?


I know I'm asking a bit, so thanks in advance to anyone kind enough to post a reply.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Mon 21 Aug 2006 09:27 PM (UTC)

Amended on Mon 21 Aug 2006 10:13 PM (UTC) by Nick Gammon

Message
There has been a bit of work on an afflictions table in the past. Check out these posts:

http://www.gammon.com.au/forum/?id=5514

http://www.gammon.com.au/forum/?id=6457

http://www.gammon.com.au/forum/?id=6074

The third one in particular has a lengthy treatment of handling afflictions in Lua, prioritizing them and so on.

- Nick Gammon

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

Posted by Thanubrius_Black   (2 posts)  Bio
Date Reply #2 on Tue 22 Aug 2006 12:08 AM (UTC)
Message
Thank you, Nick.
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,408 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.