<!-- # 11 --><waypoint x="5534" z="-4432" tag ='main'>
player:target_NPC("Lehman");
local questCompleted = RoMScript("CheckQuest(421457);");
if questCompleted == 0
then -- does AT quest
player:target_NPC("Lehman");
sendMacro("OnClick_QuestListButton(1,1)");
yrest(1000);
sendMacro("OnClick_QuestListButton(1,1)");
yrest(1000);
__WPL:setWaypointIndex(__WPL:findWaypointTag("main")); -- PROBLEM 2
else -- buys charges
player:merchant("Lehman");
yrest(500);
sendMacro("ChoiceOption(1);");
yrest(500);
while (inventory:itemTotalCount(203038) >= 30) -- PROBLEM 1
do
sendMacro("StoreBuyItem(1)");
yrest(1000);
end;
sendMacro("CloseWindows();");
while (inventory:itemTotalCount(203487) > 0) -- uses charges
do
inventory:useItem(203487);
end;
write_tokens();
end;
RoMScript("UseSkill(1,2);"); -- Port to Elven island
player:rest(30);
loadPaths("back");
</waypoint>
Hi there
i got some problems with above posted code:
1. The first "while-loop" won't end, i have a character with 1000 tokens, he ran to Lehman an bought 33 charges for AT he had 10 tokens left an still wanted to buy more charges
2. if he finishes the AT quest, he directly ports back to elven-island, instead of repeating the waypoint, starting with the quest-check.
I experienced some problems with >= so i always use only the >
There is no problem with >=. There is no difference between >=30 and >29 when dealing with integers.
runensammler wrote:ad Problem 2
I think its because the bot finishes the waypoint and then goes to the indexed one
No, the code for the waypoint will be completed.
Personalausweis,
First problem is most likely because you are not updating the inventory so the bot thinks he still has 1000.
Second problem is because setWaypointIndex only sets the next waypoint. It won't move to that waypoint until it has finished the code for this waypoint. If you don't want it to teleport if it is completing the quest then just move the teleport to the 'else' section of the 'if' statement. Also you can use the new function waitForLoadingScreen() instead of the player:rest(30) command. It will return control as soon as the teleport completes.
<!-- # 11 --><waypoint x="5534" z="-4432" tag ='main'>
player:target_NPC("Lehman");
local questCompleted = RoMScript("CheckQuest(421457);");
if questCompleted == 0 then -- does AT quest
player:target_NPC("Lehman");
sendMacro("OnClick_QuestListButton(1,1)");
yrest(1000);
sendMacro("OnClick_QuestListButton(1,1)");
yrest(1000);
__WPL:setWaypointIndex(__WPL:findWaypointTag("main")); -- PROBLEM 2
else -- buys charges
player:merchant("Lehman");
yrest(500);
sendMacro("ChoiceOption(1);");
yrest(500);
while (inventory:itemTotalCount(203038) >= 30) do
sendMacro("StoreBuyItem(1)");
yrest(1000);
inventory:update()
end;
sendMacro("CloseWindows();");
while (inventory:itemTotalCount(203487) > 0) do -- uses charges
inventory:useItem(203487);
end;
write_tokens();
RoMScript("UseSkill(1,2);"); -- Port to Elven island
waitForLoadingScreen();
loadPaths("back");
end;
</waypoint>
Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
will test the "inventory:update();" and loadingscreen-thing today.
about the second problem i thought ab bit that night, if all characters (atm 64) are lvl 10, whitch will be today, i could erase the if part which asks for the AT quest.
than i could replace it with:
player:merchant("Lehman");
yrest(500);
sendMacro("ChoiceOption(1);");
yrest(500);
while (inventory:itemTotalCount(203038) >= 30) do
sendMacro("StoreBuyItem(1)");
yrest(1000);
inventory:update();
end;
sendMacro("CloseWindows();");
while (inventory:itemTotalCount(203487) > 0) do -- uses charges
inventory:useItem(203487);
end;
write_tokens();
RoMScript("UseSkill(1,2);"); -- Port to Elven island
waitForLoadingScreen();
loadPaths("back");
this should do it.
in whitch rev is the "waitforLoadingScreen" function included ?
I think its because the bot finishes the waypoint and then goes to the indexed one
No, the code for the waypoint will be completed.
Thtas what i meant with finishing the waypoint
rock5 wrote:
Also you can use the new function waitForLoadingScreen() instead of the player:rest(30) command. It will return control as soon as the teleport completes.
Is there help wanted to find the pointer if we get a new update?