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.