New Quest functions?
Posted: Fri Jul 02, 2010 6:02 pm
Id like to add my quest function to the in-game-functions. I wasn't too satisfied with the way it worked originally but recently (about a patch or 2 back), I discovered a new command that gives you the status of the quests. I've since rewrote it and am quite happy with it.
I'd then add some functions to function.lua that would simplify using it, like so.
Any objections?
Code: Select all
-- questname = name of quest
-- returns 'true' if quest complete 'false' if not and nil if not accepted
function igf_questStatus(_questname)
local lowername=string.gsub(string.lower(_questname),"'","")
local c = 1
local getname = GetQuestRequest(c,-2)
while getname ~= nil do
getname=string.gsub(getname,"'","")
if string.find(string.lower(getname), lowername) then -- Quest exists
for i = 1, GetQuestRequest(c,-1) do -- for each goal
__,getstatus = GetQuestRequest(c,i)
if getstatus == 0 then -- check if not complete
return false
end
end
return true
end
c = c + 1
getname = GetQuestRequest(c,-2)
end
return
endCode: Select all
function isQuestComplete(_questname)
-- Do I need to turn in my quest?
if (bot.IgfAddon == false) then
error(language[1004], 0) -- Ingamefunctions addon (igf) is not installed
end
local queststate = RoMScript("igf_questStatus(\"".._questname.."\")")
if queststate == true then
return true
else
return false
end
end
function isQuestAccepted(_questname)
-- Do I need to go an get the quest?
if (bot.IgfAddon == false) then
error(language[1004], 0) -- Ingamefunctions addon (igf) is not installed
end
local queststate = RoMScript("igf_questStatus(\"".._questname.."\")")
if (queststate == true) or (queststate == false) then
return true
else
return false
end
end
function getQuestStatus(_questname)
-- Used when you need to make 3 way decision, get quest, complete quest or gather quest items.
if (bot.IgfAddon == false) then
error(language[1004], 0) -- Ingamefunctions addon (igf) is not installed
end
return RoMScript("igf_questStatus(\"".._questname.."\")")
end