Page 1 of 1

Idea to implement to the bot to reduce afk deaths

Posted: Tue Sep 21, 2010 11:41 am
by Rom Botter
I had an idea, after dying allot when AFK after i set the max deaths higher (i know i could just reduce the max deaths, but i dont want that :P)

Now, i dont know if its possible for the bot to find the weapon dura, but if thats possible, my idea would be loved by all (i think XD)

Now what my idea is, is to add another type of waypoint like "Repair" which u put at the first waypoint of your repair path (the one u copy after ur regular path) so that if weapon dura (which reduces faster then any item) drops below X amount of dura, it wil go to that particular waypoints so its gonna repair the gear and continue the rest of the waypoints of ur repair path back to waypoint 1 of regular lvling path...

i hope this is possible cuz that would be a really nice add to the already outstanding bot u guys made ^^

Re: Idea to implement to the bot to reduce afk deaths

Posted: Tue Sep 21, 2010 9:33 pm
by rock5
That's old hat. It's common, if you have a long running script, to include a repair and selling section.

I wrote a description of a simple way of doing it in another post. Here is an edited version that checks for dura.
1. Run 'rom/createpath.lua'.
2. Do a full circuit around the collecting area. Lets call them waypoints 1 to 10.
3. Then head to a store npc and use player:merchant() on it (keypad 4) and head back to point 10. Lets call them waypoints 11 to 20
4. Save the waypoints and quit createpath.lua (keypad 3).
5. At waypoint 10 add

Code: Select all

local dura = inventory:getMainHandDurability();
if dura > 90 then
	__WPL:setWaypointIndex(1);
end
What this does is keep fighting until dura falls below 90% then goes for repairs. Set it to whatever you want.
You can do other checks here instead, for instance you can see if you have enough items for a daily, then head to the quest giver npc.
4. When it gets back it will continue with waypoint 1.

Re: Idea to implement to the bot to reduce afk deaths

Posted: Wed Sep 22, 2010 6:47 am
by Rom Botter
thats awesome

i didnt find anything on the wiki on how to do this, and im not that good in programming, thats why i thought this could be implemented in the bot for the noobs like me who cant do stuff like this without help from the pro's XD

edit:

i changed my path and thanks for the info ^^ it works great, even if it overruns the waypoints with the code in it, it still executes it :)

now i can make waypoints without copy pasting them the amount of times i have to figure out first when he has to repair my gear XD

Re: Idea to implement to the bot to reduce afk deaths

Posted: Fri Sep 24, 2010 6:37 pm
by Rom Botter
i tried to jumble around for a new function in my waypoints... but i cant get it to work.

i want the bot to go to a specific waypoint, if the named hp potions come below the amount of 150, for this i have the following:

Code: Select all

<!-- # 16 --><waypoint x="17967" z="25137"> inventory:update()	</waypoint>
	<!-- # 17 --><waypoint x="17741" z="24745"> local hp = inventory:itemTotalCount(Ancestral Spirit Herbs);
if hp > 150 then __WPL:setWaypointIndex(20);
end	</waypoint>
	<!-- # 18 --><waypoint x="17389" z="24686">			local dura = inventory:getMainHandDurability();
if dura > 65 then
   __WPL:setWaypointIndex(1);
end     </waypoint>
waypoints 18 works just fine, but waypoint 17 is the one that is giving me problems, what am i doing wrong?

Re: Idea to implement to the bot to reduce afk deaths

Posted: Sat Sep 25, 2010 2:31 am
by rock5
Rom Botter wrote:i tried to jumble around for a new function in my waypoints... but i cant get it to work.

i want the bot to go to a specific waypoint, if the named hp potions come below the amount of 150, for this i have the following:

Code: Select all

<!-- # 16 --><waypoint x="17967" z="25137"> inventory:update()	</waypoint>
	<!-- # 17 --><waypoint x="17741" z="24745"> local hp = inventory:itemTotalCount(Ancestral Spirit Herbs);
if hp > 150 then __WPL:setWaypointIndex(20);
end	</waypoint>
	<!-- # 18 --><waypoint x="17389" z="24686">			local dura = inventory:getMainHandDurability();
if dura > 65 then
   __WPL:setWaypointIndex(1);
end     </waypoint>
waypoints 18 works just fine, but waypoint 17 is the one that is giving me problems, what am i doing wrong?
1. Why do an "inventory:update()" by itself at waypoint 16?
2. You don't need to do an "inventory:update()" because itemTotalCount includes an update.
3. Your problem is itemTotalCount needs a number(item id) or a string(item name). Try inventory:itemTotalCount("Ancestral Spirit Herbs").

Even though this time the problem was obvious, next time include the error message as well.

Re: Idea to implement to the bot to reduce afk deaths

Posted: Sat Sep 25, 2010 7:04 am
by Rom Botter
- deleted by poster to save space...

Re: Idea to implement to the bot to reduce afk deaths

Posted: Sat Sep 25, 2010 8:19 am
by Rom Botter
Finally i have it working like i want too...

i looked in ur eggs and milk scripts and found the necessary tips to make what i want work :)

Code: Select all

<waypoints>
    <!-- #  1 --><waypoint x="16870" z="24897">
local hp = inventory:itemTotalCount("Ancestral Spirit Herbs");
if 150 >= hp then __WPL:setWaypointIndex(20);
end    </waypoint>
    <!-- #  2 --><waypoint x="16574" z="25011">
local mana = inventory:itemTotalCount("Elemental Spirit Stone");
if 75 >= mana then __WPL:setWaypointIndex(20);
end    </waypoint>
    <!-- #  3 --><waypoint x="16212" z="24942">    </waypoint>
    <!-- #  4 --><waypoint x="16398" z="24828">    </waypoint>
    <!-- #  5 --><waypoint x="16592" z="24729">    </waypoint>
    <!-- #  6 --><waypoint x="16890" z="24724">    </waypoint>
    <!-- #  7 --><waypoint x="17446" z="24662">    </waypoint>
    <!-- #  8 --><waypoint x="17758" z="24730">    </waypoint>
    <!-- #  9 --><waypoint x="17825" z="24815">    </waypoint>
    <!-- # 10 --><waypoint x="17985" z="24995">    </waypoint>
    <!-- # 11 --><waypoint x="18161" z="25116">    </waypoint>
    <!-- # 12 --><waypoint x="18434" z="25158">    </waypoint>
    <!-- # 13 --><waypoint x="18590" z="25166">    </waypoint>
    <!-- # 14 --><waypoint x="18409" z="25191">    </waypoint>
    <!-- # 15 --><waypoint x="18155" z="25291">    </waypoint>
        <!-- # 16 --><waypoint x="17967" z="25137">    </waypoint>
        <!-- # 17 --><waypoint x="17741" z="24745">    </waypoint>
        <!-- # 18 --><waypoint x="17389" z="24686">
local dura = inventory:getMainHandDurability();
if dura > 60 then __WPL:setWaypointIndex(1);
end    </waypoint>
        <!-- # 19 --><waypoint x="16958" z="24989">    </waypoint>
    <!-- # 20 --><waypoint x="16881" z="24958">    </waypoint>
    <!-- # 21 --><waypoint x="16570" z="25007">    </waypoint>
    <!-- # 22 --><waypoint x="16230" z="24935">    </waypoint>
    <!-- # 23 --><waypoint x="15847" z="24892">    </waypoint>
    <!-- # 24 --><waypoint x="15541" z="24858">    </waypoint>
    <!-- # 25 --><waypoint x="15273" z="24875">    </waypoint>
    <!-- # 26 --><waypoint x="15157" z="24756">    </waypoint>
    <!-- # 27 --><waypoint x="14991" z="24707">        player:target_NPC("Beck Fost");
        player:merchant("Beck Fost");
    </waypoint>
    <!-- # 28 --><waypoint x="15114" z="24730">    </waypoint>
    <!-- # 29 --><waypoint x="15121" z="24568">    </waypoint>
    <!-- # 30 --><waypoint x="15929" z="24611">    </waypoint>
    <!-- # 31 --><waypoint x="16221" z="24898">    </waypoint>
</waypoints>
is now my waypoints, and it works like a charm ^^

thanks for the help :)