Need help understanding Dura and Check BAg

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
AngelDrago
Posts: 133
Joined: Fri May 06, 2011 10:39 am

Need help understanding Dura and Check BAg

#1 Post by AngelDrago » Wed Mar 20, 2013 10:39 pm

hello everyone, i need help to understand how can i have check dura and if all the bags are full i got this from the DoDv4 and i tought it may work but its nor what i do wrong here see the script below

Code: Select all

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

<onLoad>
	dura = 97
	changeProfileOption("INV_AUTOSELL_ENABLE", "true")
	sellbag1 = true
	sellbag2 = true
	sellbag3 = true
	sellbag4 = true
	sellbag5 = true
	sellbag6 = true
	
	<!-- FUNCTION CHECKS STRUCTURE ARMS -->
		function checkdura()
			if ( dura > inventory:getMainHandDurability() ) 
				then __WPL:setWaypointIndex(__WPL:findWaypointTag("Nidus Linnu"))
			end
		end
		
	<!-- FUNCTION CHECK BAG -->
		function bag()
			local bcount = inventory:getItemCount(0)
			if(  5 > bcount ) 
				then __WPL:setWaypointIndex(__WPL:findWaypointTag("Nidus Linnu"))
			end
		end
	
</onLoad>

	<!-- #  1 --><waypoint x="-11659" z="41985" y="793">		player:merchant("Nidus Linnu");
	</waypoint>
	<!-- #  2 --><waypoint x="-11733" z="41979" y="787">	</waypoint>
	<!-- #  3 --><waypoint x="-11781" z="42030" y="786">	</waypoint>
	<!-- #  4 --><waypoint x="-11832" z="42127" y="785">	</waypoint>
	<!-- #  5 --><waypoint x="-11821" z="42237" y="768">	</waypoint>
	<!-- #  6 --><waypoint x="-11759" z="42275" y="759">	</waypoint>
	<!-- #  7 --><waypoint x="-11623" z="42353" y="732">	</waypoint>
	<!-- #  8 --><waypoint x="-11523" z="42418" y="715">	</waypoint>
	<!-- #  9 --><waypoint x="-11487" z="42502" y="700">	</waypoint>	
        <!-- # 10 --><waypoint x="-11807" z="42070" y="786">	</waypoint>
</waypoints>
Thanks for the help

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

Re: Need help understanding Dura and Check BAg

#2 Post by rock5 » Thu Mar 21, 2013 12:34 am

The "onload" is run once when the file is loaded. What your onload does is it changes some values then creates 2 functions "checkdura" and "bag". It does not run these functions. You would have to call them somewhere, either at waypoints or in your profile onleavecombat.

So for example you could add them to your waypoints

Code: Select all

   <!-- #  5 --><waypoint x="-11821" z="42237" y="768">
      checkdura()
      bag()
   </waypoint>
The next problem is your functions set the next waypoint as the one with the "tag" of "Nidus Linnu" but there is no waypoint with that tag. You can add the tag to the first waypoint

Code: Select all

   <!-- #  1 --><waypoint x="-11659" z="41985" y="793" tag="Nidus Linnu">      player:merchant("Nidus Linnu");
   </waypoint>
or because it's the first waypoint you could just use

Code: Select all

__WPL:setWaypointIndex(1)
instead. This assumes that it can walk in a straight line to the npc from any of the waypoints.
  • 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

AngelDrago
Posts: 133
Joined: Fri May 06, 2011 10:39 am

Re: Need help understanding Dura and Check BAg

#3 Post by AngelDrago » Sun Mar 24, 2013 9:50 pm

Thank you Rock5 for your input.. but it seems i s till having problems selling anything it does not sell at all and it does not check the dura as i have it set so it goes to 90 it should go to the merchant to get it repaired.

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

Re: Need help understanding Dura and Check BAg

#4 Post by rock5 » Sun Mar 24, 2013 11:41 pm

Try adding some print statements to see what is going on. Eg.

Code: Select all

   <!-- FUNCTION CHECKS STRUCTURE ARMS -->
      function checkdura()
         print("Dura is".. inventory:getMainHandDurability())
         if ( dura > inventory:getMainHandDurability() )
            then __WPL:setWaypointIndex(__WPL:findWaypointTag("Nidus Linnu"))
         end
      end
      
   <!-- FUNCTION CHECK BAG -->
      function bag()
         local bcount = inventory:getItemCount(0)
         print("Empty bag count is "..bcount)
         if(  5 > bcount )
            then __WPL:setWaypointIndex(__WPL:findWaypointTag("Nidus Linnu"))
         end
      end
And show us what your code looks like now, after the changes you have done.
  • 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

AngelDrago
Posts: 133
Joined: Fri May 06, 2011 10:39 am

Re: Need help understanding Dura and Check BAg

#5 Post by AngelDrago » Wed Mar 27, 2013 1:21 am

Thank you again rock5... below is the code

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
dura = 94
changeProfileOption("INV_AUTOSELL_ENABLE", "true")
sellbag1 = true
sellbag2 = true
sellbag3 = true
sellbag4 = true
sellbag5 = true
sellbag6 = true

<!-- FUNCTION CHECKS STRUCTURE ARMS -->
function checkdura()
print("Dura is".. inventory:getMainHandDurability())
if (94 > dura > inventory:getMainHandDurability() )
then __WPL:setWaypointIndex(__WPL:findWaypointTag("Nidus Linnu"))
end
end

<!-- FUNCTION CHECK BAG -->
function bag()
local bcount = inventory:getItemCount(0)
print("Empty bag count is "..bcount)
if( 5 > bcount )
then __WPL:setWaypointIndex(__WPL:findWaypointTag("Nidus Linnu"))
end
end

</onLoad>

<!-- # 1 --><waypoint x="3801" z="-8391" y="445"> player:merchant("Nidus Linnu");
</waypoint>
<!-- # 2 --><waypoint x="3844" z="-8506" y="443"> </waypoint>
<!-- # 3 --><waypoint x="3800" z="-8582" y="443"> </waypoint>
<!-- # 4 --><waypoint x="3668" z="-8733" y="438"> </waypoint>
<!-- # 5 --><waypoint x="3446" z="-8934" y="439"> </waypoint>
<!-- # 6 --><waypoint x="3255" z="-9042" y="440"> </waypoint>
<!-- # 7 --><waypoint x="3106" z="-9099" y="440"> </waypoint>
<!-- # 8 --><waypoint x="2653" z="-9245" y="445"> </waypoint>
<!-- # 9 --><waypoint x="2487" z="-9516" y="452"> </waypoint>
<!-- # 10 --><waypoint x="3813" z="-8392" y="445"> player:merchant("Nidus Linnu");
</waypoint>
<!-- # 11 --><waypoint x="3813" z="-8392" y="445"> </waypoint>
</waypoints>
I just checked the character and it is right now at 88% dura it should had gone to the merchant and get repaired and sell the stuff from the backpack but it has not done so so i really don't understand why its not working. thank you again for the help

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

Re: Need help understanding Dura and Check BAg

#6 Post by rock5 » Wed Mar 27, 2013 1:26 am

Looks like you didn't make any of the changes I told you to make. Instead of repeating myself, read this post again.
http://www.solarstrike.net/phpBB3/viewt ... 890#p48890

Then post your code again.
  • 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

AngelDrago
Posts: 133
Joined: Fri May 06, 2011 10:39 am

Re: Need help understanding Dura and Check BAg

#7 Post by AngelDrago » Wed Mar 27, 2013 10:24 pm

ok here is the error message i'm getting now..

GM detection started
We changed the option 'AUTO_ELITE_FACTOR' from '5' to '1000'.
We changed the option 'INV_AUTOSELL_ENABLE' from 'true' to 'true'.
Moving to waypoint #5, (3446, -8934)
Dura is100
Did not find any crashed game clients.
10:22pm - [string "..."]:14: attempt to compare number with boolean


AL lib: FreeContext: (00390E60) Deleting 1 Source(s)
Please enter the script name to run.
Type in 'exit' (without quotes) to exit.
Script>

and here is the code i'm not sure if i did it right do....

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
dura = 94
changeProfileOption("INV_AUTOSELL_ENABLE", "true")
sellbag1 = true
sellbag2 = true
sellbag3 = true
sellbag4 = true
sellbag5 = true
sellbag6 = true

<!-- FUNCTION CHECKS STRUCTURE ARMS -->
function checkdura()
print("Dura is".. inventory:getMainHandDurability())
if (94 > dura inventory:getMainHandDurability() )
then __WPL:setWaypointIndex(__WPL:findWaypointTag("Jahos Tindo"))
end
end

<!-- FUNCTION CHECK BAG -->
function bag()
local bcount = inventory:getItemCount(0)
print("Empty bag count is "..bcount)
if( 5 > bcount )
then __WPL:setWaypointIndex(__WPL:findWaypointTag("Jahos Tindo"))
end
end

</onLoad>

<!-- # 1 --><waypoint x="3801" z="-8391" y="445" tag="Jahos Tindo"> player:merchant("Jahos Tindo");
</waypoint>
<!-- # 2 --><waypoint x="3844" z="-8506" y="443"> </waypoint>
<!-- # 3 --><waypoint x="3800" z="-8582" y="443"> </waypoint>
<!-- # 4 --><waypoint x="3668" z="-8733" y="438"> </waypoint>
<!-- # 5 --><waypoint x="3446" z="-8934" y="439">
checkdura()
bag()
</waypoint>
<!-- # 6 --><waypoint x="3255" z="-9042" y="440"> </waypoint>
<!-- # 7 --><waypoint x="3106" z="-9099" y="440"> </waypoint>
<!-- # 8 --><waypoint x="2653" z="-9245" y="445"> </waypoint>
<!-- # 9 --><waypoint x="2487" z="-9516" y="452"> </waypoint>
<!-- # 10 --><waypoint x="3813" z="-8392" y="445"> player:merchant("Jahos Tindo");
__WPL:setWaypointIndex(1)
</waypoint>
<!-- # 11 --><waypoint x="3813" z="-8392" y="445"> </waypoint>
</waypoints>

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Need help understanding Dura and Check BAg

#8 Post by lisa » Wed Mar 27, 2013 10:57 pm

if (94 > dura inventory:getMainHandDurability() )
That should error saying failed to compile.
maybe you meant

Code: Select all

if (94 > inventory:getMainHandDurability() )
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

AngelDrago
Posts: 133
Joined: Fri May 06, 2011 10:39 am

Re: Need help understanding Dura and Check BAg

#9 Post by AngelDrago » Fri Mar 29, 2013 12:01 am

Thank you Lisa this did the fix for the boolean error but I'm not sure why its not going back to the merchant to get repaired or why it not going back if the backpack is full :cry: :| any help is very much appreciated. thank you

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

Re: Need help understanding Dura and Check BAg

#10 Post by rock5 » Fri Mar 29, 2013 3:34 am

You still haven't done everything I told you to do.

I'll try to explain it again. Maybe I wasn't explaining properly.

The "onload" section of the waypoint file executes only once at the start of execution. In your onload section it creates 2 functions. It does not run them. Once the functions are created they have to be run. When do you want them to run, ie. when do you want it to check the bag space and dura? At the moment they are not run.
  • 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
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Need help understanding Dura and Check BAg

#11 Post by lisa » Fri Mar 29, 2013 3:45 am

actually they are both run at waypoint 5

Code: Select all

<!-- # 5 --><waypoint x="3446" z="-8934" y="439">
 checkdura()
 bag()
 </waypoint>
Not being in code tags does make it harder to read though =(
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

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

Re: Need help understanding Dura and Check BAg

#12 Post by rock5 » Fri Mar 29, 2013 3:49 am

Ah missed them. Then I guess it should work, once it gets to waypoint 5. Maybe it gets caught up doing other things and never reaches waypoint 5?
  • 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
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Need help understanding Dura and Check BAg

#13 Post by lisa » Fri Mar 29, 2013 3:52 am

the last MM print he posted had this

Code: Select all

Moving to waypoint #5, (3446, -8934)
Dura is100
So it did the function but crashed, no idea what it's doing now as no new prints have been posted.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

AngelDrago
Posts: 133
Joined: Fri May 06, 2011 10:39 am

Re: Need help understanding Dura and Check BAg

#14 Post by AngelDrago » Sat Mar 30, 2013 8:52 am

Hello again, sorry to bug you all again with this but it seems not to be working for me so i would like to ask what other way is the best way to handle this. As rock5 said the onload is a function that needs to be called for it is their another way to add this in to the waypoint without the onload command. here below is the script again this time i re-created a waipoint with 10 waypoints and i set it up at number 9 that is where the character needs to stand and kill everything around. Thanks again for the help. ahh before i forget i made sure that everything is updated micromacro rev.43 and rom rev.576

<?xml version="1.0" encoding="utf-8"?><waypoints>
<onLoad>
dura = 94
changeProfileOption("INV_AUTOSELL_ENABLE", "true")
sellbag1 = true
sellbag2 = true
sellbag3 = true
sellbag4 = true
sellbag5 = true
sellbag6 = true

<!-- FUNCTION CHECKS STRUCTURE ARMS -->
function checkdura()
print("Dura is".. inventory:getMainHandDurability())
if (94 > inventory:getMainHandDurability() )
then __WPL:setWaypointIndex(__WPL:findWaypointTag("Jahos Tindo"))
end
end

<!-- FUNCTION CHECK BAG -->
function bag()
local bcount = inventory:getItemCount(0)
print("Empty bag count is "..bcount)
if( 5 > bcount )
then __WPL:setWaypointIndex(__WPL:findWaypointTag("Jahos Tindo"))
end
end

</onLoad>

<!-- # 1 --><waypoint x="3801" z="-8391" y="445" tag="Jahos Tindo"> player:merchant("Jahos Tindo");
</waypoint>
<!-- # 2 --><waypoint x="3844" z="-8506" y="443"> </waypoint>
<!-- # 3 --><waypoint x="3800" z="-8582" y="443"> </waypoint>
<!-- # 4 --><waypoint x="3668" z="-8733" y="438"> </waypoint>
<!-- # 5 --><waypoint x="3446" z="-8934" y="439"> </waypoint>
<!-- # 6 --><waypoint x="3255" z="-9042" y="440"> </waypoint>
<!-- # 7 --><waypoint x="3106" z="-9099" y="440"> </waypoint>
<!-- # 8 --><waypoint x="2653" z="-9245" y="445"> </waypoint>
<!-- # 9 --><waypoint x="2487" z="-9516" y="452">
checkdura()
bag()
</waypoint>
<!-- # 10 --><waypoint x="3813" z="-8392" y="445" tag="Jahos Tindo"> player:merchant("Jahos Tindo");
__WPL:setWaypointIndex(1)
</waypoint>
<!-- # 11 --><waypoint x="3813" z="-8392" y="445"> </waypoint>
</waypoints>

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

Re: Need help understanding Dura and Check BAg

#15 Post by rock5 » Sat Mar 30, 2013 9:32 am

Do you want it to check after every battle? We often use the profile onleavecombat for this. We can change it from the waypoint file. Try adding this to the waypoint onload.

Code: Select all

	if oldOnLeaveCombat == nil then oldOnLeaveCombat = settings.profile.events.onLeaveCombat end
	function settings.profile.events.onLeaveCombat()
		if oldOnLeaveCombat then oldOnLeaveCombat() end
		checkdura()
		bag()
	end
If you are having the problem that the mobs never run out because they respawn too fast, you might have to change the waypoint type to ignore mobs so it can head back. Add the following line to the bag and checkdura function.

Code: Select all

__WPL:setForcedWaypointType("RUN")
That means that at the npc or on the way back to waypoint 9 you will have to set it back to normal. So pick a waypoint and add.

Code: Select all

__WPL:setForcedWaypointType("NORMAL")
I hope that helps.
  • 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

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 2 guests