bot stuck at player adress changed

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
User avatar
Ego95
Posts: 564
Joined: Tue Feb 28, 2012 12:38 pm
Contact:

bot stuck at player adress changed

#1 Post by Ego95 » Fri Nov 27, 2015 1:52 pm

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.

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: bot stuck at player adress changed

#2 Post by BlubBlab » Fri Nov 27, 2015 3:04 pm

maybe you could add some print in the player:update() ?
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
Ego95
Posts: 564
Joined: Tue Feb 28, 2012 12:38 pm
Contact:

Re: bot stuck at player adress changed

#3 Post by Ego95 » Sat Nov 28, 2015 2:10 pm

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

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: bot stuck at player adress changed

#4 Post by BlubBlab » Sat Nov 28, 2015 2:16 pm

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.
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: bot stuck at player adress changed

#5 Post by BlubBlab » Sat Nov 28, 2015 2:21 pm

Maybe change it into a loop or at least give an error message.
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
Ego95
Posts: 564
Joined: Tue Feb 28, 2012 12:38 pm
Contact:

Re: bot stuck at player adress changed

#6 Post by Ego95 » Sat Nov 28, 2015 2:25 pm

Okay, this is the part I put a print too. I will look what happens

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: bot stuck at player adress changed

#7 Post by BlubBlab » Sat Nov 28, 2015 2:38 pm

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.
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
Ego95
Posts: 564
Joined: Tue Feb 28, 2012 12:38 pm
Contact:

Re: bot stuck at player adress changed

#8 Post by Ego95 » Mon Nov 30, 2015 2:01 pm

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.

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: bot stuck at player adress changed

#9 Post by BlubBlab » Mon Nov 30, 2015 2:22 pm

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 ?
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
Ego95
Posts: 564
Joined: Tue Feb 28, 2012 12:38 pm
Contact:

Re: bot stuck at player adress changed

#10 Post by Ego95 » Sun Dec 13, 2015 2:27 pm

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests