Page 1 of 1
bot stuck at player adress changed
Posted: Fri Nov 27, 2015 1:52 pm
by Ego95
I have got a problem I have for about 2 years. In some cases the bot gets stuck when changing the player adress:
Code: Select all
Drücke MACRO: RoMScript ausführen "LeaveBattleGround_and_CloseFrames()".
Spieleradresse geändert: 0x33F81E00
In one script it gets stuck random when changing class at housemaids, but with the arcanium arena script from
http://www.solarstrike.net/phpBB3/viewt ... =21&t=6212 it gets stuck always after leaving the arena. The bot simply doesnt do anything then.
Re: bot stuck at player adress changed
Posted: Fri Nov 27, 2015 3:04 pm
by BlubBlab
maybe you could add some print in the player:update() ?
Re: bot stuck at player adress changed
Posted: Sat Nov 28, 2015 2:10 pm
by Ego95
In which player:update() ? I thought a little bit about my problem and it has nothing to do with the arcanium arena, but with changing classes generally. When doing arcanium arena, your char changes into duelist and at the end back to your class. Had the same problem when changing class at housemaids with the bot. Player adress gets updated and then nothing happens.
Should be something here, where it gets stuck in a loop
Code: Select all
function CPlayer:update()
local addressChanged = false
-- Ensure that our address hasn't changed. If it has, fix it.
-- Read the address
local tmpAddress = memoryReadRepeat("uintptr", getProc(), addresses.staticbase_char, addresses.charPtr_offset) or 0;
-- Bad read, return
if tmpAddress == 0 then
return
end
-- Check that it's a valid address by checking the id
local tmpId = memoryReadRepeat("uint", getProc(), tmpAddress + addresses.pawnId_offset) or 0
if not tmpId or tmpId < PLAYERID_MIN or tmpId > PLAYERID_MAX then
-- invalid address
return
end
-- Else address good. If changed, update.
if( tmpAddress ~= self.Address) then
self.Address = tmpAddress;
cprintf(cli.green, language[40], self.Address);
addressChanged = true
if self.Class1 == CLASS_WARDEN then
setpetautoattacks()
end
end;
local oldClass1 = self.Class1
local oldClass2 = self.Class2
CPawn.update(self); -- run base function
local classChanged = self.Class1 ~= oldClass1 or self.Class2 ~= oldClass2
local newLoad = settings.profile.skills == nil
-- Check if we need to load the skill set.
if next(settings.profile.skillsData) ~= nil then -- The skills are ready to be loaded
if addressChanged or classChanged or newLoad then
settings.loadSkillSet(self.Class1)
if newLoad then
-- Reset editbox false flag on start up
if memoryReadUInt(getProc(), addresses.editBoxHasFocus_address) == 0 then
RoMCode("z = GetKeyboardFocus(); if z then z:ClearFocus() end")
end
end
if classChanged and self.TargetPtr ~= 0 then
self:clearTarget()
end
addressChanged = false
end
end
Re: bot stuck at player adress changed
Posted: Sat Nov 28, 2015 2:16 pm
by BlubBlab
Ego95 wrote:In which player:update() ? I thought a little bit about my problem and it has nothing to do with the arcanium arena, but with changing classes generally. When doing arcanium arena, your char changes into duelist and at the end back to your class. Had the same problem when changing class at housemaids with the bot. Player adress gets updated and then nothing happens.
I mean logically the one in player.lua every time the address of the player gets updated it is what's running, so I would start there searching for the problem.
Code: Select all
-- Bad read, return
if tmpAddress == 0 then
return
end
I would change that code naturally the bot gets stuck with this.
Re: bot stuck at player adress changed
Posted: Sat Nov 28, 2015 2:21 pm
by BlubBlab
Maybe change it into a loop or at least give an error message.
Re: bot stuck at player adress changed
Posted: Sat Nov 28, 2015 2:25 pm
by Ego95
Okay, this is the part I put a print too. I will look what happens
Re: bot stuck at player adress changed
Posted: Sat Nov 28, 2015 2:38 pm
by BlubBlab
Ego95 wrote:Okay, this is the part I put a print too. I will look what happens
Originally I meant every codeblock but at first glance there is a very good chance that is it but only when you don't see a print where the address change in your MM.
The reason
is it doesn't throw an error when that happen and th bot will try to access countless invalid addresses.
Re: bot stuck at player adress changed
Posted: Mon Nov 30, 2015 2:01 pm
by Ego95
Code: Select all
-- Bad read, return
if tmpAddress == 0 then
cprintf(cli.red, "Error 1");
return
end
-- Check that it's a valid address by checking the id
local tmpId = memoryReadRepeat("uint", getProc(), tmpAddress + addresses.pawnId_offset) or 0
if not tmpId or tmpId < PLAYERID_MIN or tmpId > PLAYERID_MAX then
-- invalid address
cprintf(cli.red, "Error 2");
return
end
-- Else address good. If changed, update.
if( tmpAddress ~= self.Address) then
self.Address = tmpAddress;
cprintf(cli.green, language[40], self.Address);
addressChanged = true
if self.Class1 == CLASS_WARDEN then
setpetautoattacks()
end
end;
So I dont get any of those two prints, but that doesnt help me because it gets stuck after the "cprintf(cli.green, language[40], self.Address);" Well, otherwise it wouln't help me either, because I don't understand the bot's basics. I dont do much with lua, so its nothing I could fix.
Re: bot stuck at player adress changed
Posted: Mon Nov 30, 2015 2:22 pm
by BlubBlab
Ego95 wrote:Code: Select all
-- Bad read, return
if tmpAddress == 0 then
cprintf(cli.red, "Error 1");
return
end
-- Check that it's a valid address by checking the id
local tmpId = memoryReadRepeat("uint", getProc(), tmpAddress + addresses.pawnId_offset) or 0
if not tmpId or tmpId < PLAYERID_MIN or tmpId > PLAYERID_MAX then
-- invalid address
cprintf(cli.red, "Error 2");
return
end
-- Else address good. If changed, update.
if( tmpAddress ~= self.Address) then
self.Address = tmpAddress;
cprintf(cli.green, language[40], self.Address);
addressChanged = true
if self.Class1 == CLASS_WARDEN then
setpetautoattacks()
end
end;
So I dont get any of those two prints, but that doesnt help me because it gets stuck after the "cprintf(cli.green, language[40], self.Address);" Well, otherwise it wouln't help me either, because I don't understand the bot's basics. I dont do much with lua, so its nothing I could fix.
Is your char a warden ? Then maybe it stucks in setpetautoattacks(). Even when the char isn't I would make a print there to see if it goes in there.
Hm the next bigger call would be
Code: Select all
CPawn.update(self); -- run base function
are you sure you have print before an after this ?
Re: bot stuck at player adress changed
Posted: Sun Dec 13, 2015 2:27 pm
by Ego95
Well, my char is not a warden. But I solved my problem somehow now. I dont know, what the problem was but I just made a copy of my rom folder and made a bot-setup just for arcanium. I deleted all userfunctions I dont need for that script and now it runs perfectly.