Log in

View Full Version : Knight Bot does not refill as many potions as needed.



Okrzem
10-31-2014, 10:05 PM
Hello guys,
some time ago my script started having some strange issues, from getting stuck to not refilling the mana potions.
And the biggest problem is not refilling or refilling not enough potions, it's like it withdraws too less money, and buys potions for half of the current money I got in bp.
For example:
Bot has "maxManas = 400", which tells it to refill to 400 manas.
Instead of refilling to 400, it refills to ~280, usually depends, but the ammount of potions is always at least two times lower than should be.
The script is for killer caimans, it's been working really irreproachable before. I guess one of the lastest tibia versions could bug it.
I tried fixing on my own, but zero results. Hope you guys will find where's the deffect.
Here's the paste bin of script:
http://pastebin.com/yd1udQBD

edit:
By the way, here's how it looks right after refilling.
http://i.imgur.com/PDexHl3.png

Mandeel
10-31-2014, 10:39 PM
Ermm are you sure u have enough cap?

Okrzem
10-31-2014, 11:19 PM
If I had not enough cap I wouldn't use the script, it deposits gold/items first then goes to withdraw and then refill.
Btw It's 166 ek, don't think I'll ever miss cap on him :D

Spectrus
11-01-2014, 12:23 AM
You have to take the max value between (maxHealths - Self.ItemCount(healthID)) and 0.

You have more than your max setting, so it's calculating a negative value for how much money to withdraw for health potions. This deducts from the amount needed to withdraw for mana potions, which results in you not withdrawing enough to buy your manas.

Okrzem
11-01-2014, 01:19 AM
You have to take the max value between (maxHealths - Self.ItemCount(healthID)) and 0.

You have more than your max setting, so it's calculating a negative value for how much money to withdraw for health potions. This deducts from the amount needed to withdraw for mana potions, which results in you not withdrawing enough to buy your manas.

Okay, I've done this. Let's see how will it work, thanks a lot anyway!
Guess there is no possibility to reward your reply?

Spectrus
11-01-2014, 08:26 AM
Okay, I've done this. Let's see how will it work, thanks a lot anyway!
Guess there is no possibility to reward your reply?

Just let me know if it works and help others if you can ;)

Okrzem
11-01-2014, 11:32 AM
Just let me know if it works and help others if you can ;)

Aighty, works perfectly! Once I wanted to change maxHealths to 28 but was too lazy to do it, to be honest :D