Alright I just tested it out fully. It is all working smoothly except for one tiny bit of a problem. The first skill is completed fully and then it completes all the other skills -if- I type in to research the second skill manually once the first one is completed. Otherwise I get this error;
Mud tells me: You can't learn any more about that from books!
My script triggering is:
if researching then
if research.percent >= 80 then
nextSkill()
cecho("\n<yellow>Percent is higher than 80.")
else
cecho("\n<red>Something is wrong here.. You are below 80 percent?")
end
end
Now I don't understand why but it only happens on the first skill. If I manually type research for second skill, it goes all the way up and researches every other skill fully.
Capture Table - Flawed
Re: Capture Table - Flawed
My guess is you are starting your first bit of research without the nextSkill function, which leaves the first skill in the list of skills to work on. So, either switch to using nextSkill for the first time, or remove the first item of the researchthese table.
Re: Capture Table - Flawed
I just checked the research.skill and research.percent values. They came out as tail (the first skill) and 0. I think it resets the research.percent value to the next or some such?
Currently I still run the script with msnow and then tr on.
Msnow does the moveskills function which adds them to the table.
Tr on does...
if matches[2] == "on" then
research = {}
research.skill = researchthese[1]
research.percent = tonumber(mySkills[researchthese[1]])
researching = true
send("research "..research.skill)
cecho("\n<green>Research Mode - Enabled")
elseif matches[2] == "off" then
researching = false
cecho("\n<red>Research Mode - Disabled")
end
Currently I still run the script with msnow and then tr on.
Msnow does the moveskills function which adds them to the table.
Tr on does...
if matches[2] == "on" then
research = {}
research.skill = researchthese[1]
research.percent = tonumber(mySkills[researchthese[1]])
researching = true
send("research "..research.skill)
cecho("\n<green>Research Mode - Enabled")
elseif matches[2] == "off" then
researching = false
cecho("\n<red>Research Mode - Disabled")
end
Re: Capture Table - Flawed
So, the problem is that your "tr" alias isn't removing the first entry from the researchthese table, unlike what would happen if it was using the nextSkill function. This is important because nextSkill gets the first entry and then removes it, rather than the other way around (which would give it the second entry from just before it was called, rather than the first, which is what it currently gets). And since the research percent isn't updated in your mySkills table, when it tries to research the second skill, it goes back to the first one, with the original percentage, rather than the new one (presumably more than 80 percent).
All you need to do is make your "tr" alias remove the first entry in the researchthese table, and it should be good to go.
All you need to do is make your "tr" alias remove the first entry in the researchthese table, and it should be good to go.
Re: Capture Table - Flawed
So like this? Asteriksed area is the addition:
if matches[2] == "on" then
research = {}
research.skill = researchthese[1]
research.percent = tonumber(mySkills[researchthese[1]])
researching = true
***research.skill = table.remove(researchthese,1)***
send("research "..research.skill)
cecho("\n<green>Research Mode - Enabled")
elseif matches[2] == "off" then
researching = false
cecho("\n<red>Research Mode - Disabled")
end
if matches[2] == "on" then
research = {}
research.skill = researchthese[1]
research.percent = tonumber(mySkills[researchthese[1]])
researching = true
***research.skill = table.remove(researchthese,1)***
send("research "..research.skill)
cecho("\n<green>Research Mode - Enabled")
elseif matches[2] == "off" then
researching = false
cecho("\n<red>Research Mode - Disabled")
end
Re: Capture Table - Flawed
That would work. Or you could just use that as line 3, and change line 4 to use research.skill instead of researchthese[1]
Re: Capture Table - Flawed
Alright I changed it to what I wrote up above and everything is working fine now. Thank you very much for all of your assistance Jor'Mox I solved all of my problems.