Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New plugin for Hotkey Swapping #57

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions plugins/Hotkey-Swap.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
local plugin = {}

plugin.name = "Hotkey Game Swap"
plugin.author = "Aestolia & SaggingRufus"
plugin.settings = {

{name='pressget', type='select', label="Hotkey for Swap", options={"Ctrl+Alt+Insert", "Ctrl+Shift+Insert", "Ctrl+Alt+Shift+Insert", "Alt+Shift+Insert"}},

}

plugin.description =
[[
Uses select hotkey combination to force a the game to change to the next one.

code was canibalized from the authorblues Shuffler.lua
]]

function plugin.on_frame(data, settings)

local press = settings.pressget

-- calculate input "rises" by subtracting the previously held inputs from the inputs on this frame
local input_rise = input.get()
for k,v in pairs(prev_input) do input_rise[k] = nil end
prev_input = input.get()

-- mark the game as complete if the hotkey is pressed (and some time buffer)
if input_rise[press] then swap_game()
end
end
return plugin