Page 1 of 1
Need help with autoRepair
Posted: Wed Mar 31, 2010 5:00 am
by jason404
Hello, Im trying to make my script to go back to town by using recall after an hour of playing.
But currently im having a problem, when it reaches waypoint 13 the bot stop and receives this problem.
<!-- # 13 --><waypoint x="-16112" z="-604">
if(player.free_counter1 == 0) then player.free_counter1 = os.time(); end;
if( os.difftime(os.time(), player.free_counter1) > 3600 )
player.free_counter1 = os.time();
player:rest(1);
RoMScript("UseSkill(=);"); --recall
yrest(40000); --wait while load screen
loadPaths("37repair.xml");
end
</waypoint>
This is my first time trying to make a repair waypoint. The repair and return waypoint works fine but only having a problem with the above.
Re: Need help with autoRepair
Posted: Wed Mar 31, 2010 5:05 am
by rock5
Code: Select all
if( os.difftime(os.time(), player.free_counter1) > 3600 )
You forget the 'then'.
Re: Need help with autoRepair
Posted: Wed Mar 31, 2010 5:15 am
by jason404
Thanks so far its solved that problem now, time to test it out to see if the repair works successful.
Edit: Just wondering how do I use weak potions first instead of using the stronger ones.
Do I change the "best" to "worst"?
<option name="USE_HP_POTION" value="best" /> <!-- potion select strategy: best|minstack -->
<option name="USE_MANA_POTION" value="best" /> <!-- potion select strategy: best|minstack -->
Also was wondering i've made my bot to go to the repair point after killing 300 monsters. Does that mean if it kills another 300 monters it will go to the repair point again or would i have to add another script to make it go to the repair point after 600 monsters.
Re: Need help with autoRepair
Posted: Wed Mar 31, 2010 2:40 pm
by Administrator
If you reset the counter back to zero when you return, it will go kill another 300 and then go repair again.
Re: Need help with autoRepair
Posted: Wed Mar 31, 2010 4:26 pm
by jason404
Sorry if its a dumb question but how would I go on about to reset the counter? What command would i have to put?
Re: Need help with autoRepair
Posted: Wed Mar 31, 2010 4:47 pm
by Administrator
You tell me. I have no idea what you've done so far.
Re: Need help with autoRepair
Posted: Wed Mar 31, 2010 5:05 pm
by jason404
Well so far i've made it my script so when it reaches 380 kills it loads the repair script and goes back to town and repairs my armor
<!-- # 17 --><waypoint x="-15995" z="-834">
if( player.Fights-player.free_counter1 > 380 ) then
player.free_counter1 = player.Fights;
player:rest(1);
loadPaths("37repair.xml");
end
</waypoint>
It loads this script.
<!-- # 10 --><waypoint x="-13751" z="-349">
player:merchant("Jacques");
player:rest(4);
</waypoint>
<!-- # 11 --><waypoint x="-13793" z="-294"> </waypoint>
<!-- # 28 --><waypoint x="-15534" z="-174">
loadPaths("37.xml");
</waypoint>
Re: Need help with autoRepair
Posted: Wed Mar 31, 2010 5:19 pm
by Administrator
player.Fights-player.free_counter1
Those are the two variables you're using, so:
Code: Select all
player.Fights = 0;
player.free_counter1 = 0;
Re: Need help with autoRepair
Posted: Wed Mar 31, 2010 6:30 pm
by jason404
So I would change it like this? Sorry its just im not that experience at using this yet.
<!-- # 17 --><waypoint x="-15995" z="-834">
if( player.Fights-player.free_counter1 > 380 ) then
player.free_counter1 = 0; player.Fights = 0;
player:rest(1);
loadPaths("37repair.xml");
end
</waypoint>
Re: Need help with autoRepair
Posted: Wed Mar 31, 2010 7:16 pm
by Administrator
Yes.
Re: Need help with autoRepair
Posted: Wed Mar 31, 2010 8:07 pm
by jason404
Thanks lets hope it works fine.
Re: Need help with autoRepair
Posted: Thu Apr 01, 2010 7:05 am
by rock5
jason404 wrote:So I would change it like this? Sorry its just im not that experience at using this yet.
<!-- # 17 --><waypoint x="-15995" z="-834">
if( player.Fights-player.free_counter1 > 380 ) then
player.free_counter1 = 0; player.Fights = 0;
player:rest(1);
loadPaths("37repair.xml");
end
</waypoint>
Um... I think this change wasn't necessary. It would have worked the way it was.
Just to help you understand what's happening player.Fights gets incremented after every fight. player.free_counter1 holds the number of fights when you went back for repairs. So to see how many fights you've had since going back for repairs you look at the difference which is player.Fights - player.free_counter1.
Normally you do it this way so you can keep the overall number of fights in player.Fights. But if you are going to reset player.Fights to 0 anyway, you might as well just use that. Like this;
Code: Select all
<!-- # 17 --><waypoint x="-15995" z="-834">
if( player.Fights > 380 ) then
player.Fights = 0;
player:rest(1);
loadPaths("37repair.xml");
end
</waypoint>