Difference between revisions of "RoM Auto repair"

From SolarStrike wiki
Jump to: navigation, search
Line 1: Line 1:
Here is a thread on how to do auto repair, the topic should be converted to the wiki.. please do it.
 
 
[http://www.solarstrike.net/phpBB3/viewtopic.php?f=21&t=496 link]
 
 
 
For using the autorepair ingame, you need normaly to press the 'repair' button. You can do this by using the 'player:mouseclickL();' function within the bot. Or you just install the ingame addon [http://rom.curse.com/downloads/rom-addons/details/streamline.aspx 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.
 
For using the autorepair ingame, you need normaly to press the 'repair' button. You can do this by using the 'player:mouseclickL();' function within the bot. Or you just install the ingame addon [http://rom.curse.com/downloads/rom-addons/details/streamline.aspx 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.
  
Line 11: Line 7:
 
It will try to target the nearest NPC's and find the NPC by name. After that, the bot will open the dialog window. It will also work while using multiple bots.
 
It will try to target the nearest NPC's and find the NPC by name. After that, the bot will open the dialog window. It will also work while using multiple bots.
  
e.g.
+
Now you have to create a waypoint file, which leads your character to the repair NPC
 +
 
 +
e.g. '5-7_bugs_repair.xml'
 
<source lang="lua"><waypoints>
 
<source lang="lua"><waypoints>
   <!-- Thats a demo to interact with the NPC York Harris in Logar -->
+
   <!-- Thats a demo to interact with the NPC York Harris in Logar         -->
   <!-- For autorepairs you need the addon 'streamline'           -->   
+
   <!-- For autorepairs without mouseclicks you need the addon 'Streamline' -->   
  <!-- # 1 --><waypoint x="-808" z="-6067">
+
<!-- # 1 --><waypoint x="-12282" z="11183"></waypoint>
  player:rest(5);
+
<!-- # 2 --><waypoint x="-12391" z="10982"></waypoint>
  player:target_NPC("York");
+
<!-- # 3 --><waypoint x="-12529" z="10941"></waypoint>
  player:rest(2);
+
<!-- # 4 --><waypoint x="-808" z="-6067">
  <!-- The coordinates depends from your screen resolution/window -->
+
player:rest(4);
  <!-- size. We recalculate them for the actual RoM windows size  -->  
+
player:target_NPC("Tracy");
  <!-- hence we need the original values (here 800x617)          -->    
+
player:rest(4);
  player:mouseclickL(130, 200, 800, 617);
+
load_paths("5-7_bugs_repair_back");
  player:rest(2);
 
  player:mouseclickL(130, 300, 800, 617);
 
 
   </waypoint>
 
   </waypoint>
 
</waypoints></source>
 
</waypoints></source>
In that case we click some points of the dialog. If it would be a merchant, the store window would open and streamline will autorepair. As you see, you can also use:
+
If the merchant is found, the store window would open and streamline will autorepair. After a short rest from 4 seconds, the bot will use the waypoint file '5-7_bugs_repair_back' to find back the way to the original boting place.
<source lang="lua">player:mouseclickL(x, y [RoM window wide, RoM window high]);</source>
+
 
to left click an point and by that, interact with the 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. We remember the RoM windows size (800 x 617) 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.
+
 
 +
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.
 +
 
 +
It could be fight based:<source lang="lua"> <!-- #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>
 +
</source>
  
You can use a [http://www.softpedia.com/progDownload/Mouse-Pointer-Locator-Download-88312.html Mouse Locator Tool] to find the click points more easy. You just have to subtract the position of your RoM window (upper left corner) to get the relative values for within the RoM window. The values are depending from your screen resolution or windows size. They will be printed in the MicroMakro window at the start of the bot. As noted before, please insert them also into the function call.
+
or time based;<source lang="lua"> <!-- #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 )
 +
player.free_counter1 = player.BotStartTime_nr;
 +
load_paths("5-7_bugs_repair.xml");
 +
end
 +
</waypoint>
 +
</source>

Revision as of 15:12, 25 August 2009

For using the autorepair ingame, you need normaly to press the 'repair' button. You can do this by using the 'player:mouseclickL();' function within the bot. Or you just 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 open the ingame dialog window with a NPC with the function:

player:target_NPC( 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. It will also work while using multiple bots.

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 York Harris in Logar          -->
   <!-- For autorepairs without mouseclicks you need the addon 'Streamline' -->   
	<!-- # 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:rest(4);
		player:target_NPC("Tracy");
		player:rest(4);
		load_paths("5-7_bugs_repair_back");
   </waypoint>
</waypoints>

If the merchant is found, the store window would open and streamline will autorepair. After a short rest from 4 seconds, 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.

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>
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 )	
		player.free_counter1 = player.BotStartTime_nr;
		load_paths("5-7_bugs_repair.xml");
	end
	</waypoint>