Page 1 of 1

Need some help for automatioc dailyquestroutine

Posted: Fri Jun 25, 2010 6:35 am
by Starrider
thx for help

Re: Need some help for automatioc dailyquestroutine

Posted: Fri Jun 25, 2010 7:35 am
by rock5
Starrider wrote:hello, I need some help for a daily quest routine.
i want that my npc automatically accept and finish DQ on the elven isle. There is a DQ you can take form the NPC Blinsik where you must "wash" some food in the water at the rocks.

but i have the problem:

Code: Select all

<!-- #  3 --><waypoint x="31859" z="4591">		
player:target_NPC("Blinsik");
player:rest(3);
sendMacro("ChoiceOption(2);");
player:rest(3);
</waypoint> 
i got the MM-massage that the bot opens the Dialog window, but it doesnt happen. Does this work only with one MMProgram open? (Had another Bot runing during i wanted to test this)
If you got the mm message saying "We successfully target NPC" then it did target the NPC. Having another MMProgram running shouldn't cause a problem unless it is attached to the same RoM client and is running a script that clashes with it.

ChoiceOption is the wrong command. It is for choosing normal options but these are quests. You need to use the quest commands. In this case you use sendMacro("AcceptQuest()") to accept and sendMacro("CompleteQuest()") to complete the quest.
Starrider wrote:Second how can i select the object where I have to transform the DQ-Item, its a cristall <!-- # 13 --><waypoint x="31418" z="5715">. Need to run window in foreground? use the mouseclick option etc.?
You should use the harvest command. Using rom/getid.lua I got the item id of 112976 so you would use player:harvest(112976). Those coordinates are a bit too close so back up a bit. You also need to fine tune the scanning settings because the crystal is a bit small (Harvest expert options). And, yes, the window needs to be on top.

Re: Need some help for automatioc dailyquestroutine

Posted: Mon Jul 26, 2010 4:48 pm
by Starrider
hi got now working it, but how to work with the

Code: Select all

local dailyQuestCount, dailyQuestsPerDay= Daily_count();
DEFAULT_CHAT_FRAME:AddMessage("You've completed "..dailyQuestCount.." out of " .. dailyQuestsPerDay ..
    " daily quests, leaving " .. dailyQuestsPerDay - dailyQuestCount .. " quests.");
Works this code also with the german chat text?

I want that the bot counts the DQs an then log out...
where to put the code in the WP list, after the queststauts checks?

Re: Need some help for automatioc dailyquestroutine

Posted: Mon Jul 26, 2010 5:11 pm
by rock5
Starrider wrote:hi got now working it, but how to work with the

Code: Select all

local dailyQuestCount, dailyQuestsPerDay= Daily_count();
DEFAULT_CHAT_FRAME:AddMessage("You've completed "..dailyQuestCount.." out of " .. dailyQuestsPerDay ..
    " daily quests, leaving " .. dailyQuestsPerDay - dailyQuestCount .. " quests.");
Works this code also with the german chat text?

I want that the bot counts the DQs an then log out...
where to put the code in the WP list, after the queststauts checks?
The obvious place would be after you talk to the npc and complete a daily quest. Then check if you have finished. That command should work fine in any client language.

Re: Need some help for automatioc dailyquestroutine

Posted: Mon Jul 26, 2010 5:36 pm
by Starrider
make changes on this code or only put it like this, i dont kno how to code the if/then syntax.

Re: Need some help for automatioc dailyquestroutine

Posted: Mon Jul 26, 2010 11:47 pm
by rock5
Starrider wrote:make changes on this code or only put it like this, i dont kno how to code the if/then syntax.
Something like this;

Code: Select all

local dailyQuestCount, dailyQuestsPerDay= RoMScript("Daily_count()");
print("You've completed "..dailyQuestCount.." out of " .. dailyQuestsPerDay ..
    " daily quests, leaving " .. dailyQuestsPerDay - dailyQuestCount .. " quests.");
if (dailyQuestsPerDay - dailyQuestCount) == 0 then -- finished, log out
    player:logout()
end

Re: Need some help for automatioc dailyquestroutine

Posted: Tue Jul 27, 2010 2:06 pm
by Starrider
I used this script from you

Code: Select all

 -- Complete quest
         player:target_NPC();
         sendMacro("CompleteQuest()"); yrest(2000);
         local dqCount, dqPerDay= RoMScript("Daily_count()");
         if (dqPerDay - dqCount) == 0 then -- finished, log out
             player:logout()
         end
         -- Accept quest
worked perektly, but one time I got at remaining 2 DQs this error:
[string "...":8: attemp to perform arithmetic on local 'dqPerDay' a nil value

how has to look the code with autologin to next char? like this?:

Code: Select all

 -- Complete quest
         player:target_NPC();
         sendMacro("CompleteQuest()"); yrest(2000);
         local dqCount, dqPerDay= RoMScript("Daily_count()");
         if (dqPerDay - dqCount) == 0 then -- finished, log out
               sendMacro("}LoginNextToon=true;a={")
sendMacro("Logout();"); yrest(3*60*1000) -- wait 3m for next character to load

-- Re-initialize player
player = CPlayer.new();
settings.load();
settings.loadProfile("l1-10"); -- Profile name
yrest (4000)

loadPaths("   "); -- First script

         end
   -- Accept quest
is the "end" correct?

If I want that the characters loaded not l1-10 do i need for every character an own WP list, where stand at settings.loadProfile("l1-10") substitudes by settings.loadProfile("CharA"), and loadPaths("WaypointCharA"), an at the end of WP script of CharA: settings.loadProfile("CharB") and loadPaths("WaypointCharB") etc. pp.?

next issue:
sometimes it doesn't harvest the object because it still moves a little bit when it already startet to harvest and got a break up or another player is at the object. If the transfomration is finished I got the obejct with the ID 204840, how to code at the Waypoint to check the inventuory for the object with ID 204840 an when true to go on else to wait 2 seconds to try again in a loop until true?

Re: Need some help for automatioc dailyquestroutine

Posted: Tue Jul 27, 2010 11:54 pm
by rock5
Starrider wrote: worked perektly, but one time I got at remaining 2 DQs this error:
[string "...":8: attemp to perform arithmetic on local 'dqPerDay' a nil value
It's a known issue with RoMScript(), sometimes it returns nil. A fix was implemented awhile ago to make it less likely to happen but it will still sometimes happen. You can make sure it's not nil by changing;

Code: Select all

         local dqCount, dqPerDay= RoMScript("Daily_count()");
to

Code: Select all

         repeat
                  dqCount, dqPerDay= RoMScript("Daily_count()");
         until dqCount and dqPerDay
Starrider wrote:how has to look the code with autologin to next char? like this?:

Code: Select all

 -- Complete quest
         player:target_NPC();
         sendMacro("CompleteQuest()"); yrest(2000);
         local dqCount, dqPerDay= RoMScript("Daily_count()");
         if (dqPerDay - dqCount) == 0 then -- finished, log out
               sendMacro("}LoginNextToon=true;a={")
sendMacro("Logout();"); yrest(3*60*1000) -- wait 3m for next character to load

-- Re-initialize player
player = CPlayer.new();
settings.load();
settings.loadProfile("l1-10"); -- Profile name
yrest (4000)

loadPaths("   "); -- First script

         end
   -- Accept quest
is the "end" correct?
Yes. It closes the 'if' statement.
Starrider wrote:If I want that the characters loaded not l1-10 do i need for every character an own WP list, where stand at settings.loadProfile("l1-10") substitudes by settings.loadProfile("CharA"), and loadPaths("WaypointCharA"), an at the end of WP script of CharA: settings.loadProfile("CharB") and loadPaths("WaypointCharB") etc. pp.?
If it's just for dailies you don't need to use customized character profiles. They are only needed to personalize the attack sequence. For dailies you can just use 'l1-10' or 'default'.
Starrider wrote:next issue:
sometimes it doesn't harvest the object because it still moves a little bit when it already startet to harvest and got a break up or another player is at the object. If the transfomration is finished I got the obejct with the ID 204840, how to code at the Waypoint to check the inventuory for the object with ID 204840 an when true to go on else to wait 2 seconds to try again in a loop until true?
If it's still moving when it starts the transformation, just put a pause before it, say 500ms? For the rest, try this;

Code: Select all

repeat
    player:target_Object(112976,8000)
    inventory:update()
until inventory:itemTotalCount(204840) > 0 

Re: Need some help for automatioc dailyquestroutine

Posted: Wed Jul 28, 2010 1:34 pm
by Starrider
thx the loop for the inventory check and the waittime works perfektly!
also the function for autologout when DQs finished,

but one time I had again a nil value by comparing dqPerDay - dqCount
i still got the error often at the last DQ...

I use your modified Autologin 1.3.1 now its switches all charakaters from 1-8

is it with this script and the bot possible that at the end of Char8 the bot logs out completly an login into another account and start the same procedure again?

Re: Need some help for automatioc dailyquestroutine

Posted: Wed Jul 28, 2010 9:37 pm
by rock5
Starrider wrote:but one time I had again a nil value by comparing dqPerDay - dqCount
i still got the error often at the last DQ...
I don't know what to say. When using this code

Code: Select all

         repeat
                  dqCount, dqPerDay= RoMScript("Daily_count()");
         until dqCount and dqPerDay
dqPerDay and dqCount should never ever be nil.
Starrider wrote:I use your modified Autologin 1.3.1 now its switches all charakaters from 1-8

is it with this script and the bot possible that at the end of Char8 the bot logs out completly an login into another account and start the same procedure again?
MiesterMan worked out a solution for that. Read his thread here.
http://www.solarstrike.net/phpBB3/viewt ... =21&t=1398

Re: Need some help for automatioc dailyquestroutine

Posted: Thu Jul 29, 2010 11:57 am
by Starrider
ok now the bot runned all charakters correctly, so it should has been an error from the Client...
Many thx for your support and the nice work you did!!!