Anyway, basic concept #2 : Variable.
With Set Deaths actions, you can
[ add / subtract / set ] [ specific address ] to [ specific value ]
Since
- [ add / subtract / set ]
- [ specific address ]
- [ specific value ]
is stored somewhere in SC memory, they can be modified with SetDeaths if their address is known.
eudasm automatically calculates every trigger, conditions, and actions's addresses and makes it visible to eudasm code.
Collapsable Box
Consider the following code
Code
Trigger: @B
Actions:
SetDeaths(0, SetTo, 0, 0) @b+20 @bplayer+16 @bmodtype+24
Actions:
SetDeaths(0, SetTo, 0, 0) @b+20 @bplayer+16 @bmodtype+24
In trigger B,
b = (Address of SetDeaths action) + 20
bplayer = ( same ) + 16
bmodtype = ( same ) + 24
Refering to CHK reference says that
- bmodtype is a pointer to ( [ add / subtract / set ] + some other things )
- bplayer is a pointer to [ specific address ]
- b is a pointer to [ specific value ]
We call that
- Trigger B declares variable b
To use variable b, adjust memory at b, bplayer, and bmodtype, and call trigger B.
Example)
Code
Trigger: @B
next @B_next
Actions:
SetDeaths(0, SetTo, 0, 0) @b+20 @bplayer+16 @bmodtype+24
Trigger: @main // assume that this trigger is executed first
next B
Actions:
SetDeaths(&b, SetTo, 1234, 0) // b = 1234
SetDeaths(&bplayer, SetTo, &0x123456, 0) // target address. &(0x123456) = epd player corresponding to 0x123456
// bplayer : offset. &bplayer : epd player index
SetDeaths(&bmodtype, SetTo, 0x072D0000) // = (Set To = 0x072D0000)
// Trigger B will be executed after here, and SetDeaths statement in B will do
// *(ulong*)0x123456 = b
// We can add/sub/set arbitary address with variable.
next @B_next
Actions:
SetDeaths(0, SetTo, 0, 0) @b+20 @bplayer+16 @bmodtype+24
Trigger: @main // assume that this trigger is executed first
next B
Actions:
SetDeaths(&b, SetTo, 1234, 0) // b = 1234
SetDeaths(&bplayer, SetTo, &0x123456, 0) // target address. &(0x123456) = epd player corresponding to 0x123456
// bplayer : offset. &bplayer : epd player index
SetDeaths(&bmodtype, SetTo, 0x072D0000) // = (Set To = 0x072D0000)
// Trigger B will be executed after here, and SetDeaths statement in B will do
// *(ulong*)0x123456 = b
// We can add/sub/set arbitary address with variable.
// incomplete
EUD