Page 5 of 6

Re: Need your help updating skill Ids

Posted: Thu Aug 06, 2015 10:08 am
by BlubBlab
We said in the other thread that it is might because he use win 10 which is relatively new and could have some issues. About the race conditions I found a way to avoid them :

Code: Select all

typedef LONG (NTAPI *NtSuspendProcess)(IN HANDLE ProcessHandle);

void suspend(DWORD processId)
{
    HANDLE processHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, processId));

    NtSuspendProcess pfnNtSuspendProcess = (NtSuspendProcess)GetProcAddress(
        GetModuleHandle("ntdll"), "NtSuspendProcess");

    pfnNtSuspendProcess(processHandle);
    CloseHandle(processHandle);
}
I saw some similar code inside the kernel driver which read process memory it basically suspend all threads inside of a process than do the read and than restart all of them .. hm.. ups I see the resume seems to be not part of the example but with some comparing I'm sure we will find it.(all function inside the kernel and ntdll are nearly the same beside the beginning of the name Zw and Nt)

Edit: wOO took me 2.3 sec ->NtResumeProcess

Re: Need your help updating skill Ids

Posted: Thu Aug 06, 2015 1:39 pm
by Bill D Cat
I'm using Windows 10 as well, and have yet to have any problems with the bot.
I've run a couple dozen characters through their daily quests over the last week with no issues.

Re: Need your help updating skill Ids

Posted: Thu Aug 06, 2015 8:01 pm
by BlubBlab
Than I besides a hardware defect I'm out of ideas.

Re: Need your help updating skill Ids

Posted: Sun Aug 09, 2015 11:11 am
by beanybabe
I reverted back to the original files then aplied the fix for game version and still had skill error.
So now I put the skill.xml in and used notepadd++ to mass-edit all the users xml to fix the mage.catalysis
Put this in printf("player.Class1 is currently %d\n",player.Class1) settings.lua to try to catch the error.

Im going to test it with all those patches now. Yesterday I did have 2 crashes in another area I forgot to note i'm watching to see if they reoccur also.

Re: Need your help updating skill Ids

Posted: Sun Aug 09, 2015 5:52 pm
by beanybabe
this happened just after it logged in with successful macro test
priest/rogue 35 30
C:/micromacro/scripts/rom/classes/memorytable.lua:213: attempt to concatenate a nil value

Re: Need your help updating skill Ids

Posted: Sun Aug 09, 2015 6:50 pm
by Bill D Cat
Line 213 in memorytable.lua is this line at the end of the GetIdName() function:

Code: Select all

	return name .. memoryReadString(proc, nameaddress)
So the error is either indicating that the variable "name" was nil, or the result of the memoryReadString() was nil.

In line 189, name is defined as a local variable to the function and set to "". It will only be changed to "Card - " or "Recipe - " (or their equivalent in other languages) if one of those types of items is being evaluated. So I don't think it's the "name" portion that would be nil. That leaves the memoryReadString() call as the most likely culprit. Why it would return nil under normal circumstances is beyond me. We did some pretty extensive testing of the function when we did all the upgrades to createpath a while back.

Re: Need your help updating skill Ids

Posted: Sun Aug 09, 2015 8:32 pm
by beanybabe
I restarted it again with the same char and it worked ok. It must be some thing that varied.

Re: Need your help updating skill Ids

Posted: Mon Aug 10, 2015 1:01 am
by beanybabe
just got undefinded player class again.
The print you asked me to add said undefined player class is at -1

I was looking in functions.lua and this line uses or on player class with some memory address that might be what is making the -1 its a bit over my head what its doing.
415 player.Class1 = memoryReadRepeat("int", getProc(), player.Address + addresses.pawnClass1_offset) or player.Class1;


Question Why is this reading memory for player class all the time? It seems it just needs read memory for it 1 time. or if player does a change class.
414 if isInGame() and ( os.difftime(os.time(), player.LastExpUpdateTime) > player.ExpUpdateInterval ) then
player.Class1 = memoryReadRepeat("int", getProc(), player.Address + addresses.pawnClass1_offset) or player.Class1;
print ("playerclass1 = ", player.Class1) -- I added these 2 prints to try to see why
print ("playerclass memoryread = ",memoryReadRepeat("int", getProc(), player.Address + addresses.pawnClass1_offset)) --second print

Re: Need your help updating skill Ids

Posted: Mon Aug 10, 2015 4:46 pm
by Bill D Cat
beanybabe wrote:I was looking in functions.lua and this line uses or on player class with some memory address that might be what is making the -1 its a bit over my head what its doing.
415 player.Class1 = memoryReadRepeat("int", getProc(), player.Address + addresses.pawnClass1_offset) or player.Class1;
If the memoryReadRepeat() fails to properly read the value from memory, it may return a -1 value. I suppose you could add another print statement here to check the values of player.Address and addresses.pawnClass1_offset to see if they look suspicious. I'm just at a loss as to why you are having all these memory read issues, and I can't reproduce any of them here on my three computers.
beanybabe wrote:Question Why is this reading memory for player class all the time? It seems it just needs read memory for it 1 time. or if player does a change class.
In this case, this section of code needs to read the player's primary class (player.Class1) to use it as a multiplier when finding the current level and XP of the character.

Code: Select all

	if isInGame() and ( os.difftime(os.time(), player.LastExpUpdateTime) > player.ExpUpdateInterval ) then
		player.Class1 = memoryReadRepeat("int", getProc(), player.Address + addresses.pawnClass1_offset) or player.Class1;
		player.Level = memoryReadRepeat("int", getProc(), addresses.charClassInfoBase + (addresses.charClassInfoSize* player.Class1 ) + addresses.charClassInfoLevel_offset) or player.Level
		player.XP = memoryReadRepeat("int", getProc(), addresses.charClassInfoBase + (addresses.charClassInfoSize* player.Class1 ) + addresses.charClassInfoXP_offset) or player.XP
		if player.XP == 0 or player.Level == 0 then return end
It's the (addresses.charClassInfoSize* player.Class1 ) bit here that is why it's always reading the value. I'm not sure why it would need to read it every few seconds when updating the title bar of MM with your estimated time to level up. Perhaps this could be cached a little more efficiently. I'm not sure what the original reasoning was for this code, so I don't want to go messing with it too much.

Re: Need your help updating skill Ids

Posted: Mon Aug 10, 2015 7:13 pm
by beanybabe
my machines quad cores with 64 bit os i do see some ping loss at times. I have seen these problems for few years many differnt pc builds. could it be something in the versions of rom?

Re: Need your help updating skill Ids

Posted: Tue Aug 11, 2015 3:54 am
by beanybabe
this is just for reference where it changes i loged out and back in on next char on same acct

playerclass memoryread = 2
address= 2 , playerclass= 2
playerclass1 = 2
playerclass memoryread = 2
address= 2 , playerclass= 2
playerclass1 = 2
playerclass memoryread = 2
address= 2 , playerclass= 2
playerclass1 = 2
playerclass memoryread = 2 --to this point the numbers are normal
address= -1069152595 , playerclass= -10 -- here i paused and reloged it keeps putting out numbers even when paused this is the result
playerclass1 = -1069152595
playerclass memoryread = -1069152595
address= -1069152595 , playerclass= -100
playerclass1 = -1069152595

---------------- here is another set after reloging a char this one i moved to new location then reloged
address= 7340143 , playerclass= 7340143
playerclass1 = 7340143
playerclass memoryread = 7340143

Re: Need your help updating skill Ids

Posted: Fri Aug 14, 2015 9:57 am
by beanybabe
I got this again today, the character has worked fine before. Something is getting set in drill. I am adding a Player:update() at that spot. I hope that stops this.

We successfully target NPC Special Training Manager and try to open the di
indow.
address= 8 , playerclass= 8
playerclass1 = 8
playerclass memoryread = 8
Clearing target.
Moving to waypoint #10, (4109, 3561)
Player address changed: 0x229DD700
No ranged skills specified in profile; Turning COMBAT_RANGED_PULL off.
player.Class1 is currently -1
The game client did not crash.
2015-08-14 09:31:40 - undefined player.Class1 in settings.lua

Re: Need your help updating skill Ids

Posted: Thu Aug 20, 2015 2:20 am
by beanybabe
address= 3 , playerclass= 3
playerclass1 = 3
playerclass memoryread = 3
Clearing target.
Moving to waypoint #9, (4109, 3561)
Was pulled back. Reseting waypoint.
Moving to waypoint #9, (4109, 3561)
Player address changed: 0x35D93C00
No ranged skills specified in profile; Turning COMBAT_RANGED_PULL off.
player.Class1 is currently -1
The game client did not crash.
2015-08-20 02:18:10 - undefined player.Class1 in settings.lua

Re: Need your help updating skill Ids

Posted: Thu Aug 20, 2015 2:22 am
by beanybabe
this -1 error always seems to happen in same places i really don't need any skills at this spots can the -1 just be ignored and let it continue.

Re: Need your help updating skill Ids

Posted: Fri Aug 21, 2015 4:41 am
by rock5
Is it teleporting at that point? Are you doing a waitForLoadingScreen()?

Re: Need your help updating skill Ids

Posted: Fri Aug 21, 2015 8:54 am
by beanybabe
it happens near teleporter or portal npcs. I rewrote the script move all the code into onload and make it all into functions to make following what was going on easier but several errors started happening. Im getting nil values and such. It seems to be timing related again so i changed the clock divider from 1000 down to 980 I'm wondering if delays on the net are affecting it.

This is not consistent on each character.
One problem seems to happen near player:update so I have commented it out and am testing that now. :: Removing the player:update on leaving castle seems to stopped one of the problems.

As rom keeps adding new areas the timing keeps changing it seems. I have had to add up to 7 second waits in areas for the npc's to appear before interacting with them to help prevent errors.

Re: Need your help updating skill Ids

Posted: Sun Aug 23, 2015 5:08 am
by beanybabe
I tried something and it may have worked. the class errors I get seem to happen in drill ground. I had disabled skills when char logged in but on entering drill ground it always showed a ranged skill.

Use MACRO: Executing RoMScript "ChoiceOption(1);".
Player address changed: 0x45D60A00
Ranged skill found: DRUID_EARTH_ARROW

So I put this just after the waitfor load screen now the skills are disables and hopefully no more error from them. Something must get changed in drill ground from the normal maps.
for k,v in pairs(settings.profile.skills) do
v.AutoUse = false
end

Player address changed: 0x31B8AA00
No ranged skills specified in profile; Turning COMBAT_RANGED_PULL off.
Maximum range of range attack skills is less than COMBAT_DISTANCE 150. Reducing
COMBAT_DISTANCE setting to 50.

Re: Need your help updating skill Ids

Posted: Fri Sep 04, 2015 12:24 am
by beanybabe
somewhere between the entrance of drill groun and needle drill bot looses class information

  • Ranged skill found: PRIEST_RISING_TIDE
    player loc = 2052.6000976563 44.475246429443 2604.1000976563
    We try to find NPC 114269:
    We successfully target NPC Master of Trials and try to open the dialog window.
    Use MACRO: Executing RoMScript "ChoiceOption(2);".
    Swimhack ACTIVATED!
    address= 5 , playerclass= 5
    playerclass1 = 5
    playerclass memoryread = 5
    address= 5 , playerclass= 5
    playerclass1 = 5
    playerclass memoryread = 5
    address= 5 , playerclass= 5
    playerclass1 = 5
    playerclass memoryread = 5
    address= 5 , playerclass= 5
    playerclass1 = 5
    playerclass memoryread = 5
    address= 5 , playerclass= 5
    playerclass1 = 5
    playerclass memoryread = 5
    address= 5 , playerclass= 5
    playerclass1 = 5
    playerclass memoryread = 5
    Swimhack DEactivated.
    We try to find NPC 112066:
    We successfully target NPC Special Training Manager and try to open the dialog w
    indow.
    Player address changed: 0x2F3B8C00
    No ranged skills specified in profile; Turning COMBAT_RANGED_PULL off.
    player.Class1 is currently -1
    The game client did not crash.
    2015-09-03 19:10:20 - undefined player.Class1 in settings.lua

Re: Need your help updating skill Ids

Posted: Thu Sep 24, 2015 7:29 am
by beanybabe
Here is were I ended up at updating my skills file with posts from this thread. Can you compare to yours and forward what needs to be included in patch to rock.

Re: Need your help updating skill Ids

Posted: Sun Oct 09, 2016 8:44 am
by beanybabe
Where is the basic Attack skill ? Should there be an attack in skill.lua ?
I notice that the basic attack is not defined as a skill but it it called in the functions. When leveling some classes that attacks are based on a buff it would be nice to have this basic attack.
I see it gets called if other attacks fail in functions.lua and macros.lua

here is the code in functions.lua

Code: Select all

function Attack()
	if settings.profile.hotkeys.AttackType == nil then
		setupAttackKey()
	end

	local tmpTargetPtr = memoryReadRepeat("uint", getProc(), player.Address + addresses.pawnTargetPtr_offset) or 0

	if tmpTargetPtr == 0 and player.TargetPtr == 0 then
		-- Nothing to attack
		return
	end

	if tmpTargetPtr ~= 0 then
		player.TargetPtr = tmpTargetPtr
		if settings.profile.hotkeys.AttackType == "macro" then
			RoMCode("UseSkill(1,1)")
		else
			keyboardPress(settings.profile.hotkeys.AttackType)
		end
		return
	end

	if player.TargetPtr ~= 0 then
		-- update TargetPtr
		player:updateTargetPtr()
		if player.TargetPtr ~= 0 then -- still valid target

			if( memoryWriteString == nil ) then
				error("Update your copy of MicroMacro to version 1.02!");
			end

			-- freeze TargetPtr
			memoryWriteString(getProc(), addresses.functionTargetPatchAddr, string.rep(string.char(0x90),#addresses.functionTargetBytes));

			-- Target it
			memoryWriteInt(getProc(), player.Address + addresses.pawnTargetPtr_offset, player.TargetPtr);

			-- 'Click'
			if settings.profile.hotkeys.AttackType == "macro" then
				RoMCode("UseSkill(1,1)")
			else
				keyboardPress(settings.profile.hotkeys.AttackType)
			end
			yrest(100)

			-- unfreeze TargetPtr
			memoryWriteString(getProc(), addresses.functionTargetPatchAddr, string.char(unpack(addresses.functionTargetBytes)));

		end
	end
end
This is in macros.lua
attack is 540000

Code: Select all

function setupAttackKey()
	settings.profile.hotkeys.AttackType = nil

	-- See if user speicfied a prefered key.
	if settings.profile.hotkeys.ATTACK and string.lower(settings.profile.hotkeys.ATTACK.key) ~= "macro" then
		-- First see if 'Attack' already exists in action bar
		local tmpActionKey , tmpkey = findActionKeyForId(540000)
		if tmpkey ~= nil then
			settings.profile.hotkeys.AttackType = tmpkey
		else
			local actionkey, hotkey = findUsableActionKey(settings.profile.hotkeys.ATTACK.key)
			if actionkey and hotkey then
				settings.profile.hotkeys.AttackType = hotkey
				setActionKeyToId(actionkey, 540000)
			end
		end
	end

	if settings.profile.hotkeys.AttackType == nil then
		settings.profile.hotkeys.AttackType = "macro"
	end

	if( settings.options.DEBUGGING_MACRO ) then
		printf("The 'Attack' hotkey is set to '".. settings.profile.hotkeys.AttackType .. "'.\n")
	end
end