Reputation: 9
i have this script that want to change capslock button to on/off without holding lctrl to activate. Who can help me? Thank you everyone
function OnEvent(event, arg)
if IsModifierPressed("lctrl") then
repeat
if IsMouseButtonPressed(1) then
repeat
PressMouseButton(1)
Sleep(15)
ReleaseMouseButton(1)
until not IsMouseButtonPressed(1)
end
until not IsModifierPressed("lctrl")
end
end
Upvotes: -2
Views: 105
Reputation: 1928
In the game, in the "Controls Settings", introduce alternative key for "Shoot" action.
(I assume your game allows binding two different keys for the same action)
For example, let it be keyboard key P.
So, now in the game you can shoot either using Left Mouse Button or using Keyboard key P.
Of course, you will use LMB for manual shooting as usually, but your GHub script will use P.
Try to play the game with both LMB and P for shooting.
Make sure you can shoot with P key while keeping LMB pressed.
(Some games do not allow this)
The script
EnablePrimaryMouseButtonEvents(true)
function OnEvent(event, arg)
if event == "MOUSE_BUTTON_PRESSED" and arg == 1 and IsKeyLockOn("capslock") then
repeat
PressAndReleaseKey("P")
Sleep(15)
until not IsMouseButtonPressed(1)
end
end
Upvotes: 1