OnPlayerMem

From PGE Wiki
Jump to navigation Jump to search

Prototype

OnPlayerMem,OFFSET,VALUE,COMPARISON,EVENT,Active time,DATA SIZE

Description

Scans player memory and checks OFFSET. Does COMPARISON to the VALUE at that OFFSET, and if the comparison is true, it activates EVENT. DATA SIZE is what type of data it should look for at that offset.

Notes

The OFFSETS are bits of memory that determine the state of the player. Not all of them are fully understood. Check the reference at the bottom to find some.

COMPARISON types compare the value at OFFSET to the VALUE in the command.

COMPARISON = 0 = EQUALS. If the VALUE is exactly equal, activate the event. COMPARISON = 1 = GREATER THAN. If the VALUE is bigger, activate the event. COMPARISON = 2 = LESS THAN. If the VALUE is smaller, activate the event.

There are 5 DATA SIZES used to change memory. The data size has to match the type the OFFSET uses. Check the in depth tutorial to actually understand this.

b = byte (1 byte of memory) w = word (2 bytes of memory) dw = double word (4 bytes of memory) f = float / decimal (4 bytes of memory) df = double float / double precision decimal (8 bytes of memory)

Examples

// When player current powerup ("w" size memory at 0x112) equals 3 (fire flower), activate event 1000
OnPlayerMem,0x112,3,0,1000,0,w


// When player current powerup ("w" size memory at 0x112) is less than 4 (big or small or firey), activate event 1001
OnPlayerMem,0x112,4,2,1001,0,w


// When player underwater stroke timer ("w" memory at +0x38) is greater than 5, activate event 1002
// (if you make event 1002 set the stroke timer to 4, it'll be like you can swim relly fast)
OnPlayerMem,0x38,5,1,1002,w