RoM Auto repair

From SolarStrike wiki
Jump to: navigation, search

Auto Repair at the merchant NPC

For using the autorepair ingame, you need normaly to press the 'repair' button. You can install the ingame addon Streamline. Streamline will automaticly repair if you open a dialog window with a merchant and it will automaticly deliver quests, if you open a dialog with a quest NPC.

You can also do that by using the function:

player:merchant( npc_name );

It will try to target the nearest NPC's and find the NPC by name. After that, the bot will open the dialog window, autorepair and buy consumables depending from your profile options. It will also work while using multiple bots.

If you only want to target a NPC and do the further stuff by yourself you can use the function:

player:target_NPC( npc_name );


Now you have to create a waypoint file, which leads your character to the repair NPC

e.g. '5-7_bugs_repair.xml'

<waypoints>
   <!-- Thats a demo to interact with the NPC Tracy                         -->
	<!-- # 1 --><waypoint x="-12282" z="11183"></waypoint>
	<!-- # 2 --><waypoint x="-12391" z="10982"></waypoint>
	<!-- # 3 --><waypoint x="-12529" z="10941"></waypoint>
	<!-- # 4 --><waypoint x="-808" z="-6067">
		player:merchant("Tracy");
		loadPaths("5-7_bugs_repair_back");
   </waypoint>
</waypoints>

The bot will use the waypoint file '5-7_bugs_repair_back' to find back the way to the original boting place.


You now have to insert some code into your boting waypoint file (in this example into the file '5-7_bugs.xml'), to give the bot the information when to repair.


Use a Durability Based AutoRepair

It could be based on the duration of your items:
<!-- #  1 --><waypoint x="13752" z="6726">
	if( player.free_flag1 == true ) then 
		player.free_flag1 = false; 
		loadPaths("5-7_bugs_repair.xml");
	end
	</waypoint>

As you see, we don't check the duration directly in the waypoint file. Simply because the duration is dependent from your armor and by that, dependend from your character. Hence we check the duration in our characters profile and set just a flag, if we should go for repairing.

<onLeaveCombat>
	local dura = inventory:getMainHandDurability();
	printf("Durability:%s\n", dura);
	if( 90 > dura ) then
		player.free_flag1 = true;
	end
</onLeaveCombat>

Use a Fight Based AutoRepair

It could be fight based:
	<!-- #16 --><waypoint x="-12364" z="10939">
	if( player.Fights-player.free_counter1 > 300 ) then
		player.free_counter1 = player.Fights;
		load_paths("5-7_bugs_repair.xml");
	end
	</waypoint>

Use a Time Based AutoRepair

Or time based:
	<!-- #16 --><waypoint x="-12364" z="10939">
	if(player.free_counter1 == 0) then player.free_counter1 = os.time(); end;
	if( os.difftime(os.time(), player.free_counter1) > 3600 ) then
		player.free_counter1 = os.time();
		load_paths("5-7_bugs_repair.xml");
	end
	</waypoint>


Use a Items Based AutoRepair

You also can check for an item amount like healing or mana potions. But I would recommend more to use a durability check and by that fill up enough of your potions
	<!-- #16 --><waypoint x="-12364" z="10939">
	if( 20 > inventory:itemTotalCount(<itemNameOrId>) ) then
		load_paths("5-7_bugs_repair.xml");
	end
	</waypoint>

Replace <itemNameOrId> with the itemname or item-id of the potions you want to check. Be sure your cached inventory is up to date. See the inventory functions section for more informatione about that.

Switch an item

Instead of repairing your items, you could also switch a item based on the durabilty:

<onLeaveCombat>
   local dura = inventory:getMainHandDurability();
   printf("Durability:%s\n", dura);
   if( 0.9 > dura ) then
      inventory:useItem(<itemNameOrId>);
   end
</onLeaveCombat>

Replace '<itemNameOrId>' with the itemname or itemid of the item you want to equipt. You have to be sure that your inventory is up to date, because the funtion 'inventory:useItem(itemNameOrId);' uses the cached inventory.


You also could combine some of that methods.

Auto Sell at the merchant NPC

General Autosell Options

There are some expert options for your profile if you want to automatically sell items to the merchant NPC.

<option name="INV_AUTOSELL_ENABLE"	        value="true" />
<option name="INV_AUTOSELL_FROMSLOT"		value="61" />
<option name="INV_AUTOSELL_TOSLOT"		value="120" />
<option name="INV_AUTOSELL_QUALITY"		value="white,green" />
<option name="INV_AUTOSELL_IGNORE"		value="Pfeil,Elementar, III" />
<option name="INV_AUTOSELL_TYPES"		value="Weapons,Armor,Recipes,Others" />
<option name="INV_AUTOSELL_TYPES_NOSELL"	value="Cloth,Cooking" />
<option name="INV_AUTOSELL_NOSELL_STATSNUMBER"	value="2" />
INV_AUTOSELL_ENABLE Allows you to enable or disable the Auto Sell function. Valid values are true|false.
INV_AUTOSELL_FROMSLOT Starting bagslot for autosell. Bag 1 has slots 1-30, bag 2 has slots 31-60, ...
INV_AUTOSELL_TOSLOT Ending bagslot for autosell.
INV_AUTOSELL_QUALITY Enter the item qualities you want to sell. Recommended value is "white, green" ( white | green | blue | purple | orange | gold).
INV_AUTOSELL_IGNORE Enter items names (or parts of the names) or item-Ids (not parts of the tooltip text !), you don't want to sell. You can enter more than one item. Use commata as delimites.
INV_AUTOSELL_TYPES Enter the item types you want to sell. You can view a list of the item types in the cache file "cache/itemtypestable.lua" once it has been created. If no types are specified then it will default to selling all.
INV_AUTOSELL_TYPES_NOSELL Enter the item types you don't want to sell. This overrides the "INV_AUTOSELL_TYPES" option. So if you set INV_AUTOSELL_TYPES = "Armor" and INV_AUTOSELL_TYPES_NOSELL = "Cloth" then it will sell armor but not cloth armor.
INV_AUTOSELL_NOSELL_STATSNUMBER Items with this number of named stats wont be sold. It doesn't count unnamed stats or stats added to rune slots. Especially useful to avoid accidentally selling your costly stated gear. The default value is '3'.

Use the normal 'player:merchant()' function in your waypoint file to autosale your items. The bagslot are starting from the top left with 1, 2, 3, ... in the first row, 6, 7, 8, ... in the second row, ...

Check Durability and Stats while using Autosell

You can also check the durability and/or stats of an item while selling it. We need to read the ingame tooltip to check the durability and the stats. That's at the moment not possible by only using the RoMScript() MACRO function. So we need a little ingame addon. That addon is named 'igf' (ingamefunctions). You found that addon in the bot folder 'rom/devtools/'.

Please copy the folder 'ingamefunctions' into your RoM installation into the folder '\Runes of Magic\Interface\AddOns' to install that addon. And restart the RoM games client.

<option name="INV_AUTOSELL_NOSELL_DURA"      value="110" />
<option name="INV_AUTOSELL_STATS_NOSELL"      value=" X,XI" />
<option name="INV_AUTOSELL_STATS_SELL"      value="IX" />
INV_AUTOSELL_NOSELL_DURA Items with a durability eq or greater that value will not be sold.
INV_AUTOSELL_STATS_NOSELL Items with that text strings in the right tooltip side will not be sold. Caution: It's only a very easy check. So that text strings are checked against the whole right side tooltip text. E.g. if you want to save the stat 'defense', also items with 'magical defense' will not be sold. Not only items with the stat 'defense'. Sry for that. If you set the value 'X', all stats with 'X' wouldn't be sold: 'X', 'IX', 'XI'.
INV_AUTOSELL_STATS_SELL By using that items, you could overwrite the 'INV_AUTOSELL_STATS_NOSELL' value. e.g. if you set 'INV_AUTOSELL_STATS_NOSELL'="X" you would not sell 'IX' stats. But if you know set 'INV_AUTOSELL_STATS_SELL="IX" you would sell 'IX' stats and save all other stats with 'X'.

Debuging Option for Autosell

You can use the option:

<option name="DEBUG_AUTOSELL"      value="true" />

to get some debuging options while using autosell.