Priority Database

Posted by Sredmon on Sun 06 Jan 2008 02:05 AM — 5 posts, 22,805 views.

#0
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.
Australia Forum Administrator #1
Try searching this forum for "Lusternia" and in particular look at a post about "curing system".
Australia Forum Administrator #2
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

Australia Forum Administrator #3
Also see: http://www.gammon.com.au/forum/?id=6036

This discusses Lua tables in some detail.
#4
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.