RoM Functions

From SolarStrike wiki
Revision as of 05:23, 13 September 2009 by D003232 (talk | contribs) (General Functions)
Jump to: navigation, search

General Functions

     loadPaths( [path] [,returnpath] );

Load a new waypoint file and if available the default return path to that file. e.g. 'loadPaths("l7-9");' will load the waypoint path 'l7-9.xml' and if available the return path 'l7-9_return.xml'.


changeProfileOption(_option, _value);

change profile options and print values in MM protocol

levelupSkill(_skillname [, _times] )

Levelup a Single Skill by Name. For the skillname look into the file /database/skills.xml. You can use that function only for skill, which have maintent the skilltab and skillnum values within the skills.xml entry. If the don't have that values, please look yourself for them and use the manual way.

levelupSkills1To10( ["loadonly"] );

That function will levelup a internal given selection of useful skills on your way from 1-10. The selection of the skills is hard coded within functions.lua. That function will also load the skill into your profile skill list and use that skill via the MACRO function. If you restart the bot and want also want to use that skills and don't want to enter them manual into the profile skill list, then just use that function with the parameter 'loadonly' within the onLoad event:

openGiftbags1To10( [[_player_level] , _maxslot] );

open the level 1-10 giftbags and equipt the items.


addMessage( message );

Send a message to the ingame system chat channel.


RoMScript( _script );

 example:
 local ret1, ret2 = RoMScript( "GetPlayerWorldMapPos();" );

Send a macro to the client and execute it ingame by pressing the MACRO hotkey. There are up to 10 return values possible.


sendMacro( _script );

Same as "RoMScript. Additionally you will see a message in the MM window.

Player Functions

     player:harvest();

Scan that waypoint for a harverst node and harvest that (at the moment only working if the RoM window is in foreground).


     player:restrnd([probability [, minrest [, maxrest]]]);

e.g. 'player:restrnd(30, 3, 10);' Rest with a probability from 30% at that waypoint for between 3 and 10 seconds. The bot will fight back if attacked while resting and continue after that. Similar functions are 'stopPE()' and 'player:sleep()'.


     player:rest( minrest [, maxrest[, time|full[, restaddrnd]]]);

minrest ( min time to rest in sec) 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:

     <option name="HP_REST" value="15" />
     <option name="MP_REST" value="15" />

Default value if not defined is 15% each.

     examples:
     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


     player:sleep();

Pause the bot at that waypoint in a sleep mode. The bot will still fight back attackers and sleep again after doing that. Press DEL if you want to continue. Similar functions are 'player.restrnd()' and 'stopPE()'.


     player:logout([true]);

Logout from RoM. With 'player:logout(true)' you will also shutdown your pc after loging out.


     player:mouseclickL(x, y [RoM window wide, RoM window high]);

Left click a screen point and by that, interact with a NPC. x, y is relative to the RoM window. So it is your fiddly task to find the right values to click the right buttons. Remember the RoM windows size for that click positions. By doing that, we can later recalculate the mouse click points if we run the bot in a different RoM windows size.


Inventory and Item Functions

Waypoint File Functions

     __WPL:reverse();

Resort the waypoints. Means after running from 1 to 20 you can now run from 20 - 1. It is usefull to put that at the first and at the last waypoint if you want to run between two places.


     __WPL:setForcedWaypointType( [["NORMAL"] | ["TRAVEL"] | ["RUN"]]);

Set a forced waypoint type. The waypoint type overwrites the type settings within the waypoint file. The forced waypoint type is valid until you load a new waypoint file or you call the function '__WPL:setForcedWaypointType();' without argument.


Using of RoM API Functions

With the function sendMacro() or RoMScript() we can sumbit macros to the RoM API. Here some important API functions you can use:

sendMacro("SetSpellPoint( 4, 2 );");

Levelup a skill. First number is the tab (1=general, 2=general class skills, 4=only primary class skills). Second number is the number of the skill at the tab. You can test the numbers by entering following macro ingame:

/script _SkillName=GetSkillDetail(4,3); SendSystemChat(_SkillName);
That will print you the name of the given skill into the ingame system chat.