Character dies when client crashes.

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Message
Author
User avatar
Administrator
Site Admin
Posts: 5353
Joined: Sat Jan 05, 2008 4:21 pm

Re: Character dies when client crashes.

#21 Post by Administrator »

rock5 wrote:That opens up a whole kettle of beans. Do you realize how many times the 'error' function command is used in the bot? Potentially at each of those error points we might want it to close the client.
That, and any unhandled exceptions would still propagate an error without closing the client. Oh, and it would be really annoying to debug certain issues when it closes the client as you're trying to work on something.
Alkaiser
Posts: 222
Joined: Sat Sep 25, 2010 2:03 pm

Re: Character dies when client crashes.

#22 Post by Alkaiser »

I meant only the in CPawn:update() error, so the client would be closed only when an error occurs in the update() function. This is the only time I have a problem.

Line 274 in pawn.lua

Code: Select all

	if( self.Alive ==nil or self.HP == nil or self.MaxHP == nil or self.MP == nil or self.MaxMP == nil or
		self.MP2 == nil or self.MaxMP2 == nil or self.Name == nil or
		self.Level == nil or self.Level2 == nil or self.TargetPtr == nil or
		self.X == nil or self.Y == nil or self.Z == nil or self.Attackable == nil ) then

		error("Error reading memory in CPawn:update()");
	end
This is where it happens. What would I add to have micromacro terminate the ROM process just before it errors out here and ONLY here.
User avatar
Administrator
Site Admin
Posts: 5353
Joined: Sat Jan 05, 2008 4:21 pm

Re: Character dies when client crashes.

#23 Post by Administrator »

You probably should just turn DEBUGGING on in setings.xml and post more detailed results of the error so that it can be properly fixed.
Alkaiser
Posts: 222
Joined: Sat Sep 25, 2010 2:03 pm

Re: Character dies when client crashes.

#24 Post by Alkaiser »

It happens extremely rarely and I assume that it occurs when the client becomes unstable, causing memory offsets no longer match up properly and update() to error out.

I think I found what I wanted.

Code: Select all

	if( self.Alive ==nil or self.HP == nil or self.MaxHP == nil or self.MP == nil or self.MaxMP == nil or
		self.MP2 == nil or self.MaxMP2 == nil or self.Name == nil or
		self.Level == nil or self.Level2 == nil or self.TargetPtr == nil or
		self.X == nil or self.Y == nil or self.Z == nil or self.Attackable == nil ) then

		local PID = findProcessByWindow(getWin()); -- Get process ID
		os.execute("TASKKILL /PID " .. PID .. " /F");
		while(true) do
			-- Wait for process to close...
			if( findProcessByWindow(__WIN) ~= PID ) then
				printf(language[88]);
				break;
			end;
			yrest(100);
		end
		
		error("Error reading memory in CPawn:update()");
	end
Post Reply