-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinputTest.lua
More file actions
53 lines (36 loc) · 1.2 KB
/
inputTest.lua
File metadata and controls
53 lines (36 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
-- global modules
package.path = GetScriptsDir() .. "inputtest/inputSystem.lua"
local inputSystem = require("inputSystem.lua")
package.path = GetScriptsDir() .. "sdu/helperFuncs.lua"
require("helperFuncs.lua")
--global variables
shared = {
consoleOut = "",
frame = 0,
enabled = false
}
--local variables
local lastexecutedframe = 0
--functions
function onScriptStart()
if ReadValueString(0x0, 6) ~= "G5DE78" then
CancelScript()
end
-- Core system enabled action
inputSystem.registerAction("Z+LT", {name="CoreSystemsEnable", method=function() shared.enabled = not shared.enabled end, type="CoreToggle"})
-- Main actions
inputSystem.registerAction("LT+X+Y", {name="InputDisplay", method=inputSystem.inputViewer, type="Toggle"})
end
function onScriptCancel()
end
function onScriptUpdate()
shared.frame = GetFrameCount()
if lastexecutedframe ~= shared.frame then
shared.consoleOut = ""
inputSystem.processInputs()
inputSystem.evaluateCommands()
inputSystem.processCommands()
SetScreenText(string.format("%s%s", (shared.enabled and "(M)\n" or ""), tostring(shared.consoleOut)))
lastexecutedframe = shared.frame
end
end