Page 9 of 10
Re: Official new patch topic 4.0.1
Posted: Sat Jul 30, 2011 4:52 am
by Caprica
Need some help here to solve a weird bug...
I ran svn update and addresses update on folders and bot, everything works fine on main computer.
In order to scale up, I have installed a Virtual Machine with game and EXACT same bot folder as main computer, but since patch 4.0.1, the bot will no longer run inside VM. (It works like a charm on computer though)
Here's the bot window message :
Code: Select all
033% [****************----------------------------------]scripts/rom/classes/mem
orytable.lua:76: attempt to perform arithmetic on local 'tmpID' (a nil value)
And the log message :
Code: Select all
In main thread:
stack traceback:
scripts/rom/classes/memorytable.lua:264: in function 'LoadTables_memory'
scripts/rom/classes/memorytable.lua:284: in function 'LoadTables'
scripts/rom/bot.lua:126: in function 'foo'
C:\Users\***\Desktop\Rombot\lib\lib.lua:510: in function <C:\Users\***\Desktop\Rombot\lib\lib.lua:508>
----------TRACEBACK END----------
Sat Jul 30 12:52:09 2011 : scripts/rom/classes/memorytable.lua:76: attempt to perform arithmetic on local 'tmpID' (a nil value)
Sat Jul 30 12:52:09 2011 : Execution error: Runtime error
Re: Official new patch topic 4.0.1
Posted: Sat Jul 30, 2011 6:09 am
by lisa
You know you can run multi clients without using a VM right?
Re: Official new patch topic 4.0.1
Posted: Sat Jul 30, 2011 6:16 am
by Caprica
Of course... But I don't want to use the same IP for gaming and abusing
Moreover, micromacro Grabs my Ctrl Key even though I'm not focusing the windows, implying a lot of Stuck errors
Re: Official new patch topic 4.0.1
Posted: Sat Jul 30, 2011 5:33 pm
by Administrator
Caprica wrote:Of course... But I don't want to use the same IP for gaming and abusing

You are still using the same IP. A virtual machine won't change that.
Moreover, micromacro Grabs my Ctrl Key even though I'm not focusing the windows, implying a lot of Stuck errors
You mean the
game does that. It has nothing to do with MicroMacro.
Re: Official new patch topic 4.0.1
Posted: Sat Jul 30, 2011 5:38 pm
by Caprica
I am not using the same IP if I am using a VPN to connect to game within the VM.
Any clue on how this strange behaviour is happening ?
Edit : Meanwhile, I fixed the problem checking for nil tmpID and returning _address earlier in code, before it breaks.
Patch works, but I'd rather understand why same files don't work the same way in same environments.
Re: Official new patch topic 4.0.1
Posted: Sun Jul 31, 2011 7:01 am
by ratzuk
OnLoad portion of code seems to be running incorrectly
I use a series of 3 linked waypoints to do the Elven Daily, Collect a few Golden Eggs & then mail eggs aand Miller Cakes to main character and autochange character using loginxml. At the moment I use version 615 of the bot with the new addresses.lua because the following code does not seem to work anymore.
This code is in Onload event of daily waypoint:
Code: Select all
<!-- Quit If Dailys alread completed for this character -->
<onLoad>
local dailyQuestCount, dailyQuestsPerDay= RoMScript("Daily_count()");
if 10 == dailyQuestCount then
sendMacro("}LoginNextToon=true;a={")
sendMacro("Logout();");
waitForLoadingScreen();
yrest(3000);
-- Re-initialize player
player = CPlayer.new();
settings.load();
settings.loadProfile("default"); -- Profile name
yrest (4000)
loadPaths("Elven Island/NewDaily"); -- First script
end
</onLoad>
It is for when game crashes so it only runs egg script once for each character if it has to run from start again
This is the code that calls the egg script:
Code: Select all
local dailyQuestCount, dailyQuestsPerDay= RoMScript("Daily_count()");
if 10 == dailyQuestCount then
printf("Bot "..RoMScript("CHARACTER_SELECT.selectedIndex").." Completed "..dailyQuestCount.." from " .. dailyQuestsPerDay .. " daily quests. Get Some Eggs.\n");
loadPaths("Elven Island/ToTheFarm"); -- Move To Sorrun
else
printf("Bot "..RoMScript("CHARACTER_SELECT.selectedIndex").." Completed "..dailyQuestCount.." from " .. dailyQuestsPerDay .. " daily quests, now " .. dailyQuestsPerDay - dailyQuestCount .. " remain.\n");
player:target_NPC("Blinsik");
sendMacro("OnClick_QuestListButton(1, 2)"); yrest(750);
sendMacro("AcceptQuest()"); yrest(2000);
end
When the 10 dailys are completed all it does is load next character it seems to be skipping the loadPaths command. I can only think that this is because it is somehow running the OnLoad section of the code again forcing the logout
Re: Official new patch topic 4.0.1
Posted: Sun Jul 31, 2011 7:37 am
by lisa
Sorry I am just finding it hard to follow the flow of what you are doing, probably because I would do it differently.
So you have a WP NewDaily and it has the onload section that checks if all dailys have been done. If they have been done then it logs next character and carries on.
If character hasn't done all dailys yet then it carries on with the WP which at some stage has the check for dailys done and then tells it to load WP ToTheFarm. If it hasn't done all dailys then it continues with the quests.
Ok first things first, there were changes in the bot so using the same code may or may not work as you used to. Good news is that things are now simpler.
try this in your onload.
Code: Select all
<onLoad>
local dailyQuestCount, dailyQuestsPerDay= RoMScript("Daily_count()");
if 10 == dailyQuestCount then
sendMacro("}LoginNextToon=true;a={")
sendMacro("Logout();");
waitForLoadingScreen();
loadPaths("Elven Island/NewDaily")
end
</onLoad>
Ok now for next WP.
ratzuk wrote:When the 10 dailys are completed all it does is load next character it seems to be skipping the loadPaths command. I can only think that this is because it is somehow running the OnLoad section of the code again forcing the logout
Are you saying it starts the next Wp ToTheFarm and then logs out or isn't it starting the next WP at all?
Is there anything in the onload for the WP ToTheFarm ??
Re: Official new patch topic 4.0.1
Posted: Sun Jul 31, 2011 8:15 am
by SpiralV
Yes it's true the onload function is buggy this time.
on exit with loadpaths the onload function fires again but only if the new wp file has no or empty onload statment
insert this on top of your NewDaily.xml
Code: Select all
<onLoad>
printf("whatever")
</onLoad>
Re: Official new patch topic 4.0.1
Posted: Sun Jul 31, 2011 9:05 am
by rock5
SpiralV wrote:Yes it's true the onload function is buggy this time.
on exit with loadpaths the onload function fires again but only if the new wp file has no or empty onload statment
insert this on top of your NewDaily.xml
Code: Select all
<onLoad>
printf("whatever")
</onLoad>
Your good SpiralV. That at least points me in the right direction. Looks like the waypoint file onload event doesn't get reset. It looks like whole of __WPL doesn't get reset at all but just overritten so the onload event remains.
I think the problem is line 449 of functions.lua
Code: Select all
if( not __WPL ) then -- define object if not there
__WPL = CWaypointList();
end;
Try removing the if statement so it's just.
That will make sure it always resets __WPL when loading a new waypoint file.
Re: Official new patch topic 4.0.1
Posted: Sun Jul 31, 2011 9:36 am
by SpiralV
yes now it works properly
Re: Official new patch topic 4.0.1
Posted: Sun Jul 31, 2011 10:13 am
by kanta
lisa wrote:adding swimhack here with updated addresses.
Just an observation, but both speed and swim have the same description header of
Code: Select all
--==<< By Tsutomu Version 1.0a >>==--
--==<< Requirements: Rom bot. >>==--
--==<< Usage: fly(); OR flyoff(); >>==--
The speed hack needs to be changed to
Code: Select all
--==<< By Tsutomu Version 1.0a >>==--
--==<< Requirements: Rom bot. >>==--
--==<< Usage: speedon(); OR speedoff(); >>==--
Re: Official new patch topic 4.0.1
Posted: Sun Jul 31, 2011 7:33 pm
by ratzuk
lisa wrote:
try this in your onload.
Code: Select all
<onLoad>
local dailyQuestCount, dailyQuestsPerDay= RoMScript("Daily_count()");
if 10 == dailyQuestCount then
sendMacro("}LoginNextToon=true;a={")
sendMacro("Logout();");
waitForLoadingScreen();
loadPaths("Elven Island/NewDaily")
end
</onLoad>
Thanks Lisa. Didn't realize next character didn't have to reinitialized after swapping now
lisa wrote:
Is there anything in the onload for the WP ToTheFarm ??
No this is empty, but reading the other posts, it looks like this is the answer
rock5 wrote:Try removing the if statement so it's just.
That will make sure it always resets __WPL when loading a new waypoint file.
I'll try later when dailys reset as I've done for today
Re: Official new patch topic 4.0.1
Posted: Wed Aug 03, 2011 7:47 pm
by BillDoorNZ
I'm running win7 on a 64bit machine and have found that I can run the bot on some characters and not others (mainly not). HAve been debugging and learning hte code base at the same time so its taken me a while but I've narrowed the problem down to the LoadTables_memory routine in the memorytable.lua file.
What seems to be happening is that the code runs through the in-memory tables in reverse order finding ranges of id's (item I'ds I assume). This works fine in most cases, however I get a scenario where the range looks like this (just listing the id's sequentially as they are in memory - yes, they are just the last 3 digits too as I'm lazy):
nil, 866,
867, 865, 864, 863, 863....
As you can see, the 867 is out of order and this causes a problem with the code, in that it finds the range from 863 to 865, records that, then finds the 867-867 range, records that

all good.
however, next it gets the 866, finds there is a nil next, so looks for the rest of the range (867) and finds that again, so adds the 866-866 range and continues from 867 - resulting in an infinite loop from 867 to 866 and then back.
I ended up changing the code in the GetNextTableAddress function to test the Tables to see if the item has already been added before just blindly returning the address of 867. i.e.:
Code: Select all
local function CheckAddress( addressToCheck )
-- Check the 0x4 offset address
local tmpAddress = memoryReadInt( proc, addressToCheck + 0x4 )
if ( tmpAddress ~= nil ) then
if tmpAddress > highestAddress then
return tmpAddress
end
local tmpId = memoryReadInt( proc, tmpAddress + addresses.idOffset )
if tmpId > lastId and tmpId < 999999 and [color=#FF0000](GetItemAddress(tmpId) == nil)[/color] then
return tmpAddress
end
end
-- Check the 0x8 offset address
local tmpAddress = memoryReadInt( proc, addressToCheck + 0x8 )
if ( tmpAddress ~= nil ) then
if tmpAddress > highestAddress then
return tmpAddress
end
local tmpId = memoryReadInt( proc, tmpAddress + addresses.idOffset )
if tmpId > lastId and tmpId < 999999 and[color=#FF0000] (GetItemAddress(tmpId) == nil)[/color] then
return tmpAddress
end
end
return nil
end
Possibly not the best solution as it reports some failures, but it works for now at least

I'm sure you can prolly come up with a better solution tho.
Re: Official new patch topic 4.0.1
Posted: Thu Aug 04, 2011 5:43 am
by rock5
Well done for doing all that work. Sure makes my job easier.
Spent about 30 minutes trying to follow what was happening. I think I've got a simple solution. Could you try this please, as I don't get the error you get.
After undoing those changes you made, after line 263 of "memorytables.lua"
Code: Select all
else -- Search if the range continues at another address
Add this line
Let me know if that fixes it.
Re: Official new patch topic 4.0.1
Posted: Thu Aug 04, 2011 1:32 pm
by brujilla
say this and not work rom/classes.lua/item lua:201:unexpect symbol near, i actually with update but don`t work. What happen? please help. Sent my item.lua
Re: Official new patch topic 4.0.1
Posted: Thu Aug 04, 2011 2:11 pm
by BillDoorNZ
no luck Rock,
still ends up looping back and forth between 866 and 867. I guess that what it really needs to do is:
1) add the original range as per existing code -> 800-865
2) add the 867-867 range
3) add the 866-866 range
4) detect that 867 has already been added, then use the 4 and 8byte offsets to see where the range continues / brute force search for the range starting at 868.
I might alter my hack to get it to search for the next itemId (868) in the GetNextTableAddress / CheckAddress function. Will let you know how I get on with that.
Do the 4 / 8 byte offsets always hold the pointer to the next item? If thats the case, it could be changed to run through those instead (I assume its a linked-list or something).
Re: Official new patch topic 4.0.1
Posted: Thu Aug 04, 2011 10:41 pm
by rock5
brujilla wrote:say this and not work rom/classes.lua/item lua:201:unexpect symbol near, i actually with update but don`t work. What happen? please help. Sent my item.lua
Don't double post. I answered your question in the other post.
Re: Official new patch topic 4.0.1
Posted: Thu Aug 04, 2011 10:49 pm
by rock5
BillDoorNZ wrote:4) detect that 867 has already been added, then use the 4 and 8byte offsets to see where the range continues / brute force search for the range starting at 868.
That's what it's supposed to do. tables
.EndId should equal 867 so it should be searching for 868 from then on. I'll look at it again and see if there is something I missed.BillDoorNZ wrote:Do the 4 / 8 byte offsets always hold the pointer to the next item? If thats the case, it could be changed to run through those instead (I assume its a linked-list or something).
We could never find a pattern with those. All we know is at the end, the address for the next range should appear somewhere within those 2 columns.
Re: Official new patch topic 4.0.1
Posted: Sat Aug 06, 2011 6:31 am
by SpiralV
rock5 wrote:BillDoorNZ wrote:4) detect that 867 has already been added, then use the 4 and 8byte offsets to see where the range continues / brute force search for the range starting at 868.
That's what it's supposed to do. tables
.EndId should equal 867 so it should be searching for 868 from then on. I'll look at it again and see if there is something I missed.BillDoorNZ wrote:Do the 4 / 8 byte offsets always hold the pointer to the next item? If thats the case, it could be changed to run through those instead (I assume its a linked-list or something).
We could never find a pattern with those. All we know is at the end, the address for the next range should appear somewhere within those 2 columns.
looks like a search index but i'm not sure with 0x4
Code: Select all
function findID(StartAddress, IDtoFind)
local Line = 32;
local dataPointer = StartAddress
local currentID
while true do
local offset0 = memoryReadInt( proc, dataPointer );
--local offset4 = memoryReadInt( proc, dataPointer + 4);
local offset8 = memoryReadInt( proc, dataPointer + 8);
currentID = memoryReadInt( proc, dataPointer + addresses.idOffset );
if IDtoFind == currentID then break end
if currentID > IDtoFind then
if offset0 == offset8 then
dataPointer = dataPointer + Line
else
dataPointer = offset0
end
else
if offset0 == offset8 then
dataPointer = dataPointer - Line
else
dataPointer = offset8
end
end
--printf("currentAddress %X , current ID %X:%d\n", dataPointer, currentID, currentID)
--yrest(500)
end
printf("%X\n",dataPointer)
end
thats cool it gives the address for all IDs i'm not sure what happens if the ID does not exist.
Re: Official new patch topic 4.0.1
Posted: Sun Aug 07, 2011 6:04 am
by rock5
That's pretty cool. I'm not sure I follow it though. Could you describe what's happening with the 0 and 8 offsets?
I tested it's speed. It's a lot slower than the current method but probably fast enough. I searched for some random ids 1000 times. Yours took between 2 and 8 seconds. The current version took about .45 to 1.4 seconds. But even at 8 seconds that's 8/1000 (0.008) seconds per address. And if I understand correctly this will do away with the memorytable altogether. No more progressbar when starting the bot:D