Page 1 of 1

Checking durability, how does it work ?

Posted: Sun Mar 28, 2010 10:00 pm
by krasi
Hello everyone, i followed the tutorials in the solarstrike wiki and was able to make a macro that will check the durability and made paths going to the vendor and back but i am not sure if the durability check is working.
In the bot window i can see that the bot shows how much the durability is but even when it drops below 0.8 the bot wont start the repair path.

Here is the code that checks the durability.

Code: Select all

	<onLeaveCombat>
	local dura = inventory:getMainHandDurability();
	printf("Durability:%s\n", dura);
	if( dura < 0.9 ) then
		player.free_flag1 = true;
	end
	</onLeaveCombat>
Could somebody tell me how the bot calculates the durability and what does 0.9 represent ?
Also what does this line do ?
if( dura < 0.9 ) then

If durability is lower then 0.9 then set flag true, is that what this line is and if it is then why wont the bot start the repair macro ?
Is it normal to see the durability like "0.8734573645876345 in the bot window ?

Thanks everyone :)

Re: Checking durability, how does it work ?

Posted: Sun Mar 28, 2010 11:58 pm
by rock5
krasi wrote:Could somebody tell me how the bot calculates the durability and what does 0.9 represent ?
0.9 represents the percentage of the max durability of an item. So if an item has a max durability of 125 and the current durability is 100 then dura will equal 100/125 = 0.8
krasi wrote:Also what does this line do ?
if( dura < 0.9 ) then
I believe < is equivalent to < so it equates to;
if( dura < 0.9 ) then

I think they use it because < doesn't seem to work. Don't know why. Maybe someone else can enlighten us. I usually just flip it around like so;
if( 0.9 > dura ) then
It has the same effect.
krasi wrote:If durability is lower then 0.9 then set flag true, is that what this line is and if it is then why wont the bot start the repair macro ?
You really should be reading the instructions properly. The tutorial you are talking about clearly shows 2 pieces code, 1 for the onLeaveCombat section and 1 for the waypoint file.

As you understand, what you have done is just changed the flag. In the waypoint where you want to go for repairs, you check the flag then loadPaths.

Personally I don't know why you would check durability after every fight if you only need it in the waypoint file when deciding to go for repairs.
It's probably better to just use this in the waypoint file;

Code: Select all

	local dura = inventory:getMainHandDurability();
	printf("Durability:%s\n", dura);
	if( dura < 0.9 ) then
		loadPaths("your_repair_path.xml");
	end
krasi wrote:Is it normal to see the durability like "0.8734573645876345 in the bot window ?
It's just showing you the current dura. If you don't want to see it just get rid of the printf statement.

Re: Checking durability, how does it work ?

Posted: Mon Mar 29, 2010 2:04 am
by krasi
I am sorry, i forgot to mention that i have completed everything as the tutorial says and i have the code in my waypoint file also.

This is my current waypoint file and it should work but after testing it for a few hours my weapon was at 40/111 durability and the bot never started the repair macro :(

I have no idea what i am doing wrong but it wont work.

Code: Select all

<waypoints>
	<!-- #  1 --><waypoint x="-28812" z="-20240">	</waypoint>
	<!-- #  2 --><waypoint x="-28578" z="-20090">	</waypoint>
	<!-- #  3 --><waypoint x="-28279" z="-19937">	</waypoint>
	<!-- #  4 --><waypoint x="-28057" z="-19825">	</waypoint>
	<!-- #  5 --><waypoint x="-27810" z="-19694">	</waypoint>
	<!-- #  6 --><waypoint x="-27709" z="-19768">	</waypoint>
	<!-- #  7 --><waypoint x="-27700" z="-19917">	</waypoint>
	<!-- #  8 --><waypoint x="-27730" z="-20086">	</waypoint>
	<!-- #  9 --><waypoint x="-27735" z="-20217">	</waypoint>
	<!-- # 10 --><waypoint x="-27741" z="-20436">	</waypoint>
	<!-- # 11 --><waypoint x="-27892" z="-20449">	</waypoint>
	<!-- # 12 --><waypoint x="-28103" z="-20485">	</waypoint>
	<!-- # 13 --><waypoint x="-28389" z="-20425">	</waypoint>
	<!-- # 14 --><waypoint x="-28525" z="-20272">	</waypoint>
	<!-- # 15 --><waypoint x="-28765" z="-20261">	</waypoint>
	if( player.free_flag1 == true ) then 
		player.free_flag1 = false; 
		loadPaths("Apeng_Dore_Repair.xml");
	end
</waypoints>
Thanks for all the help :) i really appreciate it.

Re: Checking durability, how does it work ?

Posted: Mon Mar 29, 2010 3:59 am
by rock5
krasi wrote:I am sorry, i forgot to mention that i have completed everything as the tutorial says and i have the code in my waypoint file also.

This is my current waypoint file and it should work but after testing it for a few hours my weapon was at 40/111 durability and the bot never started the repair macro :(

I have no idea what i am doing wrong but it wont work.

Code: Select all

<waypoints>
	<!-- #  1 --><waypoint x="-28812" z="-20240">	</waypoint>
	<!-- #  2 --><waypoint x="-28578" z="-20090">	</waypoint>
	<!-- #  3 --><waypoint x="-28279" z="-19937">	</waypoint>
	<!-- #  4 --><waypoint x="-28057" z="-19825">	</waypoint>
	<!-- #  5 --><waypoint x="-27810" z="-19694">	</waypoint>
	<!-- #  6 --><waypoint x="-27709" z="-19768">	</waypoint>
	<!-- #  7 --><waypoint x="-27700" z="-19917">	</waypoint>
	<!-- #  8 --><waypoint x="-27730" z="-20086">	</waypoint>
	<!-- #  9 --><waypoint x="-27735" z="-20217">	</waypoint>
	<!-- # 10 --><waypoint x="-27741" z="-20436">	</waypoint>
	<!-- # 11 --><waypoint x="-27892" z="-20449">	</waypoint>
	<!-- # 12 --><waypoint x="-28103" z="-20485">	</waypoint>
	<!-- # 13 --><waypoint x="-28389" z="-20425">	</waypoint>
	<!-- # 14 --><waypoint x="-28525" z="-20272">	</waypoint>
	<!-- # 15 --><waypoint x="-28765" z="-20261">	</waypoint>
	if( player.free_flag1 == true ) then 
		player.free_flag1 = false; 
		loadPaths("Apeng_Dore_Repair.xml");
	end
</waypoints>
Thanks for all the help :) i really appreciate it.
Ah, easy fix. The code has to be between waypoint open and close tags. Like this;

Code: Select all

	<!-- # 15 --><waypoint x="-28765" z="-20261">	
	if( player.free_flag1 == true ) then 
		player.free_flag1 = false; 
		loadPaths("Apeng_Dore_Repair.xml");
	end
	</waypoint>
I'm amazed how many people keep making that mistake, considering how many have posted with the same mistake. Anyway, you should be set go.

Re: Checking durability, how does it work ?

Posted: Mon Mar 29, 2010 1:58 pm
by krasi
Oh, i guess i didnt look at the brackets that close, i thought it was just after all the waypoints :D
Well i got it now and it seems to be working fine.

I was wandering if there is any way to chain spells like for example when i cast 3 holy strikes the next spell would be punishment, right now its working but my character keeps casting holy strike 6-7 times before he casts punishment.

Thanks for all the help :D