I think for proper solution for `recolorUnitSprite` like scripts, that visit multiple pixel in same context, my script should have way to transfer data between invocations. With this first "pixel" will be very costly but but any after cheap.
Idea is to have some static variables that do not change its state between invocations in same context, like:
- offset: 1
code: |
if eq static_z 0;
set static_z 1;
else;
debug_log "another iteration when z was set!";
end;
return;
- offset: 2
code: |
if eq static_z 1; #see value that was set in "1"
debug_log "z was set!";
end;
return;
Question is how best handle indention for this variables in yaml and how effective implement this is code.
One possible example would be:
extended:
scriptsVarStatic:
recolorUnitSprite:
- name: XXXX #name visible in script
type: int #type of variable, could be too `type: "ptr BattleUnit"`
public: 1 #will be visible in other files/mods too