Could you share the code please? Ive been at it for a day and can't figure it out.
Sure, but it really is not a nice solution as it could break easily if the offsets used for the flags are in use by the actual game.
First of all you have to find an unused offset where you can write two 16 bit (or one 32 bit) values.
I'll write two comments per line, one is the translation of the code as shown by AR and one is an explanation.
I can't mark stuff in bold in the text but you need to change the offsets in both D3 lines and the F1 line to add a value to the offset's current value.
Code:
D3000000 006AA000 // Offset#1 = 006AA000 --- the unused offset you found which can hold 32 bit
10000000 00000000 // [00000000 + offs] = 0000 --- the "pressed" state of the button you chose
DD000000 00000200 // if L: --- the button you want for activation
10000000 00000001 // [00000000 + offs] = 0001 --- the button was pressed, write 1 to the offset representing the "pressed" state
90000002 00000000 // if 0000 = [00000002 + offs] --- the other 16 bit value - represents the "already activated" state
10000002 00000001 // [00000002 + offs] = 0001 --- the cheat was activated, write 1 to the offset representing the "already activated" state
D3000001 08ED7110 // Offset#2 = 08ED7110 --- the offset that represents the actual game value - everything you want to execute once starts here
DF000000 00000001 // Set offset#2 as active --- switches offset#2 to active
F1000000 00000005 // [00000000 + offs] += 00000005 --- adds 5 to the value of the offset (item count +5)
DF000000 00000000 // Set offset#1 as active --- switches back to offset#1
D0000000 00000000 // end if --- ends the "already activated" if statement (90000002)
D0000000 00000000 // end if --- ends the "button pressed" statement (DD000000)
90000000 00000000 // if 0000 = [00000000 + offs] --- checks if the "button pressed" value is 0. if the button was pressed on the current frame, it will be 1
10000002 00000000 // [00000002 + offs] = 0000 --- sets the "already activated" to 0 so the cheat can run again if the button is pressed again
D2000000 00000000 // end all if; start loop, clr reg --- terminator