The KGB Oracle
Serving the online gaming community since 1997
Visit www.the-kgb.com
For additional information

Join KGB DISCORD: http://discord.gg/KGB
 
KGB Information
Untitled 1

Visit KGB HQ
www.the-kgb.com

Who's Online Now
0 members (), 26 guests, and 26 robots.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Today's Birthdays
There are no members with birthdays on this day.
Newest Members
Luckystrikes, Shingen, BillNyeCommieSpy, Lamp, AllenGlines
1,477 Registered Users
Forum Statistics
Forums53
Topics13,095
Posts116,357
Members1,477
Most Online276
Aug 3rd, 2023
Top Likes Received (30 Days)
None yet
Top Posters(30 Days)
Sini 1
Popular Topics(Views)
2,051,082 Trump card
1,346,923 Picture Thread
482,555 Romney
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 4 of 4 1 2 3 4
Joined: Aug 2006
Posts: 3,147
Likes: 14
Former KGB Member
***
Offline
Former KGB Member
***
Joined: Aug 2006
Posts: 3,147
Likes: 14
Serious Bumpage..lol


[Linked Image from nodiatis.com]
Joined: Nov 2005
Posts: 1,876
Likes: 10
Arkh Offline OP
KGB Supreme Court Justice
KGB Supreme Knight
****
OP Offline
KGB Supreme Court Justice
KGB Supreme Knight
****
Joined: Nov 2005
Posts: 1,876
Likes: 10
Sorry, I'll be online after work. But first thing : download the last logitech drivers.

Then you have to have to open the script editor and copy-pasta the script code (last version end of this post) and select "script" as the key action.
There is a big "keyArray" array in it, it contains all the bound key I have, so for example, if I'm on M3, the G18 key will let me cycle through my self-buffs.

Here is my current script :
Code:
keyArray = {
                { -- Profile 1
                    [3] = {"alt+F9", "alt+F10", "alt+F11"},     -- heal self
                    [5] = {"alt+F1", "alt+F2"}, -- haste and rapidshot
                    [13] = {"shift+F1", "shift+F2", "shift+F3", "shift+F4", "J", "M"}, -- first wards
                    [16] = {"shift+F5", "shift+F6", "shift+F7", "shift+F8", "shift+F9"}, -- stats buffs
                    [17] = {"ctrl+F1", "ctrl+F2", "ctrl+F3", "ctrl+F4", "ctrl+F5", "ctrl+F6"}, -- secondary wards
                    [18] = {"alt+8", "alt+9", "alt+0", "ctrl+1", "ctrl+2"}, -- secondary self buffs
                    [19] = {"ctrl+3", "ctrl+4"}, -- heal other
                    [22] = {"alt+F6", "ctrl+U", "ctrl+I", "ctrl+O"} -- Utility spells
               },
                { -- Profile 2
                },
                { -- Profile 3
                    [2] = {"alt+L"}, -- ray AoE clouds "alt+K", 
                    [3] = {"alt+F9", "alt+F10", "alt+F11"},     -- heal self
                    [5] = {"shift+F10", "shift+F11", "shift+F12"}, -- utility rays
                    [9] = {"alt+O", "alt+J"}, -- big AoEs
                    [13] = {"alt+I", "K"},                                     -- r50 nukes
                    [16] = {"ctrl+N", "ctrl+B", "ctrl+5", "ctrl+6", "ctrl+7", "ctrl+8"},      -- melee debuffs
                    [17] = {"shift+V", "shift+N"}, -- caster debuffs
                    [18] = {"alt+1", "alt+2", "alt+3", "alt+4", "alt+5", "alt+6", "alt+7"}, -- primary self buff
                    [19] = {"ctrl+3", "ctrl+4"}, -- heal other
                    [22] = {"alt+F6", "ctrl+U", "ctrl+I", "ctrl+O"} -- Utility spells
                }
            };
-- list of macros to launch. Format : key = {"macro name", "profile to activate"}
macros = { [26] = {"2Hander", 2},
           [27] = {"Bow", 2},
           [28] = {"staff", 3},
           [29] = {"1Hander", 2},
           [25] = {"staff", 1}};
indexes = {{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1, 1, 1, 1, 1, 1, 1, 1},
            {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1, 1, 1, 1, 1, 1, 1, 1},
            {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1, 1, 1, 1, 1, 1, 1, 1}};
-- when the profile is changed the pad lose all pressed key, so we have to manage this
movements = {[4] = "W",
             [10] = "A",
             [11] = "S",
             [12] = "D"};
lastGkey = 0;
profile = 1;
lastMacro = 0;

function OnEvent(event, arg)
    if (event=="G_PRESSED" and arg ~=1) then
        -- gets profile number
        profile = GetMKeyState();
        pushKey(arg);
    end

    if (event=="G_RELEASED" and movements[arg]) then
        releaseKey(arg);
    end
    -- loot key, usefull for moving stuff quick (like 2000 pants)
    if(event=="G_PRESSED" and arg==1) then
        x, y = GetMousePosition();
        PressMouseButton(1);
        Sleep(10);
        MoveMouseTo(26532, 48321);
        Sleep(10);
        ReleaseMouseButton(1);
        Sleep(10);
        MoveMouseTo(x, y);
    end
end

function releaseKey(gkey)
   ReleaseKey(movements[gkey]);
end

function pushKey(gkey)
    -- launch macro if needed
    if(macros[gkey]) then
        macroKey(gkey);
        return;
    end

    -- manage movement if needed
    if(movements[gkey]) then
        PressKey(movements[gkey]);
        return;
    end

    if(not keyArray[profile][gkey]) then
        return;
    end

    -- gets key name
    -- we check if the last gkey used was the same, if yes, cycle
    if(lastGkey > 0 and lastGkey == gkey) then
        indexes[profile][gkey] = indexes[profile][gkey] + 1;
        if(indexes[profile][gkey] > table.getn(keyArray[profile][gkey])) then
            indexes[profile][gkey] = 1;
        end
    end
    lastGkey = gkey;
    i = indexes[profile][gkey];
    keyString = keyArray[profile][gkey][i];

    -- we get modifiers to use
    toCtrl = false;
    toAlt = false;
    toShift = false;
    if(string.find(keyString, "ctrl")) then
        toCtrl = true;
    end
    if(string.find(keyString, "alt")) then
        toAlt = true;
    end
    if(string.find(keyString, "shift")) then
        toShift = true;
    end

    -- now, we clean the key string to extract only the key
    keyString = string.gsub(keyString, "ctrl", "");
    keyString = string.gsub(keyString, "alt", "");
    keyString = string.gsub(keyString, "shift", "");
    keyString = string.gsub(keyString, "\+", "");
    key = string.gsub(keyString, " ", "");

    -- press modifiers
    if toCtrl then
       PressKey("lctrl");
    end
    if toAlt then
        PressKey("lalt");
    end
    if toShift then
        PressKey("lshift");
    end

    -- press and release key
    PressAndReleaseKey(key);

    -- release modifiers
    if toCtrl then
        ReleaseKey("lctrl");
    end
    if toAlt then
        ReleaseKey("lalt");
    end
    if toShift then
        ReleaseKey("lshift");
    end
end

-- I have macros set for these keys and some need to change the active profile
function macroKey(key)
    if(lastMacro ~= key) then
        -- Abort old macro
        AbortMacro();
    end
    oldState = GetMKeyState();
    -- Activate macro
    PlayMacro(macros[key][1]);
    -- Change profile
    SetMKeyState(macros[key][2]);
end

Last edited by Arkh; 04/27/10 11:18 PM.

[Linked Image from w3.the-kgb.com][Linked Image from w3.the-kgb.com]
Arkh #64553 04/30/10 08:37 AM
Joined: Aug 2006
Posts: 3,147
Likes: 14
Former KGB Member
***
Offline
Former KGB Member
***
Joined: Aug 2006
Posts: 3,147
Likes: 14
Thanks Arkh my friend. I will be messing with this trying to figure it out. I live in EST USA...give me some compatible times to find you online so I can mooch your help..lol


[Linked Image from nodiatis.com]
Joined: Nov 2005
Posts: 1,876
Likes: 10
Arkh Offline OP
KGB Supreme Court Justice
KGB Supreme Knight
****
OP Offline
KGB Supreme Court Justice
KGB Supreme Knight
****
Joined: Nov 2005
Posts: 1,876
Likes: 10
All week-end long. And you can bother other script users : Mor, Kray, Ehwol etc.


[Linked Image from w3.the-kgb.com][Linked Image from w3.the-kgb.com]
Arkh #69702 06/27/10 12:18 PM
Joined: Nov 2005
Posts: 1,876
Likes: 10
Arkh Offline OP
KGB Supreme Court Justice
KGB Supreme Knight
****
OP Offline
KGB Supreme Court Justice
KGB Supreme Knight
****
Joined: Nov 2005
Posts: 1,876
Likes: 10
Update for Krull. Not tested atm tho.
It adds the rctrl, ralt and rshift modifier so you can bind things with the right ctrl, alt and shift keys. To use them, instead of doing something like alt+f1, just do ralt+f1 for example.
I also removed a little bug there was.
Code:
keyArray = {
                { -- Profile 1
                    [3] = {"alt+F9", "alt+F10", "alt+F11"},     -- heal self
                    [5] = {"alt+F1", "alt+F2", "shift+F3"}, -- haste and rapidshot
                    [13] = {"shift+F4", "shift+F1", "shift+F2", "J", "M"}, -- first wards
                    [16] = {"shift+F5", "shift+F6", "shift+F7", "shift+F8", "shift+F9"}, -- stats buffs
                    [17] = {"ctrl+F1", "ctrl+F2", "ctrl+F3", "ctrl+F4", "ctrl+F5", "ctrl+F6"}, -- secondary wards
                    [18] = {"alt+8", "alt+9", "alt+0", "ctrl+1"}, -- secondary self buffs
                    [19] = {"ctrl+3", "ctrl+4"}, -- heal other
                    [22] = {"alt+F6", "ctrl+U", "ctrl+I", "ctrl+O"} -- Utility spells
               },
                { -- Profile 2
                },
                { -- Profile 3
                    [2] = {"alt+L"}, -- ray AoE clouds "alt+K", 
                    [3] = {"alt+F9", "alt+F10", "alt+F11"},     -- heal self
                    [5] = {"shift+F10", "shift+F11", "shift+F12"}, -- utility rays
                    [9] = {"alt+O", "alt+J"}, -- big AoEs
                    [13] = {"K", "alt+I"},                                     -- r50 nukes
                    [16] = {"ctrl+N", "ctrl+8", "ctrl+5", "ctrl+6", "ctrl+7", "ctrl+B"},      -- melee debuffs
                    [17] = {"shift+N", "shift+V"}, -- caster debuffs
                    [18] = {"alt+1", "alt+2", "alt+3", "alt+4", "alt+5", "alt+6", "alt+7", "ctrl+2"}, -- primary self buff
                    [19] = {"ctrl+3", "ctrl+4"}, -- heal other
                    [22] = {"alt+F6", "ctrl+U", "ctrl+I", "ctrl+O"} -- Utility spells
                }
            };
-- list of macros to launch. Format : key = {"macro name", "profile to activate"}
macros = { [26] = {"2Hander", 2},
           [27] = {"Bow", 2},
           [28] = {"staff", 3},
           [29] = {"1Hander", 2},
           [25] = {"staff", 1}};
indexes = {{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1, 1, 1, 1, 1, 1, 1, 1},
            {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1, 1, 1, 1, 1, 1, 1, 1},
            {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1, 1, 1, 1, 1, 1, 1, 1}};

lastGkey = 0;
profile = 1;
lastMacro = 0;

function OnEvent(event, arg)
    if (event=="G_PRESSED" and arg ~=1) then
        -- gets profile number
        profile = GetMKeyState();
        pushKey(arg);
    end

    -- loot key, usefull for moving stuff quick (like 2000 pants)
    if(event=="G_PRESSED" and arg==1) then
        x, y = GetMousePosition();
        PressMouseButton(1);
        Sleep(10);
        MoveMouseTo(26532, 48321);
        Sleep(10);
        ReleaseMouseButton(1);
        Sleep(10);
        MoveMouseTo(x, y);
    end
end

function releaseKey(gkey)
   ReleaseKey(movements[gkey]);
end

function pushKey(gkey)
    -- launch macro if needed
    if(macros[gkey]) then
        macroKey(gkey);
        return;
    end

    if(not keyArray[profile][gkey]) then
        return;
    end

    -- gets key name
    -- we check if the last gkey used was the same, if yes, cycle
    if(lastGkey > 0 and lastGkey == gkey) then
        indexes[profile][gkey] = indexes[profile][gkey] + 1;
        if(indexes[profile][gkey] > table.getn(keyArray[profile][gkey])) then
            indexes[profile][gkey] = 1;
        end
    end
    lastGkey = gkey;
    i = indexes[profile][gkey];
    keyString = keyArray[profile][gkey][i];

    -- we get modifiers to use
    toRCtrl = false;
    toRAlt = false;
    toRShift = false;
    toCtrl = false;
    toAlt = false;
    toShift = false;
    if(string.find(keyString, "rctrl")) then
        toRCtrl = true;
	keyString = string.gsub(keyString, "rctrl", "");
    end

    if(string.find(keyString, "ctrl")) then
        toCtrl = true;
	keyString = string.gsub(keyString, "ctrl", "");
    end

    if(string.find(keyString, "ralt")) then
        toRAlt = true;
    	keyString = string.gsub(keyString, "ralt", "");
    end

    if(string.find(keyString, "alt")) then
        toAlt = true;
	keyString = string.gsub(keyString, "alt", "");
    end

    if(string.find(keyString, "rshift")) then
        toRShift = true;
    	keyString = string.gsub(keyString, "rshift", "");
    end

    if(string.find(keyString, "shift")) then
        toShift = true;
	keyString = string.gsub(keyString, "shift", "");
    end

    -- now, we clean the key string to extract only the key
    keyString = string.gsub(keyString, "\+", "");
    key = string.gsub(keyString, " ", "");

    -- press modifiers
    if toCtrl then
       PressKey("lctrl");
    end
    if toAlt then
        PressKey("lalt");
    end
    if toShift then
        PressKey("lshift");
    end

    if toRCtrl then
       PressKey("rctrl");
    end
    if toRAlt then
        PressKey("ralt");
    end
    if toRShift then
        PressKey("rshift");
    end

    -- press and release key
    PressAndReleaseKey(key);

    -- release modifiers
    if toCtrl then
        ReleaseKey("lctrl");
    end
    if toAlt then
        ReleaseKey("lalt");
    end
    if toShift then
        ReleaseKey("lshift");
    end
    if toRCtrl then
        ReleaseKey("rctrl");
    end
    if toRAlt then
        ReleaseKey("ralt");
    end
    if toRShift then
        ReleaseKey("rshift");
    end
end

-- I have macros set for these keys and some need to change the active profile
function macroKey(key)
    if(lastMacro ~= key) then
        -- Abort old macro
        AbortMacro();
    end
    -- Activate macro
    lastMacro = key;
    PlayMacro(macros[key][1]);
    -- Change profile
    if (profile ~= macros[key][2]) then
        SetMKeyState(macros[key][2]);
        indexes = {{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1, 1, 1, 1, 1, 1, 1, 1},
                    {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1, 1, 1, 1, 1, 1, 1, 1},
                    {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1, 1, 1, 1, 1, 1, 1, 1}};
    end
end


[Linked Image from w3.the-kgb.com][Linked Image from w3.the-kgb.com]
Page 4 of 4 1 2 3 4

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.5