Dynamic Difficulty.lua
Dynamic Difficulty.lua
local now_value1=0
local now_value2=0
local set_value1=0
local set_value2=0
end
function m.after_set_conditions(ctx)
if ctx.mis then
-- "ctx.mis" refers to MATCH_INFO structure
-- which has some interesting stuff
-- modify
memory.write(a1, memory.pack("u32", set_value1))
memory.write(a3, memory.pack("u32", set_value2))
-- verify changes
local now1 = memory.unpack("u32", memory.read(a1, 4))
local now3 = memory.unpack("u32", memory.read(a3, 4))
now_value1=now1
now_value2=now3
end
end
function m.init(ctx)
if not ffi then
error('LuaJIT FFI is disabled. Enable it with "luajit.ext.enabled = 1" in
sider.ini')
end
ctx.register("after_set_conditions", m.after_set_conditions)
ctx.register("overlay_on", overlay_on)
ctx.register("key_down", key_down)
end
return m