-
Notifications
You must be signed in to change notification settings - Fork 0
/
Toggle Zoom on Step.lua
43 lines (35 loc) · 1.29 KB
/
Toggle Zoom on Step.lua
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
--[[
>>> Toggleable Add Camera Zoom Event for Psych Engine. // AutisticLulu
Triggers Add Camera Zoom events on every step or optionally between a set amount of steps.
Confirmed compatible Psych Engine Versions:
0.6.x, 0.7.X
Value 1:
Parameters: "Stage Zoom, Hud Zoom, Number of steps *OPTIONAL*"
(Example: 0.015, 0.03)
(Example: 0.015, 0.03, 2)
Value 2:
Parameters: [On/Off]
(Example: On)
]]
-- Define local variables.
local isActive = false
local gameZoom, hudZoom, numSteps = nil, nil, nil
local stepTrigger = 1
local stepCount = 0
-- Helper function: Parses the gameZoom, hudZoom, and numSteps.
local function parseZoomValues(value)
return value:match('([^,]+),%s*([^,]+),?%s*([^,]*)')
end
function onEvent(name, value1, value2)
if (name == 'Toggle Zoom on Step' or name == 'Toggle_Zoom_on_Step') and cameraZoomOnStep then
gameZoom, hudZoom, numSteps = parseZoomValues(value1)
stepTrigger = tonumber(numSteps) or 1 -- Default to 1 if not specified or invalid
isActive = (value2 == 'On')
end
end
function onStepHit()
stepCount = stepCount + 1
if isActive and stepCount % stepTrigger == 0 and gameZoom and hudZoom then
triggerEvent("Add Camera Zoom", gameZoom, hudZoom)
end
end