Record Macro Error with New Agent

The record macro stopped workign with new Agent. Not understanding what I need to change. I’ve “setVar myVar 27” in $onInit and replace 27 with $myVar in the macro but it still shows me an error. What do I need to change?

ERROR

Error at RECORDmacro 1/3/8: Command was removed, please use named variables. E.g., setVar myVar 1 and write "$myVar"

3 | setReg 27 1


MACRO before fixing

ifRecording final stopRecording
ifRegEq 27 1 final setReg 27 0
setReg 27 1
toggleLayer fn3
ifNotRecording ifNotPlaytime 5000 ifRegEq 27 1 goTo @0
unToggleLayer
setReg 27 0


MACRO after trying to fix

ifRecording final stopRecording
ifRegEq $myVar 1 final setReg $myVar 0
setReg $myVar 1
toggleLayer fn3
ifNotRecording ifNotPlaytime 5000 ifRegEq $myVar 1 goTo @0
unToggleLayer
setReg $myVar 0

Well, the reason is that “registers” were removed in favor of “named variables”. So you need to go through firmware/doc-dev/user-guide.md at master · UltimateHackingKeyboard/firmware · GitHub again, see how to use the named variables, and finally rewrite your macro accordingly.

Clearly, the result should not contain setReg or ifRegEq, since they were removed (as the error is telling you).

I think this should work (not tested):

ifRecording final stopRecording
if ($myVar == 1) final setVar myVar 0
setVar myVar 1
toggleLayer fn3
ifNotRecording ifNotPlaytime 5000 if ($myVar == 1) goTo $currentAddress
unToggleLayer
setVar myVar 0

Will take a look at. And thanks for the example, it works again :slight_smile: