Curing Remaining Affliction via List

Post Reply
User avatar
Jules
Posts: 118
Joined: Sun Oct 11, 2009 5:41 pm
Location: Plymouth State University - Sophomore

Curing Remaining Affliction via List

Post by Jules »

Hello again, everyone. My Lusternia Curing System is coming along AMAZINGLY! It's actually almost done! WOOT! I just have a few more Triggers to place in, and to define what the Nil I should do with certain afflictions within the special "curing queue" lists.

Anywho, onto my question. Within the queue lists, certain afflictions are defined, and if their value is "true", the proper curing commands are run. Because Lusternia sees fit to have SO MANY DAMNED AFFLICTIONS, one option is to define ALL of them in the set order that i want them cured. This will take far too much time for my liking. So, what I want to do is define only the ones that are absolutely necessary for my survival, then have the rest automatically cured if their values set within the list are equal to true. Here's what I'm thinking of.

Note: Assume all of the "necessary" afflictions are cured.

Code: Select all

for affl,bool in pairs(herbQueue) do
       if bool == "true" then
              expandAlias("proper_cure")
       end
end
Does that work at all?

johndahlstrom
Posts: 9
Joined: Tue Aug 11, 2009 8:45 am
Location: Sweden

Re: Curing Remaining Affliction via List

Post by johndahlstrom »

This simple example will show you how to make that IRE system:

Code: Select all

for _,v in pairs(affData) do
	if currentAffs[v.name] and balance then
		send(v.cure)
		balance = false
	end
end

affData = {

{name = "paralysis", cure = "eat something"},
{name = "asthma", cure = "eat something else"},

}
First you have a loop that will go through every line in the affData table. You check if you have that affliction on you with the "currentAffs[v.name]" and then see if you have your balance. If you have both of those, you send out the cure that was defined in the affData table for this affliction and then set the balance to false. And with this sort of table and built, you will always do the top thing first, meaning you got yourself a priority list in this as well.

The only thing you need to do if you go with this built is that you on every affliction trigger do the following:
currentAffs["afflictionname"] = true

and on cures you do:
currentAffs["afflictionname"] = false


Hope that will help you and all other IRE system builders that's starting out ;)

User avatar
Jules
Posts: 118
Joined: Sun Oct 11, 2009 5:41 pm
Location: Plymouth State University - Sophomore

Re: Curing Remaining Affliction via List

Post by Jules »

So I decided to rework my system into something like this since the coding here will be much cleaner and easier to follow/add to in the future. I have 4 queues running whenever I regain balance/equilibrium, along with whenever an affliction occurs. I'm currently having trouble, though, with one of them, because it's saying that there is a "nil" value. Here's some screenshots:

http://i991.photobucket.com/albums/af40 ... rigger.jpg
This is the actual Trigger being fired in Lusternia.

http://i991.photobucket.com/albums/af40 ... Script.jpg
This is what the script looks like for everyone.

http://i991.photobucket.com/albums/af40 ... eError.jpg
And here's the error message that I get!

I'm not really sure exactly what it means, because it SHOULD be defined when the trigger is fired... Any help?

sephiel
Posts: 17
Joined: Mon Nov 30, 2009 10:35 am

Re: Curing Remaining Affliction via List

Post by sephiel »

Looks to me like currentBalAffs simply hasn't been defined yet. Maybe check the script mentions currentBalAffs={ } at some point? You should also work this into a reset function, for clearing your afflictions when you get killed.

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Curing Remaining Affliction via List

Post by Vadi »

It doesn't get defined when your trigger runs, at least not in that one. Like sephiel said you want to currentBalAffs={} somewhere at the beginning so the table isn't nil :)

User avatar
Jules
Posts: 118
Joined: Sun Oct 11, 2009 5:41 pm
Location: Plymouth State University - Sophomore

Re: Curing Remaining Affliction via List

Post by Jules »

I saw what I was doing and what was wrong. My initialization alias wasn't updated as I thought it was, but after fixing it, and rewriting a few things, it's all fixed! Now to fix my prompt...

Post Reply