Files
/
Amely Suncroll Auto Aim Item 2.0 (main).lua
Latest commit
84 lines (64 loc) ยท 2.25 KB
/
Amely Suncroll Auto Aim Item 2.0 (main).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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
--[[
ReaScript Name: Auto Aim Item (main)
Instructions: Just open it with Actions - New action - Load ReaScript
Author: Amely Suncroll
REAPER: 6+ (maybe less)
Extensions: none
Version: 2.0
About: An exact copy of the Auto Aim Midi 2.0 script, but applied to items.
The kit consists of two components - the "main" and the so-called "switch", or "toggle".
When you run the "main", it starts running in the background, while the "toggle" at this time
changes the cursor binding of the selected item to its beginning or end.
Once you're done with your work, simply turn off the main part of the script from the background.
Donations:
https://www.paypal.com/paypalme/suncroll
Support:
https://t.me/yxo_composer_support
amelysuncroll@gmail.com
]]--
local useEndOfNote = false
local script_identifier = "_MyScriptToggle"
local mode_identifier = script_identifier .. "_Mode"
function ToggleCursorBindingMode()
useEndOfNote = not useEndOfNote
end
function GetCursorBindingMode()
return reaper.GetExtState(script_identifier, mode_identifier) == "End"
end
function MoveEditCursorToSelectedItems()
local useEndOfItem = GetCursorBindingMode()
local commandId = useEndOfItem and 41174 or 41173
reaper.Main_OnCommand(commandId, 0)
end
local script_identifier = "_MyScriptToggle"
local function IsScriptToggledOn()
return reaper.GetExtState(script_identifier, "Running") == "1"
end
local function SetScriptToggle(state)
if state then
reaper.SetExtState(script_identifier, "Running", "1", false)
else
reaper.DeleteExtState(script_identifier, "Running", false)
end
end
local last_time = reaper.time_precise()
function Main()
local current_time = reaper.time_precise()
if current_time - last_time >= 0.01 then
MoveEditCursorToSelectedItems()
last_time = current_time
end
reaper.defer(Main)
end
function Exit()
reaper.MB("Script terminated", "Auto Aim Item 2.0", 0)
SetScriptToggle(false)
end
if not IsScriptToggledOn() then
reaper.MB("Script working", "Auto Aim Item 2.0", 0)
SetScriptToggle(true)
reaper.defer(Main)
else
Exit()
end
reaper.atexit(Exit)