Code: Select all
for(int i=0; i < 40; i++)
{
inventory[i] = memReadShort(invAdd+(i * 0x10));
printf("Inventory Slot: %u, Item ID: %u, Inventory Address: %X\n", i, (short)inventory[i], invAdd+(i * 0x10));
}
The odd thing is the array in memorys goes like this..
059E3FF4
059E4004
059E4014
059E4024
...
Always +10 to the last address. When I make the for loop like this.. The address are way off, When i add +16 like the bottom one the address shw up correctly but I don't get the right Item IDs.
Code: Select all
for(int i=0; i < 40; i++)
{
inventory[i] = memReadShort(invAdd+(i * 10));
printf("Inventory Slot: %u, Item ID: %u, Inventory Address: %X\n", i, inventory[i],invAdd+(i * 10));
}
Code: Select all
int invAdd = 0x59E3FF4; //Memory address of the first element in the array.
int inventory[50]; //The array to hold the item IDs.
for(int i=0; i < 40; i++)
{
inventory[i] = memReadShort(invAdd+(i * 16));
printf("Inventory Slot: %u, Item ID: %u, Inventory Address: %X\n", i, inventory[i],invAdd+(i * 16));
}