- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
G13 - how to fast switch
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-16-2012 01:37 PM
Hello
I would like to ask for some instructions to program a G-key (say G15) of the G13 to switch from M1 to M2 while pressed and back to M1 once released.
I need this for games like Mass effect where I want to use qwerty for the normal actions and then "shift" the G13 so that qwerty is 12345 for the quickslot actions. But to go back to original movement controls when I release. I don't want to have to press G15 twice to go to M2 and back because in practice it tends to bug and not switch.
So the return to previous state on release is the critical thing here.
Is there a script or something that can do this? I have never used scripts so could you please provide detailed instructions on how to use.
Thanks
Solved! Go to Solution.
Re: G13 - how to fast switch
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-16-2012 02:38 PM - edited 02-16-2012 02:41 PM
hi there ...
if you want to switch the m-modes only while G15-key is down (pressed) then this script should do it.
new "software": click on the profile icon, select "scripting", overwrite everything with the code
legacy: click edit - script, overwrite, right-click G15 set: assign script
function OnEvent(event,arg,family)
family = family or ""
Mstate = GetMKeyState("lhc")
if Mstate == 1 and arg == 15 and event == "G_PRESSED" then -- if G15 is pressed in M1
SetMKeyState(2, "lhc") -- set M to 2 on the lhc (G13)
end
if Mstate == 2 and arg == 15 and event == "G_RELEASED" then -- if G15 is released in M2
SetMKeyState(1, "lhc") -- set M to 1 on the lhc (G13)
end
endNOTE: the M-Button and / or color may not change to M2 with the new "software".
if you want proper software you have to use the old legacy software (3.06 or 3.03).
have fun!
Re: G13 - how to fast switch
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-16-2012 02:47 PM
If you are interested in doing this for a mouse button, I'd be willing to post a relatively simple script that allows this on mouse button 4 and 5. This is something I find very useful, as I find holding down 1 G key and pressing another to be difficulty.
Re: G13 - how to fast switch
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-16-2012 02:57 PM
Thank you so much. been trying to figure this out for ages, not knowing about scripts.
If I may ask for one more detail that would make this perfect:
Is there a way to make the M2 keys only activate on key press and not release? So that if when i press G15 to switch, I have allready G4 pressed (my run forward =w) it doesnt automatically activate G4 for M2 ( that is 2, my second quickslot bar)?
So I would want it to activate M2 keys only when pressed and not if already pressed when the switch happens basically.
Also to make what you wrote work I had to assign script on G15 for both M1 and M2 if that makes any difference.
Thanks again.
Re: G13 - how to fast switch
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-16-2012 02:58 PM
That would be even better! but I don't have a logitech mouse if that matters.
Re: G13 - how to fast switch
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-16-2012 03:13 PM
Nope, it doesn't have to be a logi mouse to work, but you do have to assign the mouse button's 4 and 5 to their default action (browser forward and backward). I personally have been using it with the MS sidewinder x8. I have a G400, but I like the thumb button location better on the MS mouse.
I'll give you the most simplified version I have.
Re: G13 - how to fast switch
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-16-2012 03:27 PM
Here is a basic template to poll and do other stuff. I've removed most the script but it's designed to poll and currently set to change to M2 by pressing mb5 and M3 with mb4.
To change it, look at the 11 line for this code: poll:setMKeyModifier( "default", "mb5", "mb4", "lhc" ) -- Allows the use of Modifiers to change M pages
The 1st variable is what key will change to M1. "default" means that nothing needs to be pressed to be at M1. It's the default M page. The 2nd variable is for what changes you to M2, in this case, "mb5" which is mouse button 5. It'll also accept "shift", "ctrl", "alt" or any other modifier. The 3rd variable is the same, but for M3. The 4th variable describes which device it'll work on. "lhc" means it works on the left hand controller, which is what the G13 is.
-- Code update by Bystander on 10/25/2011 ---------------------------------------------------------------------------------------------------- -------- POLL_DELAY = 20 -- Sleep time after each poll (beware of number below 25) POLL_FAMILY = "lhc" -- The device polling will take place on. Prefered to not be on macroed device. -------------------------------------------------- -------------------------------------------------- -------- function _onActivation(event, arg, family) -- -- ADD ANY START UP ROUTINES HERE -- poll:setMKeyModifier( "default", "mb5", "mb4", "lhc" ) -- Allows the use of Modifiers to change M pages end function _OnEvent(event, arg, family) -- -- ADD EVENT FUNCTIONALITY HERE -- end -------------------------------------------------- -------------------------------------------------- ---- -------------------------------------------------- -------------------------------------------------- ---- -- -- NOTHING BELOW HERE NEEDS TO BE ALTERED -- -------------------------------------------------- -------------------------------------------------- ---- -------------------------------------------------- -------------------------------------------------- ---- -- function Poll:new(family, delay) delay is sleep time between polls -- function Poll:run(event, arg, family) handles events and performs the polling as long as it's running -- function Poll:setMKeyModifier( m1, m2, m3, family ) Allows the use of Modifiers to change M pages -- function Poll:start() turn on polling -- function Poll:stop() stop polling -- function Poll:_press() NOT TO BE USED -- function Poll:release() NOT TO BE USED -- function Poll:setMKeyState(MKeyState) NOT TO BE USED -------------------------------------------------- -------------------------------------------------- -------- function OnEvent(event, arg, family) if event == "PROFILE_ACTIVATED" then ClearLog() if KB_EVENTS then kb = EventHandler:new("kb") kb:ProcessEvent(event, arg, family) end if LHC_EVENTS then lhc = EventHandler:new("lhc") lhc:ProcessEvent(event, arg, family) end poll = Poll:new(POLL_FAMILY, POLL_DELAY) poll:start() _onActivation(event, arg, family) else _GetRunningTime = poll:GetRunningTime() if KB_EVENTS then kb:ProcessEvent(event, arg, family) end if LHC_EVENTS then lhc:ProcessEvent(event, arg, family) end _OnEvent(event, arg, family) -- Runs myOnEvent to compartmentalize end if KB_EVENTS then kb:CleanupAfterEvent() end if LHC_EVENTS then lhc:CleanupAfterEvent() end poll:run(event,arg,family) end function log(...) if ... == nil then error("log(...) cannot display nil\n",2) end OutputLogMessage(...) end function Type(v) if type(v) == "table" then if v.Type ~= nil then return v.Type elseif v.type ~= nil then return v.type end end return type(v) end -------------------------------------------------- -------------------------------------------------- -------- -- function Poll:new(family, delay) delay is sleep time between polls -- function Poll:run(event, arg, family) handles events and performs the polling as long as it's running -- function Poll:setMKeyModifier( m1, m2, m3, family ) Allows the use of Modifiers to change M pages -- function Poll:start() turn on polling -- function Poll:stop() stop polling -- function Poll:_press() NOT TO BE USED -- function Poll:release() NOT TO BE USED -- function Poll:setMKeyState(MKeyState) NOT TO BE USED -------------------------------------------------- -------------------------------------------------- -------- Poll = {} Poll.__index = Poll function Poll:new(family, delay) local self = {} self.delay = delay or 50 if family ~= "kb" and family ~= "lhc" then error("Poll:new() - 'pFamily' must be 'kb' or 'lhc'", 2) end self.pFamily = family self.presses = 0 self.running = false self.runMKeyModifier = false self.MKeyModifier = { nil, nil, nil } -- "default" or Modifiers. i.e. "lshift", "ctrl" self.modFamily = "" self.Type = "Poll" self.counter = 1.0 self.lastGetRunningTimeCounter = 0.0 self.lastGetRunningTime = 0 setmetatable(self, Poll) return self end -------------------------------------------------- ------------------------------------------ -- Poll:setMKeyModifier( m1, m2, m3, family ) -- Sets what modifiers will change you to the associated M page of the device on family -- "shift", "ctrl", "alt", "lshift", "lctrl", "lalt"... are all modifiers -- "default" is the page that will be set when none of the listed modifiers are pressed -- "" will cause a page to be ignored. -- I.E. - Poll:setMKeyModifier( "default", "shift", "ctrl", "lhc" ) -- will set the default page to m1, shift will change you to m2, ctrl to m3 on a left hand controler -------------------------------------------------- ------------------------------------------ function Poll:setMKeyModifier( m1, m2, m3, family ) self.runMKeyModifier = true self.MKeyModifier[1] = m1 self.MKeyModifier[2] = m2 self.MKeyModifier[3] = m3 if family ~= "kb" and family ~= "lhc" then error("Poll:setMKeyModifier() family - needs to be 'kb' or 'lhc'",2) end self.modFamily = family end function Poll:start() self.running = true self:setMKeyState() end function Poll:stop() self.running = false end function Poll:_press() if self.running then self.presses = self.presses + 1 end end function Poll:release() if self.running then self.presses = self.presses - 1 end end function Poll:setMKeyState() if self.runMKeyModifier then local default = nil local i = 1 local modMKeyState = nil for i = 1, 3, 1 do if self.MKeyModifier[i] == "default" then default = i elseif self.MKeyModifier[i] == "" then -- do nothing elseif string.find(self.MKeyModifier[i],"mb%d") then local iMB = tonumber(string.sub(self.MKeyModifier[i],3)) if IsMouseButtonPressed(iMB) then modMKeyState = i end elseif IsModifierPressed(self.MKeyModifier[i]) then modMKeyState = i end end if modMKeyState == nil then modMKeyState = default end if modMKeyState ~= nil then if self.pFamily == self.modFamily then SetMKeyState(modMKeyState, self.pFamily) return elseif GetMKeyState(self.modFamily) ~= modMKeyState then SetMKeyState(modMKeyState, self.modFamily) end end end SetMKeyState( GetMKeyState(self.pFamily), self.pFamily ) end function Poll:run(event, arg, family) if self.running and self.pFamily == family then if event == "M_PRESSED" then self:_press() if self.presses == 1 then Sleep(self.delay) self.counter = self.counter + 1 end elseif event == "M_RELEASED" then if self.presses == 1 then self:setMKeyState() Sleep(self.delay) self.counter = self.counter + 1 end self:release() end end end function Poll:GetRunningTime() return GetRunningTime() end
Re: G13 - how to fast switch
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-16-2012 03:30 PM
That ability is the main reason I use a G13 and not a Nostromo n52.
Re: G13 - how to fast switch
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-18-2012 04:02 AM
Thanks very much bystander. I just tried your script and it works.
There is just one thing that I mentioned in a post above that would really improve this script.
Right now, when you have a key pressed (say G4=w to run) when you click the mouse button to switch from M1 to M2 it immediately presses whatever key W is on M2 (G4=2 in my case). So everytime you want to use an ability bound to M2
you have to stop moving before the switch or ability 2 will be activated. You understand how annpying this can be in fast paced gaming.
Can you make it so M2 keys only work when pressed and not if already pressed when you enter the state M2?
Thanks again.
PS. If only games like ME3 allowed to bind SHIFT+smth like mmos do, we wouldnt need all this :/
Re: G13 - how to fast switch
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-18-2012 07:42 AM
I personally have always made sure the movement key locations (joystick) are always the same for all M pages.
