Page 1 of 1
need help trying to complete quest
Posted: Wed Oct 17, 2012 10:12 pm
by abron1
Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
-- Change Profile Option
YourTargetScore = 6000
__WPL:setForcedWaypointType("RUN")
questName1 = "Killer in the Midst"
function waitForEventStart()
repeat
yrest(1000) -- check every second
local namePE,messagePE,namePH,ScorePE,Count , IsScoreVisible= RoMScript("PE_GetInfo(1)")
if (ScorePE == nil) then
printf("Score is nil, oh no!")
__WPL:setWaypointIndex(__WPL:findWaypointTag("timer"));
return
end
if Count == 2 and YourTargetScore > ScorePE then break end
until false
end
if oldOnLeaveCombat == nil then oldOnLeaveCombat = settings.profile.events.onLeaveCombat end
function settings.profile.events.onLeaveCombat()
oldOnLeaveCombat()
local namePE,messagePE,namePH,ScorePE,Count , IsScoreVisible= RoMScript("PE_GetInfo(1)")
if Count ~= 2 or ScorePE >= YourTargetScore then
__WPL:setForcedWaypointType("RUN")
__WPL:setWaypointIndex(__WPL:findWaypointTag("start"));
end
end
function isEventFinished()
local namePE,messagePE,namePH,ScorePE,Count , IsScoreVisible= RoMScript("PE_GetInfo(1)")
return (Count ~= 2 or ScorePE >= YourTargetScore);
end;
</onLoad>
<!-- # 1 --><waypoint x="-4449" z="-13713" y="350" tag= "Home Base">
waitForEventStart()
</waypoint>
<!-- # 2 --><waypoint x="-4487" z="-13760" y="350" tag= "start">
queststate = getQuestStatus(questName1);
if queststate == "complete" then
player:target_NPC("Antty");
CompleteQuestByName(questName1);
yrest(300);
__WPL:setWaypointIndex(__WPL:findWaypointTag("start"));
else
player:target_NPC("Antty");
AcceptQuestByName(questName1,questEndNpcID1);
yrest(300);
if (isEventFinished()) then
__WPL:setWaypointIndex(__WPL:findWaypointTag("Home Base"));
end
end;
</waypoint>
<!-- # 3 --><waypoint x="-4415" z="-13900" y="357"> </waypoint>
<!-- # 4 --><waypoint x="-4518" z="-13944" y="356"> player:target_NPC("Telery Haz");
ChoiceOptionByName("Ask about the Garon Myrmex Egg")
yrest(200);
ChoiceOptionByName("Ask about the Garon Myrmex Egg")
yrest(200);
if inventory:itemTotalCount("Garon Myrmex Egg") > 0 then
__WPL:setWaypointIndex(__WPL:findWaypointTag("Telery"))
end
</waypoint>
<!-- # 5 --><waypoint x="-4394" z="-13979" y="360"> </waypoint>
<!-- # 6 --><waypoint x="-4297" z="-14061" y="366"> </waypoint>
<!-- # 7 --><waypoint x="-4305" z="-14149" y="386"> </waypoint>
<!-- # 8 --><waypoint x="-4767" z="-14650" y="548"> </waypoint>
<!-- # 9 --><waypoint x="-4917" z="-14829" y="551"> </waypoint>
<!-- # 10 --><waypoint x="-4874" z="-15056" y="542"> player:target_NPC("Folj May");
ChoiceOptionByName("Ask about the Garon Myrmex Egg")
yrest(200);
ChoiceOptionByName("Ask about the Garon Myrmex Egg")
yrest(200);
if inventory:itemTotalCount("Garon Myrmex Egg") > 0 then
__WPL:setWaypointIndex(__WPL:findWaypointTag("Folj"))
end
</waypoint>
<!-- # 11 --><waypoint x="-5010" z="-15043" y="542"> </waypoint>
<!-- # 12 --><waypoint x="-5275" z="-15161" y="570"> </waypoint>
<!-- # 13 --><waypoint x="-5504" z="-15248" y="608"> player:target_NPC("Navok Keff");
ChoiceOptionByName("Ask about the Garon Myrmex Egg")
yrest(200);
ChoiceOptionByName("Ask about the Garon Myrmex Egg")
yrest(200);
</waypoint>
<!-- # 14 --><waypoint x="-5162" z="-15085" y="555"> </waypoint>
<!-- # 15 --><waypoint x="-4974" z="-14953" y="548"> </waypoint>
<!-- # 16 --><waypoint x="-4767" z="-14626" y="553" tag= "Folj"> </waypoint>
<!-- # 17 --><waypoint x="-4293" z="-14125" y="377" tag= "Telery"> </waypoint>
<!-- # 18 --><waypoint x="-4487" z="-13764" y="349">
if (isEventFinished()) then
__WPL:setWaypointIndex(__WPL:findWaypointTag("Home Base"));
end
queststate = getQuestStatus(questName1);
if queststate == "complete" then
player:target_NPC("Antty");
CompleteQuestByName(questName1);
yrest(300);
__WPL:setWaypointIndex(__WPL:findWaypointTag("start"));
else
player:target_NPC("Antty");
ChoiceOptionByName("Give the Garon Myrmex Egg to Antty")
yrest(200);
player:target_NPC("Antty");
CompleteQuestByName(questName1);
yrest(300);
__WPL:setWaypointIndex(__WPL:findWaypointTag("start"));
end
</waypoint>
<!-- # 1 --><waypoint x="-4451" z="-13716" y="350" tag= "timer"> </waypoint>
<!-- # 2 --><waypoint x="-4387" z="-13925" y="356"> </waypoint>
<!-- # 3 --><waypoint x="-4284" z="-14103" y="373"> </waypoint>
<!-- # 4 --><waypoint x="-4794" z="-14667" y="548"> </waypoint>
<!-- # 5 --><waypoint x="-5162" z="-15099" y="556"> </waypoint>
<!-- # 6 --><waypoint x="-5509" z="-15231" y="607"> </waypoint>
<!-- # 7 --><waypoint x="-5221" z="-15105" y="563"> </waypoint>
<!-- # 8 --><waypoint x="-4992" z="-14991" y="545"> </waypoint>
<!-- # 9 --><waypoint x="-4625" z="-14469" y="591"> </waypoint>
<!-- # 10 --><waypoint x="-4254" z="-14095" y="371"> </waypoint>
<!-- # 11 --><waypoint x="-4481" z="-13765" y="347">
__WPL:setWaypointIndex(__WPL:findWaypointTag("start"));
</waypoint>
</waypoints>
edit updated: working script (i know its not the cleanest coding but it works lol)..
thanks to lisa, rock5, and Jandrana for your help.....
Re: need help trying to complete quest
Posted: Wed Oct 17, 2012 11:28 pm
by lisa
did you try
example, if the choice option says
"Give me the stuff"
you could do
or
or
Re: need help trying to complete quest
Posted: Wed Oct 17, 2012 11:36 pm
by abron1
thanks lisa ill try that
ok that worked for the first part of the code but if the quest is already taken it gives me a error to start or when i go to turn in the quest
Did not find any crashed game clients.
11:34pm - scripts\rom/bot.lua:824: Failed to compile and run Lua code for waypoint #1
Code: Select all
<!-- # 1 --><waypoint x="-4487" z="-13760" y="350" tag= "start"> player:target_NPC("Antty");
AcceptQuestByName("Killer in the Midst")
</waypoint>
Code: Select all
<!-- # 17 --><waypoint x="-4487" z="-13764" y="349">
player:target_NPC("Antty");
yrest(200);
ChoiceOptionByName("Give the Garon Myrmex Egg to Antty")
yrest(200);
player:target_NPC("Antty");
CompleteQuestByName(Killer in the Midst)
__WPL:setWaypointIndex(__WPL:findWaypointTag("start"))
end
</waypoint>
Re: need help trying to complete quest
Posted: Thu Oct 18, 2012 2:54 am
by Jandrana
You could check the quest state and do something meaningful dependent on the quest state:
Code: Select all
local queststate = getQuestStatus("questName");
if queststate == "not accepted" then
--
end
if queststate == "complete" then
--
end
if queststate == "incomplete" then
--
end
You should double quote the argument for
CompleteQuestByName(Killer in the Midst)
Re: need help trying to complete quest
Posted: Thu Oct 18, 2012 3:15 am
by lisa
yup
Code: Select all
CompleteQuestByName(Killer in the Midst)
needs to be
Code: Select all
CompleteQuestByName("Killer in the Midst")
Re: need help trying to complete quest
Posted: Thu Oct 18, 2012 7:12 am
by abron1
sorry for my noobness but this is my first script doing quest and i still get the same error after the changes
Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
-- Change Profile Option
__WPL:setForcedWaypointType("RUN")
</onLoad>
<!-- # 1 --><waypoint x="-4487" z="-13760" y="350" tag= "start"> player:target_NPC("Antty");
AcceptQuestByName("Killer in the Midst")
</waypoint>
<!-- # 2 --><waypoint x="-4415" z="-13900" y="357"> </waypoint>
<!-- # 3 --><waypoint x="-4518" z="-13944" y="356"> player:target_NPC("Telery Haz");
yrest(200);
ChoiceOptionByName("Ask about the Garon Myrmex Egg")
yrest(200);
ChoiceOptionByName("Ask about the Garon Myrmex Egg")
yrest(200);
if inventory:itemTotalCount("Garon Myrmex Egg") > 0 then
__WPL:setWaypointIndex(__WPL:findWaypointTag("Telery"))
end
</waypoint>
<!-- # 4 --><waypoint x="-4394" z="-13979" y="360"> </waypoint>
<!-- # 5 --><waypoint x="-4297" z="-14061" y="366"> </waypoint>
<!-- # 6 --><waypoint x="-4305" z="-14149" y="386"> </waypoint>
<!-- # 7 --><waypoint x="-4767" z="-14650" y="548"> </waypoint>
<!-- # 8 --><waypoint x="-4917" z="-14829" y="551"> </waypoint>
<!-- # 9 --><waypoint x="-4874" z="-15056" y="542"> player:target_NPC("Folj May"); yrest(200);
ChoiceOptionByName("Ask about the Garon Myrmex Egg")
yrest(200);
ChoiceOptionByName("Ask about the Garon Myrmex Egg")
yrest(200);
if inventory:itemTotalCount("Garon Myrmex Egg") > 0 then
__WPL:setWaypointIndex(__WPL:findWaypointTag("Folj"))
end
</waypoint>
<!-- # 10 --><waypoint x="-5010" z="-15043" y="542"> </waypoint>
<!-- # 11 --><waypoint x="-5275" z="-15161" y="570"> </waypoint>
<!-- # 12 --><waypoint x="-5504" z="-15248" y="608"> player:target_NPC("Navok Keff");
yrest(200);
ChoiceOptionByName("Ask about the Garon Myrmex Egg")
yrest(200);
ChoiceOptionByName("Ask about the Garon Myrmex Egg")
yrest(200);
</waypoint>
<!-- # 13 --><waypoint x="-5162" z="-15085" y="555"> </waypoint>
<!-- # 14 --><waypoint x="-4974" z="-14953" y="548"> </waypoint>
<!-- # 15 --><waypoint x="-4767" z="-14626" y="553" tag= "Folj"> </waypoint>
<!-- # 16 --><waypoint x="-4293" z="-14125" y="377" tag= "Telery"> __WPL:setWaypointIndex(17) </waypoint>
<!-- # 17 --><waypoint x="-4487" z="-13764" y="349">
player:target_NPC("Antty");
yrest(200);
ChoiceOptionByName("Give the Garon Myrmex Egg to Antty")
yrest(200);
player:target_NPC("Antty");
CompleteQuestByName("Killer in the Midst")
__WPL:setWaypointIndex(__WPL:findWaypointTag("start"))
end
</waypoint>
</waypoints>
and not sure how to add the quest state that Jandrana sujested
Re: need help trying to complete quest
Posted: Thu Oct 18, 2012 9:40 am
by Jandrana
ok that worked for the first part of the code but if the quest is already taken it gives me a error to start or when i go to turn in the quest
Perhaps you can add some checks in your onLoad section.
If the quest is already accepted, abandon the quest before the waypoints are being processed (function: CancelQuest).
Maybe skip the AcceptQuestByName if the quest is already accepted.
I don't know what errors are happening if the quest is already accepted, so I cannot give more advice how to avoid these errors.
Re: need help trying to complete quest
Posted: Thu Oct 18, 2012 1:26 pm
by abron1
ok got it to work its ugly coding but its working now
Code: Select all
<onLoad>
-- Change Profile Option
__WPL:setForcedWaypointType("RUN")
questName1 = "Killer in the Midst"
</onLoad>
Code: Select all
<!-- # 1 --><waypoint x="-4487" z="-13760" y="350" tag= "start">
queststate = getQuestStatus(questName1);
if queststate == "complete" then
player:target_NPC("Antty");
CompleteQuestByName(questName1);
yrest(300);
__WPL:setWaypointIndex(__WPL:findWaypointTag("start"));
else
player:target_NPC("Antty");
AcceptQuestByName(questName1,questEndNpcID1);
yrest(300);
end
</waypoint>
Code: Select all
<!-- # 17 --><waypoint x="-4487" z="-13764" y="349">
queststate = getQuestStatus(questName1);
if queststate == "complete" then
player:target_NPC("Antty");
CompleteQuestByName(questName1);
yrest(300);
__WPL:setWaypointIndex(__WPL:findWaypointTag("start"));
else
player:target_NPC("Antty");
yrest(200);
ChoiceOptionByName("Give the Garon Myrmex Egg to Antty")
yrest(200);
player:target_NPC("Antty");
AcceptQuestByName(questName1,questEndNpcID1);
yrest(300);
end
</waypoint>
got this from another script and added what i needed. thanks to all for your help
Re: need help trying to complete quest
Posted: Thu Oct 18, 2012 1:48 pm
by rock5
Here is a little info about the QuestByName functions. Once the npc is targeted you don't need to target it again. And you don't need yrests. I'd still add a yrest after ChoiceOptionByName though.
Re: need help trying to complete quest
Posted: Thu Oct 18, 2012 6:40 pm
by abron1
ah thanks only reason i target this npc again is because it won't complete the quest unless you do the option first then you have to target npc again to complete the quest this is my first script dealing with quest... i have added the timer to it now but i need to figure out what to do if the event timer dissaper its slowly coming along ill try to clean it up in the hopes i don't break it lol
Code: Select all
<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
-- Change Profile Option
YourTargetScore = 6000
__WPL:setForcedWaypointType("RUN")
questName1 = "Killer in the Midst"
function waitForEventStart()
repeat
yrest(1000) -- check every second
local namePE,messagePE,namePH,ScorePE,Count , IsScoreVisible= RoMScript("PE_GetInfo(1)")
if (ScorePE == nil) then
printf("Score is nil, oh no!") then
__WPL:setWaypointIndex(__WPL:findWaypointTag("timer")); end
if Count == 2 and YourTargetScore > ScorePE then break end
until false
end
if oldOnLeaveCombat == nil then oldOnLeaveCombat = settings.profile.events.onLeaveCombat end
function settings.profile.events.onLeaveCombat()
oldOnLeaveCombat()
local namePE,messagePE,namePH,ScorePE,Count , IsScoreVisible= RoMScript("PE_GetInfo(1)")
if Count ~= 2 or ScorePE >= YourTargetScore then
__WPL:setForcedWaypointType("RUN")
__WPL:setWaypointIndex(__WPL:findWaypointTag("start"));
end
end
function isEventFinished()
local namePE,messagePE,namePH,ScorePE,Count , IsScoreVisible= RoMScript("PE_GetInfo(1)")
return (Count ~= 2 or ScorePE >= YourTargetScore);
end;
</onLoad>
<!-- # 1 --><waypoint x="-4449" z="-13713" y="350" tag= "Home Base">
waitForEventStart()
</waypoint>
<!-- # 1 --><waypoint x="-4487" z="-13760" y="350" tag= "start">
queststate = getQuestStatus(questName1);
if queststate == "complete" then
player:target_NPC("Antty");
CompleteQuestByName(questName1);
yrest(300);
__WPL:setWaypointIndex(__WPL:findWaypointTag("start"));
else
player:target_NPC("Antty");
AcceptQuestByName(questName1,questEndNpcID1);
yrest(300);
if (isEventFinished()) then
__WPL:setWaypointIndex(__WPL:findWaypointTag("Home Base"));
end
end;
</waypoint>
<!-- # 2 --><waypoint x="-4415" z="-13900" y="357"> </waypoint>
<!-- # 3 --><waypoint x="-4518" z="-13944" y="356"> player:target_NPC("Telery Haz");
yrest(200);
ChoiceOptionByName("Ask about the Garon Myrmex Egg")
yrest(200);
ChoiceOptionByName("Ask about the Garon Myrmex Egg")
yrest(200);
if inventory:itemTotalCount("Garon Myrmex Egg") > 0 then
__WPL:setWaypointIndex(__WPL:findWaypointTag("Telery"))
end
</waypoint>
<!-- # 4 --><waypoint x="-4394" z="-13979" y="360"> </waypoint>
<!-- # 5 --><waypoint x="-4297" z="-14061" y="366"> </waypoint>
<!-- # 6 --><waypoint x="-4305" z="-14149" y="386"> </waypoint>
<!-- # 7 --><waypoint x="-4767" z="-14650" y="548"> </waypoint>
<!-- # 8 --><waypoint x="-4917" z="-14829" y="551"> </waypoint>
<!-- # 9 --><waypoint x="-4874" z="-15056" y="542"> player:target_NPC("Folj May"); yrest(200);
ChoiceOptionByName("Ask about the Garon Myrmex Egg")
yrest(200);
ChoiceOptionByName("Ask about the Garon Myrmex Egg")
yrest(200);
if inventory:itemTotalCount("Garon Myrmex Egg") > 0 then
__WPL:setWaypointIndex(__WPL:findWaypointTag("Folj"))
end
</waypoint>
<!-- # 10 --><waypoint x="-5010" z="-15043" y="542"> </waypoint>
<!-- # 11 --><waypoint x="-5275" z="-15161" y="570"> </waypoint>
<!-- # 12 --><waypoint x="-5504" z="-15248" y="608"> player:target_NPC("Navok Keff");
yrest(200);
ChoiceOptionByName("Ask about the Garon Myrmex Egg")
yrest(200);
ChoiceOptionByName("Ask about the Garon Myrmex Egg")
yrest(200);
</waypoint>
<!-- # 13 --><waypoint x="-5162" z="-15085" y="555"> </waypoint>
<!-- # 14 --><waypoint x="-4974" z="-14953" y="548"> </waypoint>
<!-- # 15 --><waypoint x="-4767" z="-14626" y="553" tag= "Folj"> </waypoint>
<!-- # 16 --><waypoint x="-4293" z="-14125" y="377" tag= "Telery"> </waypoint>
<!-- # 17 --><waypoint x="-4487" z="-13764" y="349">
queststate = getQuestStatus(questName1);
if queststate == "complete" then
player:target_NPC("Antty");
CompleteQuestByName(questName1);
yrest(300);
__WPL:setWaypointIndex(__WPL:findWaypointTag("start"));
else
player:target_NPC("Antty");
yrest(200);
ChoiceOptionByName("Give the Garon Myrmex Egg to Antty")
yrest(200);
player:target_NPC("Antty");
CompleteQuestByName(questName1);
yrest(300);
__WPL:setWaypointIndex(__WPL:findWaypointTag("start"));
end
</waypoint>
<!-- # 1 --><waypoint x="-4451" z="-13716" y="350" tag= "timer"> </waypoint>
<!-- # 2 --><waypoint x="-4387" z="-13925" y="356"> </waypoint>
<!-- # 3 --><waypoint x="-4284" z="-14103" y="373"> </waypoint>
<!-- # 4 --><waypoint x="-4794" z="-14667" y="548"> </waypoint>
<!-- # 5 --><waypoint x="-5162" z="-15099" y="556"> </waypoint>
<!-- # 6 --><waypoint x="-5509" z="-15231" y="607"> </waypoint>
<!-- # 7 --><waypoint x="-5221" z="-15105" y="563"> </waypoint>
<!-- # 8 --><waypoint x="-4992" z="-14991" y="545"> </waypoint>
<!-- # 9 --><waypoint x="-4625" z="-14469" y="591"> </waypoint>
<!-- # 10 --><waypoint x="-4254" z="-14095" y="371"> </waypoint>
<!-- # 11 --><waypoint x="-4481" z="-13765" y="347">
__WPL:setWaypointIndex(__WPL:findWaypointTag("start"));
</waypoint>
</waypoints>
ok now i got the timer working and everything but like 2 mins before the event starts the timer dissappers i tried to use the code
Code: Select all
if (ScorePE == nil) then
printf("Score is nil, oh no!");
__WPL:setWaypointIndex(__WPL:findWaypointTag("timer"));
end
but it never goes to the timer waypoint and it just spams
and stays in loop...I want if the timer is gone go to that waypoint and come back because the timer will apper and i can keep going with the script
Re: need help trying to complete quest
Posted: Thu Oct 18, 2012 11:42 pm
by rock5
abron1 wrote:it won't complete the quest unless you do the option first then you have to target npc again to complete the quest
Yes, and that's ok. It only wastes a little time to target the npc again. But AcceptQuestByName and CompleteQuestByName don't require the npc dialog to be open, only that the npc be targeted, which it already is. In fact those functions always start with retargeting the npc anyway to get a fresh dialog because of a known bug.
abron1 wrote:but it never goes to the timer waypoint and it just spams
and stays in loop
"__WPL:setWaypointIndex" doesn't immediately go to that waypoint. All it does is
set the next waypoint. The current waypoint code still has to finish. When the current waypoint code finishes, then it will go to that waypoint. I'm not sure which loop you put that in but to exit a loop you would use "break". Try adding that. Just be aware that any code after that loop will still execute. Actually, if you want to completely exit the waypoint you can also use "return" because the waypoint code is executed as a function.
Re: need help trying to complete quest
Posted: Fri Oct 19, 2012 1:53 am
by abron1
ok rock i have that code in the onload wait for event function i tried to use "break" got a error
Code: Select all
function waitForEventStart()
repeat
yrest(1000) -- check every second
local namePE,messagePE,namePH,ScorePE,Count , IsScoreVisible= RoMScript("PE_GetInfo(1)")
if (ScorePE == nil) then
printf("Score is nil, oh no!") return
__WPL:setWaypointIndex(__WPL:findWaypointTag("timer")); end
if Count == 2 and YourTargetScore > ScorePE then break end
until false
end
i used "return" and no errors so we will see what happens when the timer disappers. And a weird thing that is happing is when i use another character to run the same code for some reason it won't finish the requirements to complete the quest and just skip over it.. i think it could be lag but not sure i get "need to open dialog before using ChoiceOptionByName...but it works fine on my other character and i put in longer yest but it still skips it...
Re: need help trying to complete quest
Posted: Fri Oct 19, 2012 3:27 am
by rock5
That looks like the wrong place. If I understand correctly what you want is, if ScorePE == nil then you want it to print "Score is nil, oh no!", set the next waypoint to "timer" then exit the function. You put the "return" before the "setWaypointIndex" command so it wont execute. The "return" should be after setting the waypoint.
Code: Select all
function waitForEventStart()
repeat
yrest(1000) -- check every second
local namePE,messagePE,namePH,ScorePE,Count , IsScoreVisible= RoMScript("PE_GetInfo(1)")
if (ScorePE == nil) then
printf("Score is nil, oh no!")
__WPL:setWaypointIndex(__WPL:findWaypointTag("timer"));
return
end
if Count == 2 and YourTargetScore > ScorePE then break end
until false
end
abron1 wrote:And a weird thing that is happing is when i use another character to run the same code for some reason it won't finish the requirements to complete the quest and just skip over it.
Do you restart the waypoint after loading the new character? If you do then I'd say it's not a problem with the script but more likely with the game. If you suspect a lag issue then try restarting the game when changing character and see if that help.
Re: need help trying to complete quest
Posted: Fri Oct 19, 2012 1:24 pm
by abron1
ok rock that worked like a charm and each time the timer disappers it run that short route to get the timer back and either wait for the event to start or start the event... thanks so much to all that chipped in. now i will try to make it farm mobs until the event start so i am not just standing in one spot for 15 mins
edit updated the script in my first post with most of the changes
Re: need help trying to complete quest
Posted: Sat Oct 20, 2012 11:25 pm
by abron1
i have to warden/scouts running that script fine...but when i run my warden/warrior with the same route it won't do the second choice option to get the item you need to complete the quest. not sure why but it will do the first option but not the second. is there a way to debug it or some code i can use to see why its not working for that character only?