Stuck on loading items tables

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Message
Author
gerrison
Posts: 9
Joined: Tue Dec 21, 2010 6:50 am

Re: Stuck on loading items tables

#81 Post by gerrison » Sat Dec 25, 2010 5:46 pm

ok, wrong line.

tried at 57:

Code: Select all

while ( lastId ~= nil and lastId ~= 0 ) do
		currItemDir = currItemDir - itemSize; -- We move itemSize bytes up to go to next one
		dupeIdCheck = currId;
		currId = memoryReadInt(proc, currItemDir + addresses.idOffset ); -- 12 bytes offset id object
      print("dupeIdCheck", dupeIdCheck)
		if ( currId == nil or currId == 0 or dupeIdCheck == currId or ( ( currId > ( lastId + 3 ) ) or ( currId < ( lastId - 3 ) ) ) ) then
loops with:
dupeIdCheck: 113176
dupeIdCheck: 113177
dupeIdCheck: 113176
dupeIdCheck: 113177
endless

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Stuck on loading items tables

#82 Post by Administrator » Sat Dec 25, 2010 6:01 pm

Ok, try removing this part:

Code: Select all

dupeIdCheck = currId;
Move it and change change it to

Code: Select all

dupeIdCheck = lastId;
on line ~110 (right above lastId is assigned to something else).

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Stuck on loading items tables

#83 Post by rock5 » Sat Dec 25, 2010 6:19 pm

With these 2 changes,

Code: Select all

		currId = memoryReadInt(proc, currItemDir + addresses.idOffset ); -- 12 bytes offset id object

		if ( currId == nil or currId == 0 or dupeIdCheck == currId or ( ( currId > ( lastId + 3 ) ) or ( currId < ( lastId - 3 ) ) ) ) then	

Code: Select all

		dupeIdCheck = lastId;
		lastId = currId;
		lastItemDir = currItemDir;
It seems to get past it but then errors elsewhere.

Code: Select all

071% [***********************************---------------]...iles/micromacro/scri
pts/brom/classes/memorytable.lua:39: attempt to compare number with nil
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

gerrison
Posts: 9
Joined: Tue Dec 21, 2010 6:50 am

Re: Stuck on loading items tables

#84 Post by gerrison » Sat Dec 25, 2010 8:18 pm

yeah as already written in my previous post.. thats what i am getting too all the time when i came through the loop.
i tried to bypass the loop by setting if currId == "my current loop stuck number"
next thing is the nil error :(

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Stuck on loading items tables

#85 Post by Administrator » Sat Dec 25, 2010 9:29 pm

Well, it's a step in the right direction.

Line 38 of memorytable.lua, directly under this line:

Code: Select all

	self.StartId = memoryReadInt(proc, self.Address + addresses.idOffset );
Add:

Code: Select all

if( self.StartId == nil ) then return; end;
On line 358, uncomment (remove the '--') this line:

Code: Select all

nt:Update();
Change the line below it to this:

Code: Select all

		if( nt.Address and nt.StartId ) then


Now what happens?

gerrison
Posts: 9
Joined: Tue Dec 21, 2010 6:50 am

Re: Stuck on loading items tables

#86 Post by gerrison » Sat Dec 25, 2010 10:15 pm

guess what happens: 67... :D
if you got some idea maybe you should also supply some printf debugging lines becaus i have no clue what i am doing ;)

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Stuck on loading items tables

#87 Post by rock5 » Sat Dec 25, 2010 10:23 pm

Hm... I got

Code: Select all

075% [*************************************-------------]...iles/micromacro/scri
pts/brom/classes/memorytable.lua:63: attempt to compare nil with number
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Stuck on loading items tables

#88 Post by Administrator » Sat Dec 25, 2010 10:33 pm

Can you do some debugging to check which variable is nil on line 63 (just print all the variables before that line)?

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Stuck on loading items tables

#89 Post by rock5 » Sat Dec 25, 2010 11:17 pm

Code: Select all

lastStartId|    520000
_table.StartId  nil
lastId  520420
_table.EndId    0
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

raff
Posts: 96
Joined: Thu Jan 22, 2009 10:46 am

Re: Stuck on loading items tables

#90 Post by raff » Sat Dec 25, 2010 11:19 pm

I have added

Code: Select all

			printf("\nlastStartId: "..lastStartId)
			printf("\nlastId: "..lastId)
above

Code: Select all

			for _, _table in ipairs(tables) do
				if ( lastStartId >= _table.StartId and lastId <= _table.EndId ) then
at line 64~

result:

Code: Select all

075% [*************************************-------------]
lastStartId: 520000
lastId: 520420D:/micromacro/scripts/classes/memorytable.lua:67: attempt to compa
re nil with number
I don't know, how to print out nil values, but I have changed:

Code: Select all

			for _, _table in ipairs(tables) do
				if ( lastStartId >= _table.StartId and lastId <= _table.EndId ) then
					found = true;
					break;
				end;
			end;
to

Code: Select all

			if StartId ~= nil and EndId ~= nil then
			for _, _table in ipairs(tables) do
				if ( lastStartId >= _table.StartId and lastId <= _table.EndId ) then
					found = true;
					break;
				end;
			end;
			end
and now I get to 100% with this error:

Code: Select all

100% [**************************************************]

D:/micromacro/scripts/classes/memorytable.lua:469: bad argument #3 to 'sprintf'
(got nil)

line 469 is:

Code: Select all

		outFile:write(sprintf("\t{Address = 0x%X, EnAddress = 0x%x, StartId = 0x%X, EndId = 0x%x, Name = \"%s\", Ranges = {%s}},\n",
			v.Address, v.EnAddress, v.StartId, v.EndId, v.Name, rangesString));
so i printed out every variable in there, and got a nil error in v.StartId

then I have changed the line to:

Code: Select all

		if v.StartId ~= nil then
		outFile:write(sprintf("\t{Address = 0x%X, EnAddress = 0x%x, StartId = 0x%X, EndId = 0x%x, Name = \"%s\", Ranges = {%s}},\n",
			v.Address, v.EnAddress, v.StartId, v.EndId, v.Name, rangesString));
		end
and now I got this error:

Code: Select all

100% [**************************************************]

D:/micromacro/scripts/classes/memorytable.lua:253: attempt to compare nil with n
umber
line 253 is:

Code: Select all

if ( id >= _table.StartId and id <= _table.EndId ) then
then I have changed:

Code: Select all

		if ( id >= _table.StartId and id <= _table.EndId ) then
			return _table;
		end;
to:

Code: Select all

	if StartId ~= nil then
		if ( id >= _table.StartId and id <= _table.EndId ) then
			return _table;
		end;
	end
and now I can load the bot without stucking or errors, except this:

Code: Select all

100% [********************************************

Table not found for ID: 207051
Wrong value returned in update of item id: 207051
Table not found for ID: 210354
Wrong value returned in update of item id: 210354
Table not found for ID: 202075
Wrong value returned in update of item id: 202075
Table not found for ID: 202075
Wrong value returned in update of item id: 202075
Table not found for ID: 202075
Wrong value returned in update of item id: 202075
Table not found for ID: 202075
Wrong value returned in update of item id: 202075
Table not found for ID: 202075
Wrong value returned in update of item id: 202075
Table not found for ID: 221278
Table not found for ID: 221276
Table not found for ID: 221277
Table not found for ID: 221673
Table not found for ID: 220891
Table not found for ID: 210031
Table not found for ID: 210249
Table not found for ID: 221668
Table not found for ID: 221672
Table not found for ID: 210110
Waypoint files from D:/micromacro/scripts:

selling at a npc is not working with this btw
Attachments
memorytable.lua
(15.29 KiB) Downloaded 126 times

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Stuck on loading items tables

#91 Post by Administrator » Sat Dec 25, 2010 11:41 pm

rock5 wrote:

Code: Select all

lastStartId|    520000
_table.StartId  nil
lastId  520420
_table.EndId    0
That confuses me.

Code: Select all

		if( nt.Address and nt.StartId ) then
			table.insert(tables, nt);
		else
That should prevent anything from being inserted into the tables that has a nil StartId.

Unless... on line 400, apply the same fix to prevent invalid CTDefs from being inserted into tables.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Stuck on loading items tables

#92 Post by rock5 » Sun Dec 26, 2010 12:24 am

Administrator wrote:Unless... on line 400, apply the same fix to prevent invalid CTDefs from being inserted into tables.
That seems to have done it. It's reached 100% with no errors and I've printed the names of a few inventory items (because the item names require the memory tables to work). I've even run a waypoint file. Seems good.

So just to recap, here are a list of all the current changes.

Added line 39,

Code: Select all

	if( self.StartId == nil ) then return; end;
Changed line 60,

Code: Select all

		if ( currId == nil or currId == 0 or dupeIdCheck == currId or ( ( currId > ( lastId + 3 ) ) or ( currId < ( lastId - 3 ) ) ) ) then
Added line 112

Code: Select all

		dupeIdCheck = lastId;
Added 'if' statement line 398,

Code: Select all

			if( _table.Address and _table.StartId ) then
				table.insert( tables, _table);
			end
Thanks a million Administrator.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

raff
Posts: 96
Joined: Thu Jan 22, 2009 10:46 am

Re: Stuck on loading items tables

#93 Post by raff » Sun Dec 26, 2010 10:24 am

Everything seems to work now :), thanks alot!

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests