Adding repair function

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
xtremeuser
Posts: 22
Joined: Thu Sep 30, 2010 8:25 pm

Adding repair function

#1 Post by xtremeuser » Thu Sep 30, 2010 8:36 pm

I know this has been covered but went through the forum, couldn't find the page, so started a new thread.

I like melee bots, more fun doing them up, but due to this, durability falls extremely quickly, as the title says, I wish to repair my weapons every so often.
The problem I see though is I use large waypoint files, which go far from the npc, so to make a return path would be difficult. Could it be inserted into the normal waypoint itself? Eg if say at waypoint 20 its close to a npc, at waypoint 20 could I do a check on durability of my items, if so, it then takes a dif path to the npc and repair. (I have pbinfo on to auto repair so got that part). This seems a much easier idea.

And of course if can help out how to do this easier :) thank you

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Adding repair function

#2 Post by rock5 » Thu Sep 30, 2010 10:21 pm

xtremeuser wrote:I know this has been covered but went through the forum, couldn't find the page, so started a new thread.

I like melee bots, more fun doing them up, but due to this, durability falls extremely quickly, as the title says, I wish to repair my weapons every so often.
The problem I see though is I use large waypoint files, which go far from the npc, so to make a return path would be difficult. Could it be inserted into the normal waypoint itself? Eg if say at waypoint 20 its close to a npc, at waypoint 20 could I do a check on durability of my items, if so, it then takes a dif path to the npc and repair. (I have pbinfo on to auto repair so got that part). This seems a much easier idea.

And of course if can help out how to do this easier :) thank you
It's not much different to what I've described elsewhere for single repair scripts except you repeat the steps near each npc.

Here is what I do. The diagram below is a section of a fictitious waypoint file.
RepairDiagram.jpg
At point 25 you check your durability or any other checks you might want to do. If you don't need to go to the npc then you jump to point 29 and continue with your regular route otherwise it will continue to the npc. A good idea when jumping is to use tags.

So part of your waypoint file might look something like this.,

Code: Select all

	<!-- #  24 --><waypoint x="xxxx" z="xxxx"> </waypoint>
	<!-- #  25 --><waypoint x="xxxx" z="xxxx">
		if inventory:getMainHandDurability() > 90 then -- don't need repair
			__WPL:setWaypointIndex(__WPL:findWaypointTag("skip1"));
		end
	</waypoint>
	<!-- #  26 --><waypoint x="xxxx" z="xxxx"> </waypoint>
	<!-- #  27 --><waypoint x="xxxx" z="xxxx">
		player:merchant("npc");
	</waypoint>
	<!-- #  28 --><waypoint x="xxxx" z="xxxx"> </waypoint>
	<!-- #  29 --><waypoint x="xxxx" z="xxxx" tag="skip1"> </waypoint>
	<!-- #  30 --><waypoint x="xxxx" z="xxxx"> </waypoint>
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

xtremeuser
Posts: 22
Joined: Thu Sep 30, 2010 8:25 pm

Re: Adding repair function

#3 Post by xtremeuser » Thu Sep 30, 2010 11:02 pm

This makes it clearer, thank you heaps, I figured was a way to execute in waypoints and not call upon a new waypoint file. If I have any troubles I pm you, but I'm sure through trial and error I can fix it up better than what I have at the moment.

Ok having some troubles. I been experimenting, I think something is just out of order. I post what im using, I did try a few different things before resorting to editing my post. Im presume its something simple... lol.

I removed most of the script, you dont need all the boring waypoints anyway I guess. As you can see it is a long path, but at waypoint 1 I wish it to check the dura before moving to waypoint 2 as per my attempt below. waypoint 2 to 18 as below is the travel to NPC to repair and back. and waypoint 32 has the tag to resume the original path.

As i said Im sure its simple...I checked the waypoints and moved some things around but still cant seem to get it. Once I had it go to waypoint 1, then just stay there, and millions of msgs in bot showing waypoint 1. So yeah.

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoint>

	<!-- #  1 --><waypoint x="xxxx" z="xxxx">	
	if inventory:getMainHandDurability() > 51 then -- don't need repair
         __WPL:setWaypointIndex(__WPL:findWaypointTag("normalpath"));
      end
</waypoint>
	<!-- #  2 --><waypoint x="xxxx" z="xxxx">	</waypoint>
	<!-- #  3 --><waypoint x="xxxx" z="xxxx">	</waypoint>


	<!-- # 16 --><waypoint x="4456" z="16664">		
		player:merchant("npcs name");
	</waypoint>
	<!-- # 17 --><waypoint x="xxxx" z="xxxx">	</waypoint>
	<!-- # 18 --><waypoint x="xxxx" z="xxxx">	</waypoint>


	<!-- # 32 --><waypoint x="xxxx" z="xxxx">  tag="normalpath">	</waypoint>
	<!-- # 33 --><waypoint x="xxxx" z="xxxx">	</waypoint>
	<!-- # 34 --><waypoint x="xxxx" z="xxxx">	</waypoint>

	<!-- # 127 --><waypoint x="xxxx" z="xxxx">	</waypoint>
	<!-- # 128 --><waypoint x="xxxx" z="xxxx">	</waypoint>
</waypoint>
Last edited by xtremeuser on Fri Oct 01, 2010 1:54 am, edited 1 time in total.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Adding repair function

#4 Post by rock5 » Fri Oct 01, 2010 1:47 am

First of all, always put code in code tags as per the forum rules.

Are you saying that when it reaches waypoint 1 it never leaves waypoint 1? Nothing in you're code explains why that would be happening.

No wait, I figured it out.

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoint>
is supposed to be

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
And the end

Code: Select all

<waypoint>
is supposed to be

Code: Select all

<waypoints>
Try that.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

xtremeuser
Posts: 22
Joined: Thu Sep 30, 2010 8:25 pm

Re: Adding repair function

#5 Post by xtremeuser » Fri Oct 01, 2010 1:57 am

Mmm cant believe I didnt spot that, and i fixed above post thanks.

Ok now a error,

functions.lua:281: attempt to perform arithmetic on local 'y2' <a string value>

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Adding repair function

#6 Post by rock5 » Fri Oct 01, 2010 2:06 am

xtremeuser wrote:Ok now a error,

functions.lua:281: attempt to perform arithmetic on local 'y2' <a string value>
Are you using the distance function anywhere? If so the format for it is,

Code: Select all

distance(x1, y1, x2, y2)
not

Code: Select all

distance("x1", "y1", "x2", "y2")
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

xtremeuser
Posts: 22
Joined: Thu Sep 30, 2010 8:25 pm

Re: Adding repair function

#7 Post by xtremeuser » Fri Oct 01, 2010 2:09 am

nope, the whole script pretty much is build as shown above, i try to keep it simple, less errors :)

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Adding repair function

#8 Post by rock5 » Fri Oct 01, 2010 2:25 am

Do you have any other functions running from your profile?

Also when do you get that error?
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

xtremeuser
Posts: 22
Joined: Thu Sep 30, 2010 8:25 pm

Re: Adding repair function

#9 Post by xtremeuser » Fri Oct 01, 2010 2:28 am

I copy and paste the default profile, and using that, just added the waypoint filename, adjusted distance to atk and loot, and of course add the skills to use thats it. I get the error at the start when running the bot, it scans inventory (loading items tables) then displays the error after that.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Adding repair function

#10 Post by rock5 » Fri Oct 01, 2010 2:37 am

xtremeuser wrote:I copy and paste the default profile, and using that, just added the waypoint filename, adjusted distance to atk and loot, and of course add the skills to use thats it. I get the error at the start when running the bot, it scans inventory (loading items tables) then displays the error after that.
That's strange. Did you maybe accidentally add a space to 1 of the distance values you set in the profile? eg. "200 " instead of "200".

The only other thing I can suggest is, is the bot upto date with no red icons next to the files?
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

xtremeuser
Posts: 22
Joined: Thu Sep 30, 2010 8:25 pm

Re: Adding repair function

#11 Post by xtremeuser » Fri Oct 01, 2010 2:55 am

I updated in case, was an update, but other files working fine. Anyway seems to work sorta fine now though, now 1 more error...lol.

Fight finished etc etc
We overrun waypoint #32, skip it and move on to #33

bot.lua:610: Failed to compile and run lua code for waypoint #33


Going back to my waypoints,

Code: Select all

	<!-- # 31 --><waypoint x="4074" z="15629">	</waypoint>
	<!-- # 32 --><waypoint x="4391" z="15589">  tag="normalpath">	</waypoint>
	<!-- # 33 --><waypoint x="4576" z="15604">	</waypoint>
I ran from a dif area, it went through the whole lot, got to waypoint 1, and froze, just spammed waypoint 1 again, even after i edited the S on the end of waypoints, start and end ones

xtremeuser
Posts: 22
Joined: Thu Sep 30, 2010 8:25 pm

Re: Adding repair function

#12 Post by xtremeuser » Fri Oct 01, 2010 7:28 am

made a new waypoint from scratch, and remembered where I wished to enter the check dura etc. Heres the 2nd example. It doesn't seem to like the code, I checked other pages, I seem to be following the same rules, so not sure why its not working. From waypoint 3, it cannot move on to waypoint 4 and no indication its doing a dura check in micro. If I load from a dif spot, eg from 28, it finds 28 but doesnt move onto 29, the one with the named tag. The rest of the code works fine, but its these 2 points. What am i missing

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
	<!-- #  1 --><waypoint x="3877" z="15980">	</waypoint>
	<!-- #  2 --><waypoint x="3960" z="16037">	</waypoint>
	<!-- #  3 --><waypoint x="4020" z="16057">	

	if inventory:getMainHandDurability() > 51 then -- don't need repair
         __WPL:setWaypointIndex(__WPL:findWaypointTag("normalpath"));
end

</waypoint>
	<!-- #  4 --><waypoint x="4019" z="16150">	</waypoint>
	<!-- #  5 --><waypoint x="4018" z="16261">	</waypoint>
	<!-- #  6 --><waypoint x="4017" z="16362">	</waypoint>


	<!-- # 28 --><waypoint x="4032" z="16040">	</waypoint>
	<!-- # 29 --><waypoint x="4035" z="15970">	tag="normalpath">	</waypoint>
	<!-- # 30 --><waypoint x="4041" z="15902">	</waypoint>
Last edited by xtremeuser on Fri Oct 01, 2010 9:16 pm, edited 1 time in total.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Adding repair function

#13 Post by rock5 » Fri Oct 01, 2010 8:00 pm

When you say it "doesn't move on" or "spammed waypoint 1", do you mean it does something like this in micro macro?

Code: Select all

Moving to waypoint #1, (3061, 30530)
Moving to waypoint #1, (3061, 30530)
Moving to waypoint #1, (3061, 30530)
Moving to waypoint #1, (3061, 30530)
Maybe you should copy&paste the micromacro display when the error or problem occurs.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Adding repair function

#14 Post by rock5 » Fri Oct 01, 2010 8:18 pm

Wait, I see the error.

Code: Select all

<!-- # 29 --><waypoint x="4035" z="15970"> tag="normalpath"> </waypoint>
You have an extra >. tag="normalpath" is part of the waypoint tag and need to be between the <>. So it should be;

Code: Select all

<!-- # 29 --><waypoint x="4035" z="15970" tag="normalpath"> </waypoint>
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

xtremeuser
Posts: 22
Joined: Thu Sep 30, 2010 8:25 pm

Re: Adding repair function

#15 Post by xtremeuser » Fri Oct 01, 2010 9:15 pm

Works fine now

Code: Select all

if inventory:getMainHandDurability() > 51 then -- don't need repair
Also noticed this is % of the weapon not the dura lol. So I changed accordingly after figuring it out. Thanks heaps.

xtremeuser
Posts: 22
Joined: Thu Sep 30, 2010 8:25 pm

Re: Adding repair function

#16 Post by xtremeuser » Sat Oct 02, 2010 2:39 am

Mmm maybe small but 1 more error.. sometimes at the end of the return pathway, it will repeat the return pathway, and not go to the normal waypoint file. eg at the end of return waypoint, it says continuing to waypoint 1...

Code: Select all

		<!-- Waypoint and movement settings -->
		<option name="WAYPOINTS"		value="main.xml" />  <!-- leave empty to show a list -->
		<option name="RETURNPATH"		value="return.xml" />
Normal waypoints, no additional code at all,

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
	<!-- #  1 --><waypoint x="10322" z="6988">	</waypoint>
	<!-- #  2 --><waypoint x="10215" z="6959">	</waypoint>
I added the autorepair to the return path on this one
RETURN.XML. (i couldnt get waypoint TRAVEL though due to how it came up, if can help with that too lol)

Code: Select all

<?xml version="1.0" encoding="utf-8"?> <waypoints>
	<!-- #  1 --><waypoint x="12218" z="5756">	</waypoint>
	<!-- #  2 --><waypoint x="12162" z="5868">	</waypoint>
etc etc
	<!-- #  7 --><waypoint x="12184" z="6499">
	if inventory:getMainHandDurability() > 80 then -- don't need repair
         __WPL:setWaypointIndex(__WPL:findWaypointTag("normalpath"));
end
</waypoint>
	<!-- #  8 --><waypoint x="12287" z="6488">	</waypoint>
etc
etc
	<!-- # 43 --><waypoint x="10561" z="6870">	</waypoint>
	<!-- # 44 --><waypoint x="10460" z="6919">	</waypoint>
</waypoints>
end of waypoint
From return waypoint file 44, it should move onto main waypoint

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints>
	<!-- #  1 --><waypoint x="10322" z="6988">	</waypoint>
	<!-- #  2 --><waypoint x="10215" z="6959">	</waypoint>
Instead it runs back to return.xml waypoint 1....

Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests