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 ➜ Priority Database

Priority Database

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


Posted by Sredmon   (13 posts)  Bio
Date Sun 06 Jan 2008 02:05 AM (UTC)
Message
Greetings,

I'm new to MushClient and trying to build a combat system in the Mud Lusternia and well, need some help. First off, I'm new to these forums too so if this is on the wrong spot please let me know.

So I went through and created a variable for every single affliction name I could find. Now I want to create a database to store all the afflictions, in a certain priority so that when the system checks them, it goes through the database in that order and will determine what needs to be cured and do so in the right sequence. Here is an example:

addiction
aeon
anorexia
sleep

Now the order I want them in is:

sleep
aeon
anorexia
addiction

thanks everyone in advance for all the help.
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #1 on Sun 06 Jan 2008 03:24 AM (UTC)
Message
Try searching this forum for "Lusternia" and in particular look at a post about "curing system".

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #2 on Sun 06 Jan 2008 04:00 AM (UTC)
Message
In brief, to answer your specific question, if you make a table with the items keyed numerically, then they will always be in that order. For example:



afflictions = {
        "sleep",
        "aeon",
        "anorexia",
        "addiction",
}

for k, v in ipairs (afflictions) do
  print (k, v)
end        

Output
1 sleep
2 aeon
3 anorexia
4 addiction


- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #3 on Sun 06 Jan 2008 04:13 AM (UTC)
Message
Also see: http://www.gammon.com.au/forum/?id=6036

This discusses Lua tables in some detail.

- Nick Gammon

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

Posted by Shadoweave   (42 posts)  Bio
Date Reply #4 on Sun 06 Jan 2008 11:20 PM (UTC)

Amended on Tue 08 Jan 2008 03:06 PM (UTC) by Shadoweave

Message
Hm... some advice about Lusternia systems.
Make different databases for each balance the affliction uses. If you have herb balance, you can check your herb database for addiction (cured by eating galingale). Or your focus queue, if can also be cured by focusing mind, but keep in mind that focus mind costs 175 mana. If you have purgative balance, check for aeon. Or you can do that in a herb balance check, but commands in aeon are delayed by 1.1 seconds, and you need to get reishi out of the rift, and then eat it, and that will take too much time. Anorexia can also be cured by either focus mind, or by smoking coltsfoot, so include that in both your focus database and herb database.
As for sleep, that will have to go in a general affliction database, since waking up requires no balance to do. You could also include in that database fear, composing requires no balance, but keep in mind that you need to be awake to compose, so sleep has to be before fear.
Stun prevents you from doing anything, that is cured in a few seconds, depending on your size, so while you are stunned it's best not to check for any cures.
I hope this helps!

EDIT: aeon delays actions by 1 second. My bad.
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.


17,803 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.