Page 1 of 1

Error after running bot for a while.

Posted: Fri Jun 14, 2013 6:05 pm
by duder77
Hi, I have made a small waypoint and loaded the default profile. Everything runs fine and then I will get a functions.lua:474: bad argument #7

I have the updated MicroMicro did updates and I even started from scratch. After I get this error, it will run the script again for a few second and repeat the error but it ran fine for an hour.

I looked and couldn't find any solution.

Thanks

Re: Error after running bot for a while.

Posted: Fri Jun 14, 2013 6:24 pm
by lisa
functions.lua:474: bad argument #7
There has to be more to the error.

Either way it will be either player.ExpPerMin or player.TimeTillLevel

As to why it is erroring, no idea, for now you could just use the userfunction I posted for the set window and see if that helps.
http://www.solarstrike.net/phpBB3/viewt ... =setwindow

Rock might have some idea as to why it is erroring.

Re: Error after running bot for a while.

Posted: Fri Jun 14, 2013 6:51 pm
by duder77
The full error line is
/scripts/rom/functions.lua:474: bad argument to 'string.format' (not a number in proper range)
Execution error: Runtime error
Loaded plugin "lxp'
executing script 'bot.lua'

Re: Error after running bot for a while.

Posted: Fri Jun 14, 2013 8:49 pm
by lisa
Ahh ok then it is deffinately the player.TimeTillLevel

I might do up a new char to test this, unfortunately it could be a lot of things =(

Seems weird to me it does it when you start the bot up again, all values should be gotten fresh.

Just use my userfunction I posted for now as it dissables the default setwindow code and uses my own.

Re: Error after running bot for a while.

Posted: Fri Jun 14, 2013 9:03 pm
by duder77
Once that error happens, I get it again and again. Strange that it will run a task fine and then get an error and then not allow the script to run for more than 5 seconds without the error again. It can run for an hour no problem...

Seems weird to me it does it when you start the bot up again, all values should be gotten fresh.

Re: Error after running bot for a while.

Posted: Fri Jun 14, 2013 9:05 pm
by duder77
lisa wrote:Ahh ok then it is deffinately the player.TimeTillLevel

I might do up a new char to test this, unfortunately it could be a lot of things =(

Seems weird to me it does it when you start the bot up again, all values should be gotten fresh.

Just use my userfunction I posted for now as it dissables the default setwindow code and uses my own.
Are you talking about the userfunction_setwindow.lua you posted? Or do you have a direct link?

Thanks so much for your help.... I've spent hours trying to figure this out.

Re: Error after running bot for a while.

Posted: Fri Jun 14, 2013 10:11 pm
by lisa
duder77 wrote:Are you talking about the userfunction_setwindow.lua you posted?
yes


Well I ran a new char for an hour on the WP included with bot to lvl up in pioneers, no error.

In your WP onload add this line

Code: Select all

atError(print(player.TimeTillLevel.." "..player.ExpPerMin));
So when the bot errors it will print those values, that is when not using my userfunction because my userfunction won't error ;)

Re: Error after running bot for a while.

Posted: Fri Jun 14, 2013 10:28 pm
by duder77
I have download your userfunction_setwindow.lua and placed it into the userfunctions folder and I would call it like this?

<waypoints type="travel">
<onLoad>
setwindow(whatever i want to track)
</onload>
xxx-my-waypoints-xxx
</waypoints>

Also, thank you so much for all your work on the forums! I have learned a lot from your posts and have enjoyed you scripts. I love the userfunction svn collection!! Very nice!

Thanks for all you help :)

Re: Error after running bot for a while.

Posted: Fri Jun 14, 2013 10:32 pm
by lisa
duder77 wrote:placed it into the userfunctions folder and I would call it like this?
yup
duder77 wrote: I love the userfunction svn collection
set window was in there, so no need to download it again if you already had it.
duder77 wrote:Thanks for all you help
Your welcome.

Re: Error after running bot for a while.

Posted: Sat Jun 15, 2013 1:57 am
by rock5
I don't have much to add except 'not a number in proper range' indicates that one of the values that it tried to use in the string.format was outside of the range -0x80000000 to 0x7FFFFFFF. I think this clearly indicates a failure to read a correct value from memory. Which one and why it failed, I don't know.

On second thought, it might not be a memory failure. The function only uses int memory reads which I believe can only return values within that range. Maybe one of the calculations is resulting in a number outside that range. For example if the ExpPerMin is very low, just a fraction of one, it could result in a number outside that range.

Although there is a check for that

Code: Select all

			if( player.TimeTillLevel > 9999 ) then
				player.TimeTillLevel = 9999;
			end
But that only checks for very big positive numbers, not negative numbers. You shouldn't normally get a negative value for the calculation for that value so we come back to failed memory reads.

Re: Error after running bot for a while.

Posted: Sat Jun 15, 2013 3:29 am
by lisa
Yeah I wanted to see what it had as the value for that number failure, which is why I posted the aterror code, might shine some light on it without having to spend hours trying to work out what numbers could cause it. Unfortunately the other numbers in the calculation are of course locals to the function itself so we couldn't do prints of them without altering the functions.lua file itself, I was hoping to avoid that.

Re: Error after running bot for a while.

Posted: Tue Jun 18, 2013 10:20 am
by nightdps
I noticed this happening when the player's current xp is greater than the xp it needs for the next level. In the past, when using an xp orb, the character doesn't level up to the correct level until you hit a couple mobs for it to recalculate the xp.

Re: Error after running bot for a while.

Posted: Tue Jun 18, 2013 11:26 am
by rock5
Oh, a fix for this didn't make it in my last commit. Too bad.

I'm looking at the code and I think the xp 'gain' could be calculated better. At the moment it's very prone to error because it doesn't handle level ups very well. I mean it doesn't include the last xp gained before leveling up, in it's calculations. If you use an experience orb that levels multiple levels it wont include any of that xp in it's calculations except the xp of the last level, not that it really matters. But to be more accurate I could easily have it calculate the exact xp difference between 2 xp levels eg. the difference between level 2 with 200 xp and level 5 with 50 xp.

I'm not sure yet whether I should even bother.

Re: Error after running bot for a while.

Posted: Sat Jul 27, 2013 3:55 am
by Flexo85
Hey guys i had the same problem with my bot when im lvl 80 and have more exp then needed for lvl up. By gathering. I fixed it but the exp calc will probably wont be correct. But atleast you dont get errors

Code: Select all

player.ExpPerMin = expGainSum / ( valueCount * player.ExpUpdateInterval / 60 );
			if( player.ExpPerMin <= 0 ) then -- edited from original
			    player.ExpPerMin = 1; -- edited from original
			end
			
				player.TimeTillLevel = (maxExp - newExp) / player.ExpPerMin;
			if( player.TimeTillLevel > 9999 or player.TimeTillLevel <= 0 ) then -- edited from original
				player.TimeTillLevel = 9999;
			end
first time posting so not really sure if the code will appear good

Re: Error after running bot for a while.

Posted: Sat Jul 27, 2013 8:59 am
by rock5
A fix for the error was included in rev 761. Update and see if it fixes it for you.