Functions you can use in a waypoint file
You can use you own lua code within the <waypoint></waypoint> tags. By doing that you can do nearly everything. And there are some prefabricated functions:
To use some of that functions, simply put them into the waypoint tag:
Code: Select all
<!-- #20 --><waypoint x="799" z="-426">player:restrnd(20, 1, 10);</waypoint>
Thats wrong:
Code: Select all
<waypoints type="TRAVEL" >player:harvest();
<!-- # 1 --><waypoint x="-2060" z="-8216"></waypoint>
</waypoints>
Code: Select all
player:harvest();
Code: Select all
load_paths( [path] [,returnpath] );
Code: Select all
if( player.Level > 9 ) then
printf("do some other coding stuff");
end;
Code: Select all
__WPL:reverse();
Code: Select all
__WPL:setForcedWaypointType( [["NORMAL"] | ["TRAVEL"] | ["RUN"]]);
Code: Select all
player:restrnd([probability [, minrest [, maxrest]]]);
Code: Select all
player:rest( minrest [, maxrest[, time|full[, restaddrnd]]])
maxrest ( max time to in sec)
_resttype ( time | full ) time = rest the given time | full = stop resting after being full / default = time
_restaddrnd ( max random addition after being full in sec)
If using type 'full', the bot will only rest if HP or MP is below a defined level. You define that level in your profile with the options:
Code: Select all
<option name="HP_REST" value="15" />
<option name="MP_REST" value="15" />
e.g.
player:rest(20) will rest for 20 seconds.
player:rest(60, 20) will rest between 60 and 80 seconds.
player:rest(90, 40, "full") will rest up to between 90 and 130 seconds, and stop resting if being full
player:rest(90, 40, "time") will rest up to between 90 and 130 seconds, and not stop resting if being full
player:rest(20, 40, "full, 20") will rest up to between 20 and 60 seconds, and stop resting if being full, and wait after that between 1-20 seconds
Code: Select all
stopPE();
Code: Select all
player:sleep();
Code: Select all
player:logout([true])
Code: Select all
if( os.difftime(os.time(), player.BotStartTime) > 3600 ) then
printf("do some other coding stuff");
end;
Code: Select all
player:scan_for_NPC( [npc_name] );
Code: Select all
player:mouseclickL(x, y [RoM window wide, RoM window high]);
How to use the bot for running between the and NPC <-> blackboard for delivering of daily quests
It starts in Harf. There you have the quest 'Winterspinnenarten' from the blackboard where you deliver 10 winter spider body liquids to the 'Lager im Winternachttal'.
The waypoints are from the blackbard in Harf up to the camp. After each end of the waypoint file is a PAUSE. So you can handle with the NPC/blackboard and after that press 'DEL' to reverse the waypoints and run back.
Code: Select all
<waypoints type="RUN">
<!-- # 1 --><waypoint x="-14389" z="-380" type="TRAVEL">__WPL:reverse();
player:sleep();</waypoint>
<!-- # 2 --><waypoint x="-14531" z="-253"></waypoint>
...
<!-- #21 --><waypoint x="-18500" z="-2516 type="TRAVEL" >__WPL:reverse();
player:sleep();
</waypoint>
</waypoints>
Some hints: If you deliver the quest with a low level char, than set your loot option (<option name="LOOT" value="true" />) in your profile to 'false'. That will prevent from coming closer to mob groups while looting. It also could be helpful, to reduce your option 'WAYPOINT_DEVIATION' or set it to 0 (and set back to a higher value for normal botting).
How to successive connect different waypoint files
Thats an example how to start with level 1 and change the botting place depending from your level.
We start at the spawn point:
Code: Select all
<waypoints type="TRAVEL" >
<!-- # 3 --><waypoint x="-3779" z="-8480"></waypoint>
...
<!-- # 8 --><waypoint x="-3034" z="-9034">load_paths("l2-3.xml");</waypoint>
</waypoints>
![Smile :-)](./images/smilies/icon_e_smile.gif)
Now we are at that place:
Code: Select all
<waypoints type="NORMAL" >
<!-- # 1 --><waypoint x="-2206" z="-9648"></waypoint>
<!-- # 2 --><waypoint x="-2133" z="-9796">player:restrnd(20, 1, 10);</waypoint>
<!-- # 3 --><waypoint x="-2224" z="-9882">player:restrnd(20, 1, 10);</waypoint>
...
<!-- # 7 --><waypoint x="-2391" z="-9639">
if( player.Level > 4 ) then
load_paths("l5_goto_6.xml");
end;
</waypoint>
</waypoints>
If you want to autorepair then read here for more informations about that.