Apex Legend OBSジッター

有料とかばかばかしいから無料

下のコードをメモ帳にコピペして拡張子を.luaにしたら
C:\Program Files\obs-studio\data\obs-plugins\frontend-tools\scripts
にいれて、OBSを起動
上部のツール(T)→スクリプト→✚ボタン→さっき作ったluaを追加
で導入できる
おすすめのRangeは7くらい

local obs                      = obslua
local bit                      = require("bit")
local ffi                      = require("ffi")
local u32                      = ffi.load("user32.dll")
local k32                      = ffi.load("kernel32.dll")
 
local shake_range              = 5
local shake_delay              = 7.0
local shake_enable             = false
 
local apex_hwnd                = nil
local inversion                = 1
 
-- C imports --
ffi.cdef[[
    int Beep(uint32_t, uint32_t);
    void Sleep(int);
    void mouse_event(uint32_t, uint32_t, uint32_t, uint32_t, uint64_t);
    uint64_t FindWindowA(const char *, const char *);
    uint64_t GetActiveWindow();
    uint64_t GetForegroundWindow();
    int MessageBoxA(long, const char *, const char *, long);
    int GetAsyncKeyState(uint64_t);
]]
 
function script_description()
    return [[<div style="font-family:Arial;">Best delay = 1000 / ゲーム内fps</div>]]
end
 
function script_properties()
    local props = obs.obs_properties_create()
    obs.obs_properties_add_int_slider(props, "shake_range", "Range", 0, 100, 1)
    obs.obs_properties_add_float_slider(props, "shake_delay", "Delay", 0.0, 100.0, 1.0)
    obs.obs_properties_add_bool(props,"shake_enable", "On / Off)
    return props
end
 
function script_defaults(settings)
    obs.obs_data_set_default_int(settings, "shake_range", shake_range)
    obs.obs_data_set_default_double(settings, "shake_delay", shake_delay)
    obs.obs_data_set_default_bool(settings, "shake_enable", shake_enable)
end
 
function script_update(settings)
    shake_delay = obs.obs_data_get_double(settings, "shake_delay")
    shake_range = obs.obs_data_get_int(settings, "shake_range")
    shake_enable = obs.obs_data_get_bool(settings, "shake_enable")
 
    --u32.MessageBoxA(0, "test", nil, 0)
    --u32.mouse_event(0x0001, 50, 0, 0, 0)
    --k32.Beep(450, 500)
    --apex_hwnd = u32.FindWindowA(nil, "Apex Legends")
    print(tostring(apex_hwnd) .. " " .. tostring(shake_enable) .. " " .. shake_range .. " " .. bit.band(u32.GetAsyncKeyState(0x02), 0x8000))
end
 
function script_tick(seconds)
    apex_hwnd = u32.FindWindowA(nil, "Apex Legends")
	if shake_enable and apex_hwnd and is_win_active(apex_hwnd) then
        if bit.band(u32.GetAsyncKeyState(0x01), 0x8000) > 0 and bit.band(u32.GetAsyncKeyState(0x02), 0x8000) > 0 then
            --k32.Beep(650, 100)
            u32.mouse_event(0x0001, inversion*shake_range, inversion*shake_range, 0, 0)
            inversion = inversion * -1
            k32.Sleep(shake_delay)
        end
	end
end
 
function is_win_active(hwnd)
    if u32.GetForegroundWindow() == hwnd then
        return true
    else
        return false
    end
end

この記事が気に入ったらサポートをしてみませんか?