-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
I hate Lua 5.3. Please compiles with compatibility flags for future releases. (including bit32 library)
function log2(x)
return math.log(x) / math.log(2)
end
function lshift(x, by) -- bit32 free, Lua 5.2, 5.3 compatible lshift
if log2(x) + by < 31 then
return x * 2 ^ by
else
return 2147483648 + (x - 2 ^ math.floor(log2(x))) * 2 ^ by
end
end
function Str2Val(Str, Start)
local ret = 0
for i = 0, 3 do
if string.len(Str) >= Start + i then
ret = ret + lshift(string.byte(Str, Start+i), 8*i)
end
end
return ret
end
function isname(player, name)
local p = ParsePlayer(player)
local t = {}
t[#t+1] = Memory(0x57EEE8 + 36 * p, AtLeast, lshift(string.byte(name, 1), 24))
t[#t+1] = Memory(0x57EEE8 + 36 * p, AtMost, lshift(string.byte(name, 1), 24) + 16777215)
for i = 2, string.len(name), 4 do
t[#t+1] = Memory(0x57EEE8 + 36 * p + (i+2), Exactly, Str2Val(name, i))
end
return t
end
Trigger {
players = {P1},
conditions = {
isname(P1, "ㄱㄴㄷㄹㅁ")
},
actions = {
Comment(" ");
}
}
-- TEP 0.083.1 works as expected
Trigger { --
players = {P1},
conditions = {
Memory(0x57EEE8, AtLeast, -1543503872); -- 0xA400 0000
Memory(0x57EEE8, AtMost, -1526726657); -- 0xA4FF FFFF
Memory(0x57EEEC, Exactly, -1532713823); -- 0xA4A4 A4A1
Memory(0x57EEF0, Exactly, -1532386137); -- 0xA4A9 A4A7
Memory(0x57EEF4, Exactly, 177); -- 0xB1
},
actions = {
Comment(" ");
},
}
-- in TEP 0.085.1, big number loses its precision
Trigger { --
players = {P1},
conditions = {
Memory(0x57EEE8, AtLeast, 0xA4000000);
Memory(0x57EEE8, AtMost, 0xA5000000);
Memory(0x57EEEC, Exactly, 0xA4A4A480);
Memory(0x57EEF0, Exactly, 0xA4A9A480);
Memory(0x57EEF4, Exactly, 0x000000B1);
},
actions = {
Comment(" ");
},
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels