Page 4 of 5
Re: ----===== new revision of Patch 4.0.6.2483 =====----
Posted: Sat Dec 31, 2011 1:04 pm
by rock5
I just had an idea. Maybe the problem is with memoryreadrepeat.
I believe your line 26 is now
Code: Select all
tmp = memoryReadRepeat("uint", proc, self.Address + addresses.pawnId_offset) or 0;
Try changing it to
Code: Select all
tmp = memoryReadUInt(proc, self.Address + addresses.pawnId_offset) or 0;
I think memoryreadrepeat
has to succeed or else it errors. If a read might fail we have to use the regular memoryread functions and then check that we got a valid value.
Re: ----===== new revision of Patch 4.0.6.2483 =====----
Posted: Sat Dec 31, 2011 3:23 pm
by cufRet8e
Runtime 107 minutes and no crash so far! I'll continue testing.
Thank you and Happy New Year!:)
EDIT: I was testing 2 bots for couple of hours. Your latest modification make a very big difference, thank you. No more crashes with line 26

I caught only one:
Code: Select all
Did not find any crashed game clients.
0:45am - X:/Programs/micromacro/scripts/rom/classes/pawn.lua:241: Error in memory reading
Re: ----===== new revision of Patch 4.0.6.2483 =====----
Posted: Sat Dec 31, 2011 11:14 pm
by rock5
Try the same thing on that line. Change it to
Code: Select all
tmp = memoryReadUInt(proc, self.Address + addresses.pawnId_offset) or 0;
Re: ----===== new revision of Patch 4.0.6.2483 =====----
Posted: Sat Dec 31, 2011 11:43 pm
by rock5
Also, if this is the solution to all your problems then could you try without some of the earlier changes?
Restore:
Add to line 372 of pawn.lua
Code: Select all
tmp = memoryReadRepeat("byteptr",proc, self.Address + addresses.pawnSwim_offset1, addresses.pawnSwim_offset2)
self.Swimming = (tmp == 3 or tmp == 4)
Delete lines 2684-2689 of player.lua
Code: Select all
-- Swimming wont change if it can't be read.
local swimoffset1 = memoryReadRepeat("int",getProc(), self.Address + addresses.pawnSwim_offset1)
if swimoffset1 ~= nil and swimoffset1 ~= 0 then
tmp = memoryReadRepeat("byte",getProc(), swimoffset1 + addresses.pawnSwim_offset2)
self.Swimming = (tmp == 3 or tmp == 4)
end
I think the other changes can stay. I'm thinking of changing other values too when it detects an invalid object or pawn. Maybe set .Name = "" and Type = TP_NONE. Actually it would be good to reset it all to default values but I don't think it can be done from within :update(). Hm... I'll think a bit more on th details.
Re: ----===== new revision of Patch 4.0.6.2483 =====----
Posted: Sun Jan 01, 2012 5:03 am
by cufRet8e
OK, reverted as you said. After 10 minutes:
Code: Select all
10:2am - X:/Programs/micromacro/scripts/rom/classes/pawn.lua:372: Error in memory reading
Crashes again and again, average time 5 minutes, always same error.
I copy those two files again as they were before, now running for 52 minutes no crash yet:)
Re: ----===== new revision of Patch 4.0.6.2483 =====----
Posted: Sun Jan 01, 2012 7:50 am
by cufRet8e
Found a typo:
Code: Select all
Moving in | Suggested range: 50 | Distance: 115
No more usable HP Phirius potsMACRO: Using HP potion 259/764 (33%): Prosta Mikstura Pierws
zej Pomocy (qty 86)
No new line character after message "No more usable HP Phirius pots". Those messages are coded in player.lua.
Re: ----===== new revision of Patch 4.0.6.2483 =====----
Posted: Sun Jan 01, 2012 8:02 am
by rock5
cufRet8e wrote:Crashes again and again, average time 5 minutes, always same error.
I was hoping we wouldn't get this error anymore. I guess it doesn't hurt to leave those changes in.
cufRet8e wrote:No more usable HP Phirius potsMACRO: Using HP potion 259/764 (33%): Prosta Mikstura Pierws
zej Pomocy (qty 86)
This is the line.
Code: Select all
cprintf(cli.yellow, "No more usable HP Phirius pots", inventory.MaxSlots);
A "/n" can be added easy enough. Not sure what was intended with the "inventory.MaxSlots". At the moment it does nothing. Maybe it was meant to be printed but I can't see why.
Re: ----===== new revision of Patch 4.0.6.2483 =====----
Posted: Sun Jan 01, 2012 8:23 am
by cufRet8e
I guess it should be added to language[] table, and formatted like all other messages about HP/MP potions:
Code: Select all
cprintf(cli.yellow, language[19], inventory.MaxSlots); -- No more (usable) mana potions
Added to language tables english.lua:
Code: Select all
[19] = "No more (usable) Phirius MP potions available at bagslot 1 to %d\n",
And then translated to all languages. Because atm those messages are untranslated and always english.
BTW. Are you going to push those changes about crashes to SVN? Now, after your fixes it works like a charm.
Re: ----===== new revision of Patch 4.0.6.2483 =====----
Posted: Sun Jan 01, 2012 8:32 am
by rock5
I figure when someone want to add translations they can easily add it. Not much point adding it to the english language file if no one is there to translate it.
I'll include those changes in my next commit. There are still some other changes I've made that I want to clean up before committing.
Re: ----===== new revision of Patch 4.0.6.2483 =====----
Posted: Sun Jan 01, 2012 8:38 am
by cufRet8e
I'll do it. It's just 6 languages and 2 basic messages. Give me a minute

Re: ----===== new revision of Patch 4.0.6.2483 =====----
Posted: Sun Jan 01, 2012 8:41 am
by rock5
Wow do you speak 6 languages? If so there are probably lots of messages that still need translating

Re: ----===== new revision of Patch 4.0.6.2483 =====----
Posted: Sun Jan 01, 2012 8:48 am
by rock5
By the way this is wrong "No more (usable) Phirius MP potions available at bagslot 1 to %d\n". I check "bestavailablephirius". It doesn't use "maxslot". It searches all slots.
Re: ----===== new revision of Patch 4.0.6.2483 =====----
Posted: Sun Jan 01, 2012 8:58 am
by cufRet8e
Code: Select all
Did not find any crashed game clients.
1:43pm - X:/Programs/micromacro/scripts/rom/classes/pawn.lua:626: Error in memory reading
Only one founded from long, long time
Code: Select all
local tmpTargetPtr = memoryReadRepeat("int", getProc(), self.Address + addresses.pawnTargetPtr_offset) or 0
Same problem, isn't? I guess this can be changed to use of memoryReadUInt();?
rock5 wrote:By the way this is wrong "No more (usable) Phirius MP potions available at bagslot 1 to %d\n". I check "bestavailablephirius". It doesn't use "maxslot". It searches all slots.
So how it should be then?
rock5 wrote:Wow do you speak 6 languages? If so there are probably lots of messages that still need translating

No, I am not, but Google Translate does:) I was thinking only about this particular message. But yeah, I look into language files, and really, some messages are missing. But this is a problem for those, who speak that languages. My native language is polish, but I am very happy using english version of rombot.
Re: ----===== new revision of Patch 4.0.6.2483 =====----
Posted: Sun Jan 01, 2012 9:10 am
by lisa
You don't want the looking for best available pot to check all slots?
You want it to only check within the range set by profile?
Lol I fixed the mana pots line today, forgot to check the hp pot line.
Re: ----===== new revision of Patch 4.0.6.2483 =====----
Posted: Sun Jan 01, 2012 9:31 am
by cufRet8e
Another one. So we have 2 rare crashes now:
Code: Select all
1:43pm - X:/Programs/micromacro/scripts/rom/classes/pawn.lua:626: Error in memory reading
Code: Select all
2:28pm - ...:/Programs/micromacro/scripts/rom/classes/player.lua:260: Error in memory reading
Re: ----===== new revision of Patch 4.0.6.2483 =====----
Posted: Sun Jan 01, 2012 9:39 am
by rock5
cufRet8e wrote:Same problem, isn't? I guess this can be changed to use of memoryReadUInt();?
We can't go around changing all the memoryreadrepeats. I wonder in there is a basic flaw in memoryreadrepeat erroring when it fails. Maybe it should return nil. I'm not sure.
Bugger, I just had another look at memoryreadrepeat and it only errors if "settings.options.DEBUGGING" is true. Do you have debugging enabled?
cufRet8e wrote:I look into language files, and really, some messages are missing.
The way the bot works is it loads the English file first which
should have all the messages then loads the local language file which overwrites the English messages. If there are any missing messages then it still has the English version. If you want to do some Polish translation just add the messages missing by looking at the English one and translating it.
Re: ----===== new revision of Patch 4.0.6.2483 =====----
Posted: Sun Jan 01, 2012 9:46 am
by lisa
rock5 wrote:Bugger, I just had another look at memoryreadrepeat and it only errors if "settings.options.DEBUGGING" is true. Do you have debugging enabled?
That might explain why not everyone is having the same issue.
That does prove though that the memoryreadrepeat does fail, question is why would it fail?
Re: ----===== new revision of Patch 4.0.6.2483 =====----
Posted: Sun Jan 01, 2012 9:53 am
by cufRet8e
rock5 wrote:
Bugger, I just had another look at memoryreadrepeat and it only errors if "settings.options.DEBUGGING" is true. Do you have debugging enabled?
Kill me, but yes -_-'
Can you enable it and see what happens to your rombot? This may be source of all those crashes.
lisa wrote:That might explain why not everyone is having the same issue.
That does prove though that the memoryreadrepeat does fail, question is why would it fail?
Yeah, looks pretty clear now. That's was the reason.
But, at least, I believe this may be useful to investigate errors with this memoryreadrepeat function.
Thanks you two for your involvement in fixing this!
Re: ----===== new revision of Patch 4.0.6.2483 =====----
Posted: Sun Jan 01, 2012 9:56 am
by lisa
on the language subject, I just did some searching and counted 50 print messages in default bot files that don't use the language number system, don't know about you but I don't have the time to change all of them to use the language system.
Re: ----===== new revision of Patch 4.0.6.2483 =====----
Posted: Sun Jan 01, 2012 10:03 am
by rock5
lisa wrote:That does prove though that the memoryreadrepeat does fail, question is why would it fail?
I'd say it's mostly when things don't exist anymore or it could be anything really. It may be related to certain values, such as the swim value. Important thing is if it works ok with debugging off. I think the reason it might have been set up to error when debugging is on, is to help catch the errors. If you enable debugging to look for errors, you don't want to miss them as they scroll off the top of the screen.
cufRet8e wrote:Can you enable it and see what happens to your rombot? This may be source of all those crashes.
Problem is I mainly just do cot and survival. I wouldn't want it to crash in the middle of those. I'll see what I can do tomorrow.