Difference between revisions of "RoM Auto repair"

From SolarStrike wiki
Jump to: navigation, search
(Use a Time Based AutoRepair)
Line 74: Line 74:
 
</waypoint>
 
</waypoint>
 
</source>
 
</source>
 +
 +
== Switch an item ==
 +
 +
Instead of repairing your items, you could also switch a item based on the durabilty:
 +
 +
<source lang="xml"><onLeaveCombat>
 +
  local dura = inventory:getMainHandDurability();
 +
  printf("Durability:%s\n", dura);
 +
  if( dura &lt; 0.9 ) then
 +
      inventory:useItem(<itemNameOrId>);
 +
  end
 +
</onLeaveCombat></source>
 +
Replace '<itemNameOrId>' with the itemname or itemid of the item you want to equipt. You have to be sure that your [http://www.solarstrike.net/wiki/index.php5?title=RoM_Functions#Inventory_and_Item_Functions inventory is up to date], because the funtion 'inventory:useItem(itemNameOrId);' uses the cached inventory.
 +
  
 
You also could combine some of that methods.
 
You also could combine some of that methods.

Revision as of 04:44, 2 November 2009

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 doing 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");
		load_paths("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( dura &lt; 0.9 ) 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>

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( dura &lt; 0.9 ) 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

There are some expert options for your profile if you want to automaticly sale 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, Magen, Schallblase" />
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, you don't want to sell. You can enter more than one item. Use commata as delimites.

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, ...