I need an example to revive/repair/return

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
L4G
Posts: 8
Joined: Wed Aug 19, 2009 4:41 pm

I need an example to revive/repair/return

#1 Post by L4G » Wed Aug 19, 2009 4:54 pm

Hi, first of all thanks for making a great bot like this.

Now, i want to ask you if you could post a full example script for when the bot dies it revive, go back to town, repair, maybe buy some potions/herbs and go back to fight.

Actually i can make the bot to revive and go back to fight sometimes, but i don't know how to tell it to count for example 2 hours and go back to town and repair, or die and go back to town and repair.

I have seen some little extracts of script code in the forum but not a full example of how and where to create/modify a script with this funcionality, i think it would be great if you can provide it.

Greetings !

User avatar
droppen
Posts: 179
Joined: Mon Aug 03, 2009 10:32 pm

Re: I need an example to revive/repair/return

#2 Post by droppen » Wed Aug 19, 2009 8:12 pm

L4G wrote:Hi, first of all thanks for making a great bot like this.

Now, i want to ask you if you could post a full example script for when the bot dies it revive, go back to town, repair, maybe buy some potions/herbs and go back to fight.

Actually i can make the bot to revive and go back to fight sometimes, but i don't know how to tell it to count for example 2 hours and go back to town and repair, or die and go back to town and repair.

I have seen some little extracts of script code in the forum but not a full example of how and where to create/modify a script with this funcionality, i think it would be great if you can provide it.

Greetings !
heh. too lazy to read around?

L4G
Posts: 8
Joined: Wed Aug 19, 2009 4:41 pm

Re: I need an example to revive/repair/return

#3 Post by L4G » Thu Aug 20, 2009 8:19 am

The point is... why not to have all this information in just 1 post instead of a lot of posts where you have search a lot and to copy/paste small sections.

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: I need an example to revive/repair/return

#4 Post by d003232 » Thu Aug 20, 2009 9:34 am

L4G wrote:The point is... why not to have all this information in just 1 post instead of a lot of posts where you have search a lot and to copy/paste small sections.
We would need someone, who writes that post. :mrgreen:
The RoM Bot Online Wiki needs your help!

master121
Posts: 45
Joined: Mon Dec 29, 2008 10:40 am

Re: I need an example to revive/repair/return

#5 Post by master121 » Sun Aug 23, 2009 4:35 am

Look at this.

j_schlott
Posts: 119
Joined: Tue Aug 18, 2009 11:42 pm

Re: I need an example to revive/repair/return

#6 Post by j_schlott » Sun Aug 23, 2009 3:36 pm

**************PLEASE DO NOT USE THIS IN A QUEST AREA OR ANY AREA THAT GETS A LOT OF TRAFFIC*******


to repair i made 2 files, yourmacropath.xml and yourrepairpath.xml
my macro path runs around a circle counting each mob, when it gets to 300 if runs the code below the counter, which i have set as calling the window to the foreground and keyboard presses of my recall button, it waits 20secs while the screen loads from recalling and then loads yourrepairpath.xml

yourmacropath.xml:
<waypoints>
<!-- # 1 --><waypoint x="" z="">
if( player.Fights-player.free_counter1 > 300 ) then <!--recall at 300 monsters-->
player.free_counter1 = player.Fights; <!--this code counts each mob-->
showWindow(getWin(), sw.show); <!--calls the window to foreground need for mouseclicks-->
player:rest(2);
keyboardPress(key.VK_7); <!--my recall button is in the position on spellbar #7-->
player:rest(20); <!--we wait while the screen loads from recalling-->
load_paths("yourrepairpath.xml"); <!--loads a repair path-->
end
</waypoint>
<!-- # 2 --><waypoint x="" z=""></waypoint> <!--macro path-->
<!-- # 3 --><waypoint x="" z=""></waypoint>
<!-- # 4 --><waypoint x="" z=""></waypoint>
<!-- # 5 --><waypoint x="" z=""></waypoint>
<!-- # 6 --><waypoint x="" z=""></waypoint>
<!-- # 7 --><waypoint x="" z=""></waypoint>
<!-- # 8 --><waypoint x="" z=""></waypoint>
<!-- # 9 --><waypoint x="" z=""></waypoint> <!--macro path-->
</waypoints>
obviously the recall has an 1 hr timer, so youll need to adjust how many mobs you kill before it tries to recall, or you can try this code to recall after a certain amount of time
replace:

Code: Select all

	if( player.Fights-player.free_counter1 > 300 ) then  <!--recall at 300 monsters-->
        player.free_counter1 = player.Fights;  <!--this code counts each mob-->
with:

Code: Select all

if( os.difftime(os.time(), player.BotStartTime) > 3660 ) then <!-- runs code after 1 hr 1min of macroing-->
if you do it by time, youll also need to add a timer reset in the code, i suggest right after teleporting, so it would liike like this:

Code: Select all

<!-- # 1 --><waypoint x="" z="">
	if( os.difftime(os.time(), player.BotStartTime) > 3660 ) then <!-- runs code after 1 hr 1min of macroing-->
	showWindow(getWin(), sw.show);  <!--calls the window to foreground need for mouseclicks-->
	player:rest(2); 
        keyboardPress(key.VK_7); <!--my recall button is in the position on spellbar #7-->
        player.BotStartTime = 0;    <!--RESTARTS TIMER-->
	player:rest(20);
if your nearest town doesnt have a teleporter you can run there instead of teleport
remove this from code:

Code: Select all

showWindow(getWin(), sw.show);  <!--calls the window to foreground need for mouseclicks-->
	player:rest(2); 
        keyboardPress(key.VK_7); <!--my recall button is in the position on spellbar #7-->
	player:rest(20);  <!--we wait while the screen loads from recalling-->
------------------------------------------------------------------------------------------------------------------------------

yourrepairpath.xml runs from teleporter to merchant, if you arent using a teleporter option, youll need to make waypoints from your macropath to the npc, instead of teleporter to npc

at the merchant i call the window to the foreground, needed for mouseclicks, you can download other addons that auto repair, but this works just aswell, youll need to adjust your mouseclicks to aim them at the right icons/chat options on screen, after it presses repair icon,

i have it set to buy potions too, this is tricky for now, we have it set to press a keyboard button (VK_6), which has an ingame macro, so youll need to go ingame and make a macro with this:

Code: Select all

/script StoreBuyItem(3, 99);
and place it in the correct keyslot, mines 6
this ingame macro will buy 99 items of whatever item is in position 3 on the merchant window, change these according to merchant, and how many items you want. if you need more pots than 99, just copy the keyboardpress code

Code: Select all

	
player:rest(.4);
keyboardPress(key.VK_6);
and duplicate it


after that mine runs back toward yourmacropath and then loads that macro

yourrepairpath.xml:

Code: Select all

<waypoints>
	<!-- # 1 --><waypoint x="" z="" type="RUN"></waypoint>    <!-- run from teleporter to merchant -->
	<!-- # 2 --><waypoint x="" z="" type="RUN"></waypoint>
	<!-- # 3 --><waypoint x="" z="" type="RUN"></waypoint>
	<!-- # 4 --><waypoint x="" z="" type="RUN">    <!-- make this waypoint aim at merchant -->
	showWindow(getWin(), sw.show);    <!-- calls window to foreground, needed for mouseclicks -->
	player:rest(2)
	player:target_NPC("YOUrNPCName");    <!-- this will open the chat dialog for merchant -->
	player:rest(1)
	player:mouseclickL(150, 220, 825, 582);   <!-- opens the shop window, youll have to run this and see where you clicks need to go -->
	player:rest(.4);   <!-- ^^ the 150 is left and right, left is low right is higher,  the 220 is up and down lower towards the top of screen-->
	player:mouseclickL(250, 380, 825, 582);   <!-- presses repair again you will need to adjust this, let the macro run once and see where it clicks--> 
	player:rest(.4);
        keyboardPress(key.VK_6);   <!-- this presses your spellbar button #6, in your slot 6 you need your buy macro--> 
	</waypoint>
	<!-- # 5 --><waypoint x="" z="" type="RUN"></waypoint>
	<!-- # 6 --><waypoint x="" z="" type="RUN"></waypoint>
	<!-- # 7 --><waypoint x="" z="" type="RUN"></waypoint>
	<!-- # 8 --><waypoint x="" z="" type="RUN"></waypoint>    <!-- i have mine set to run through mobs i dont want to kill -->
	<!-- # 9 --><waypoint x="" z="" type="RUN"></waypoint>
	<!-- #10 --><waypoint x="" z="" type="RUN"></waypoint>
	<!-- #11 --><waypoint x="" z="" type="RUN"></waypoint>
	<!-- #12 --><waypoint x="" z="" ></waypoint>            <!-- we get to my mobs here i do want to kill so i turn run off -->
	<!-- #13 --><waypoint x="" z="" ></waypoint>	   <!-- but we arent at my macro spot so we keep going -->
	<!-- #13 --><waypoint x="" z="" ></waypoint>
	<!-- #13 --><waypoint x="" z="" ></waypoint>
	<!-- #13 --><waypoint x="" z="" ></waypoint>
	<!-- #30 --><waypoint x="-35400" z="-17851">    <!-- we're close enough here to my macro spot, so ill reload the macro script -->
	load_paths( "yourmacropath.xml"); <!-- macro path --> 
	</waypoint>
</waypoints>
Last edited by j_schlott on Sun Aug 23, 2009 8:45 pm, edited 2 times in total.

j_schlott
Posts: 119
Joined: Tue Aug 18, 2009 11:42 pm

Re: I need an example to revive/repair/return

#7 Post by j_schlott » Sun Aug 23, 2009 5:49 pm

it isnt perfect yet, my macro runs through the first 300 mobs and recalls and repairs, but having watched it go over 600 monsters,

it tried to recalled, got a cooldown error because my recall had 15mins left, but the macro didnt know the cooldown wasnt up, and it waited 20seconds and ran across the map towards the teleporter

i think the easiest fix is make the recall a timed thing and have it set to over a hour so you dont get a cooldown error

hamncheese
Posts: 9
Joined: Tue Oct 27, 2009 9:13 pm

Re: I need an example to revive/repair/return

#8 Post by hamncheese » Tue Oct 27, 2009 9:46 pm

i dont know if my post are in the right section, but here goes
i have some problem trying to set the bot to do this :
- check main hand durability on waypoint 1
- if durability is 0.4 then use recall button (mine set on = )
- and load the repair paths
- after the bot finishes repair and shopping load the return paths

This is what happen after i run the macro (i include the last 2 kills of the bot) :

Code: Select all

Fight finished. Killed 7 Furious Bloodthristy Wolf. (fight #11 / runtime 5 minut
es)
Durability:0.78
Use MACRO: Looting target in distance 28.
Clearing target.
Waiting on aggressive enemies.
Engaging enemy [Furious Bloodthristy Wolf] in combat.
MACRO: Using MP potion 191/1027 (18%): Major Magic Potion (qty 61)
Use 2: DRUID_RECOVER       =>   Furious Bloodthristy Wolf (1007/1007)
Use 3: DRUID_BLOSSOMING_LIF=>   Furious Bloodthristy Wolf (1007/1007)
Use 4: DRUID_WEAKENING_SEED=>   Furious Bloodthristy Wolf (1007/1007)
Use 5: DRUID_BRIAR_ENTWINEM=>   Furious Bloodthristy Wolf (1007/1007)
Use 6: DRUID_EARTH_ARROW   =>   Furious Bloodthristy Wolf (876/1007)
Use 6: DRUID_EARTH_ARROW   =>   Furious Bloodthristy Wolf (744/1007)
Use 6: DRUID_EARTH_ARROW   =>   Furious Bloodthristy Wolf (227/1007)
Use 6: DRUID_EARTH_ARROW   =>   Furious Bloodthristy Wolf (0/1007)
Fight finished. Killed 8 Furious Bloodthristy Wolf. (fight #12 / runtime 5 minut
es)
Durability:0.77
Use MACRO: Looting target in distance 27.
Clearing target.
Moving to waypoint #25, (3546, 5285)
MACRO: Using MP potion 157/1027 (15%): Major Magic Potion (qty 60)
Clearing target.
Moving to waypoint #26, (3478, 5277)
Moving to waypoint #27, (3398, 5273)
Moving to waypoint #28, (3341, 5286)
Moving to waypoint #29, (3264, 5310)
Moving to waypoint #30, (3234, 5364)
Moving to waypoint #31, (3216, 5438)
Moving to waypoint #1, (3189, 5546)
...../micromacro/scripts/rom/classes/player.lua:1114: Failed to compile
and run Lua code for waypoint #1

Please enter the script name to run.
Type in 'exit' (without quotes) to exit.
Script>
so i figured theres something wrong inside the player.lua file line 1114 ?
and heres what inside that file on line 1114 (i didnt change anything inside player.lua from the fresh download) :

...../micromacro/scripts/rom/classes/player.lua (line 1112 to 1116)

Code: Select all

		if( waypoint.Action and type(waypoint.Action) == "string" ) then
			local actionchunk = loadstring(waypoint.Action);
			assert( actionchunk,  sprintf(language[150], __WPL.CurrentWaypoint) );
			actionchunk();
		end
here's my 3 xml filename :
14-16 Silverspring 52,47.xml
14-16 Silverspring 52,47_return.xml
Repair 14-16 Silverspring 52,47.xml

and my code within the file :
14-16 Silverspring 52,47.xml

Code: Select all

<waypoints>
	<!-- #  1 --><waypoint x="" z="">	
		if( player.free_flag1 == true ) then 
		player:rest(5);
		keyboardPress(key.VK_=);
		player:rest(20);
		load_paths("Repair 14-16 Silverspring 52,47.xml");
		end
		</waypoint>
	<!-- #  2 --><waypoint x="" z="">	</waypoint>
	<!-- #  3 --><waypoint x="" z="">	</waypoint>
	<!-- #  4 --><waypoint x="" z="">	</waypoint>
	<!-- #  5 --><waypoint x="" z="">	</waypoint>
Repair 14-16 Silverspring 52,47.xml (walks from the recall Dog npc --> merchant--> Dog npc)

Code: Select all

	<!-- # 24 --><waypoint x="" z="">	</waypoint>
	<!-- # 25 --><waypoint x="" z="">	player:merchant("Rose");
	</waypoint>
	<!-- # 27 --><waypoint x="" z="">	</waypoint>
	<!-- # 28 --><waypoint x="" z="">	</waypoint>
	
		load_paths("14-16 Silverspring 52,47.xml");
		</waypoint>
14-16 Silverspring 52,47_return.xml (contains a plain waypoints from Dog npc -->grinding area, without any additional code in it)

i hope i include every necessary info without making a clutter to the thread, thank you for anyone willing to read this :) and to anyone willing to help me with this i will love u long time :p
ps : Kudos to the Admin for making all this possible, reminds me a lot of the good old times with glider but Better :)

**sorry for the Edit, forgot 1 detail**
this is the code inside my Profile Folder
mycharname.xml

Code: Select all

	<onLeaveCombat>
		-- Additional Lua code to execute after killing an enemy
		local dura = CInventory:getMainHandDurability();
		printf("Durability:%s\n", dura);
		if( dura < 0.4 ) then
			player.free_flag1 = true;
		end

	</onLeaveCombat>

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: I need an example to revive/repair/return

#9 Post by d003232 » Wed Oct 28, 2009 1:54 am

The error means, something in the coding of your WP file is wrong. I suppose it is

Code: Select all

keyboardPress(key.VK_=);
because thats not a valid hotkey variable. That a look into the file '/micromacro/lib/mods/keyboard/en_us.lua' to find the valid variable for the key you want.

Instead of using the keypress, you could also use

Code: Select all

sendMacro(RoM API function);
and use the RoM API function 'Do_Teleport();' ??? to port (see here for a list of fuunctions..)

If you have dificulties to find the error in such a waypoint coding, it could also be helpful just to copy that coding into the normal player.lua just before the assertation to get a more excact error message from the lua interpreter (if you can handle a little lua code / editor).

And don't use

Code: Select all

player:rest(20);
for the loading screen waiting. Becaue that's not a real pause. The bot will still watch for aggro and could get memory reading errors. It is better to 'pause' the bot with

Code: Select all

yrest(20000);
The RoM Bot Online Wiki needs your help!

Post Reply

Who is online

Users browsing this forum: No registered users and 81 guests