Jump to content

Help me with my hexadecimal


Wisp

Recommended Posts

In one of his tutorials on the subject, Japheth writes

Next, we’re going to read in the shield slot to make sure that it’s empty. We do this by taking the "itemslot" variable and adding 0x04 to it which we know is always going to be the shield slot. (You can verify this by looking at a creature file in NI. If you look at the offset 0x2b8 it will have the offset for item slots. If you add 0x04 to that number, it should equal the offset for the shield slot.)

 

However, I don't get it to add up.

Looking up the shield offset in NI, I see that it is 55C. 2b8+4 does not equal 55C however, so obviously something is amiss here.

 

Could anyone shed some light on this?

 

Furthermore (and this isn't really a question about hex); why not just get the value for the shield attribute by doing a READ_SHORT at the appropriate offset, instead of this 0x2b8+0x04 stuff? (I take it there's a reason, as I've seen similar uses of this elsewhere).

Link to comment

The offset to the slot table is stored at 0x2b8. You want the *value* at 0x2b8, not 0x2b8.

 

You don't get the value directly, because it's a separate structure (depending on the number of items, spells, and effects attached to the CRE, the location of the slot table will change).

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...