<?xml version="1.0" encoding="utf-8"?>
<CheatTable CheatEngineTableVersion="19">
  <CheatEntries>
    <CheatEntry>
      <ID>0</ID>
      <Description>"setup"</Description>
      <LastState Activated="1"/>
      <VariableType>Auto Assembler Script</VariableType>
      <AssemblerScript>[ENABLE]

globalalloc(__,$4000)
__:
dq __

__+10:
db 08 12
__+12:
dd __+40
__+16:
db 33 44 ff 99

__+40:
dw 1
dw 2
dw 3
dw 4

 
[DISABLE]

</AssemblerScript>
      <CheatEntries>
        <CheatEntry>
          <ID>1</ID>
          <Description>"test setAndFreeze"</Description>
          <LastState/>
          <VariableType>Auto Assembler Script</VariableType>
          <AssemblerScript>{$lua}
-- paste into your script
local bDebug = true

function setAndFreeze(OnOff,delay,mrs)
  if type(delay)~='number' then
    delay,mrs = 1,delay
  end
  delay = type(delay)=='number' and delay or 1
  if type(mrs)=='string' then
    local list
    list,mrs = mrs,{}
    list:gsub('[%w ]+',function(w)mrs[1+#mrs]=w end)
  end
  if type(mrs)~='table' or #mrs==0 or #mrs % 2 ~= 0 then
    error('memory record list not valid')
  end

  local act = function()
    local al = getAddressList()
    for i=1,#mrs,2 do
      local mr = al.getMemoryRecordByDescription(mrs[i])
      if mr~=nil then
        if OnOff == true then -- active and freeze
          mr.Value = mrs[i+1]
          mr.Active = true
        else
          mr.Active = false
        end
      else
        if bDebug then
          print('Check Memory Record with Description: '..mrs[i])
        end
      end
    end
  end
  if OnOff == true then
    local t = createTimer()
    t.Interval = delay
    t.OnTimer = function(sender)
      sender.Destroy()
      act()
    end
  else
    act()
  end
end

{$asm}



[ENABLE]

// demo setup to get myforce, replace yours
aobscan(aobmyforce,08 12 = = = = 33 44 ?? 99)

alloc(myforce,8)

myforce:
readmem(aobmyforce+2,4)
dd 0
registersymbol(myforce)



// delay = 2000ms here, no meaning on OFF mode, it can be omit to use defauult 1 milliseconds
// add this line in your script ,
LuaCall(setAndFreeze(true,2000, "shield up=9999;shield down=9999;laser up=45;laser down=45"))

[DISABLE]

// add this line in your script
LuaCall(setAndFreeze(false,"shield up=9999;shield down=9999;laser up=45;laser down=45"))

[myforce]:
//dq -1,-1

dealloc(myforce)
unregistersymbol(myforce)
</AssemblerScript>
        </CheatEntry>
        <CheatEntry>
          <ID>2</ID>
          <Description>"rec-base"</Description>
          <Options moActivateChildrenAsWell="1" moDeactivateChildrenAsWell="1"/>
          <LastState RealAddress="003B0040"/>
          <VariableType>String</VariableType>
          <Length>0</Length>
          <Unicode>0</Unicode>
          <ZeroTerminate>1</ZeroTerminate>
          <Address>[myforce]</Address>
          <CheatEntries>
            <CheatEntry>
              <ID>3</ID>
              <Description>"shield up"</Description>
              <LastState Value="9999" RealAddress="003B0042"/>
              <VariableType>2 Bytes</VariableType>
              <Address>+2</Address>
            </CheatEntry>
            <CheatEntry>
              <ID>6</ID>
              <Description>"shield down"</Description>
              <LastState Value="9999" RealAddress="003B0044"/>
              <VariableType>2 Bytes</VariableType>
              <Address>+4</Address>
            </CheatEntry>
            <CheatEntry>
              <ID>5</ID>
              <Description>"laser up"</Description>
              <LastState Value="45" RealAddress="003B0048"/>
              <VariableType>2 Bytes</VariableType>
              <Address>+8</Address>
            </CheatEntry>
            <CheatEntry>
              <ID>4</ID>
              <Description>"laser down"</Description>
              <LastState Value="45" RealAddress="003B004A"/>
              <VariableType>2 Bytes</VariableType>
              <Address>+a</Address>
            </CheatEntry>
          </CheatEntries>
        </CheatEntry>
      </CheatEntries>
    </CheatEntry>
  </CheatEntries>
  <UserdefinedSymbols/>
  <LuaScript>
</LuaScript>
</CheatTable>
