have shortcut key finction in script?

User avatar
nucular
Site Admin
Posts: 260
Joined: Sat Jan 07, 2017 9:08 pm
Has thanked: 27 times
Been thanked: 388 times

Re: have shortcut key finction in script?

Post by nucular » Fri Mar 10, 2017 10:14 pm

creatine wrote:
Fri Mar 10, 2017 6:08 am
0x00 wrote:
Wed Mar 08, 2017 9:33 am
I think he means like the 0verX script i wrote, a button to turn auto attack on and off
oh yeah regarding those script, i wanna use my mouse wheel button or extra mouse button 1 and 2 to activate the script. do u know what should i write as the activation key?
You have to bind the mouse click to a key, then you can bind the "pseudo key click" to aionscript.

User avatar
0x00
VIP
Posts: 105
Joined: Tue Jan 10, 2017 11:40 pm
Has thanked: 10 times
Been thanked: 23 times

Re: have shortcut key finction in script?

Post by 0x00 » Wed Mar 15, 2017 10:41 am

creatine wrote:
Fri Mar 10, 2017 6:08 am
0x00 wrote:
Wed Mar 08, 2017 9:33 am
I think he means like the 0verX script i wrote, a button to turn auto attack on and off
oh yeah regarding those script, i wanna use my mouse wheel button or extra mouse button 1 and 2 to activate the script. do u know what should i write as the activation key?
Two things: I actually rewrote the entire framework for that function so, check your PMs - your not VIP, this is a one off. Secondly:

Use the files below and replace them with the originals, it should do what you need to. I've skimmed the script to it's basic concept, which is a start/stop grind shortcut key.

OfficialGrinderFramework.lua:

Code: Select all

http://lpaste.net/81206866515853312
OfficialGrinderFramework/GrinderFramework.lua:

Code: Select all

http://lpaste.net/7542220304173498368
To be more specific:

Code: Select all

-- Settings
    -- Check the key codes here (Member Name): http://msdn.microsoft.com/en-us/library/system.windows.input.key.aspx
    Register( "AttackHandle", "Oem8" );
    Register( "UIModHandle", "Insert" );
    Register( "BuffHandle", "Home" );
    Register( "AttackSPDCheckEntity", "End" );
    -- End Settings
This sets the keybinds, means its registering to the function AttackHandle to the ¬ key, amongst a few other keybinds ( I havent pasted the functions associated with them but I'll leave it here so you get an idea how to make a new keybind).

So when you press ¬, this function is called:

Code: Select all

function AttackHandle()
	
	if _AttackStarted ~= nil then
			_AttackStarted = nil;
		        Write("0verkill Mode: DISABLED!");	
		else
			_AttackStarted = true;
			Write("0verkill Mode: DISABLED!");	
	end
end
_AttackStarted is a trigger variable (don't know the official term) - it means if it's been triggered, KEEP running the OnRun() function in GrinderFramework.lua

Code: Select all

function OnRun()
    
    if _AttackStarted ~= nil and Player:GetTargetID() ~= 0 then
        
        local Entity = EntityList:GetEntity( Player:GetTargetId());
        
        if Player:IsDead() then 
            return false;
        end
        if EntityList:GetEntity( Player:GetTargetId()):IsDead() then
            local AggroEntity = Helper:FindTarget( true, Player:GetPosition());
            if AggroEntity ~= nil then
                Player:SetTarget( AggroEntity );
                Player:SetMove( nil );
            end
        return false;
        end
        if Entity:IsGatherable() or Entity:IsPet() or Entity:IsFriendly() or Entity:IsObject() then
            if AggroEntity ~= nil then
                Player:SetTarget( AggroEntity );
                Player:SetMove( nil );	
            end
            return false;
        end
        if Entity:IsHostile() or Entity:IsMonster() or Entity:GetTargetID() == Player:GetID() then
    
            if not Player:IsMoving() and Helper:CheckAvailable( "Attack" ) and (Player:GetPosition():DistanceToPosition( Entity:GetPosition()) <= 35 and Player:GetPosition():DistanceToPosition( Entity:GetPosition()) >= 5) then
                    PlayerInput:Ability( "Attack" );
            elseif Player:GetPosition():DistanceToPosition( Entity:GetPosition()) <= 5 then
                return Controller:Attack( Entity, Entity:GetPosition():DistanceToPosition( Player:GetPosition()), Stunned, true );
            end
        end

    end
end
This is the script part that checks if your Player has a target, what the distance of so called Entity (target) is etc, if yes & in range, call the Controller (the attack routine function, i.e execute Players/Playername.lua) or OfficialGrinderFramework\Classes\Yourclass.lua

NOW you can bind the ¬ key to your mouse key! This whole procedure is what's necessary to do what you asked. Sorry for the details, just thought I'd use the chance to write up a little LUA HOWTO for anyone who's interested.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest