• Dear Guest,

    You're browsing our forum as a Guest meaning you can only see a portion of the forum in read-only mode.
    To view all forum nodes and be able to create threads/posts please register or log-in with your existing account.

    TwinStar team

Very Simple Keypress DO IT YOURSELF!

Joined
Jul 9, 2015
Likes
2
#1
Go to WoW interface ADDON.

Create a folder MyKeyPress.
Create a txt file with the name MyKeyPress, change the extension to .lua
Create a txt file with the name MyKeyPress, change the extension to .toc

In the .toc file type
Code:
## Interface: 11200
MyKeyPress.lua
In the .lua file type
Code:
OldActionButtonDown = ActionButtonDown;
OldActionButtonUp = ActionButtonUp;


function ActionButtonDown(arg1,arg2,arg3) 
    OldActionButtonDown(arg1,arg2,arg3) 
    OldActionButtonUp(arg1,arg2,arg3) 
end 


function ActionButtonUp() end
Enjoy a no bug very compatible keypress addon.
 
Joined
Mar 18, 2021
Likes
0
#3
Great example!

I created a simple addon too - it toggles between Find Herbs and Find Minerals with a hotkey:

Create a folder named "ToggleGather" and inside that foloder, create the following files: ToggleGather.toc - Bindings.xml - ToggleGather.lua

ToggleGather.toc:
Code:
## Interface: 11200
## Notes: Toggle between Find Minerals and Find Herbs with a single key

ToggleGather.lua

Bindings.xml:
Code:
<Bindings>
  <Binding name="TOGGLEGATHER" header="TOGGLEGATHER">
    ToggleGather();
  </Binding>
</Bindings>

ToggleGather.lua:
Code:
function ToggleGather()
  seconds2 = GetTime();
  seconds = seconds2 - seconds1;
  seconds1 = seconds2;
  if (seconds > 1) then
    find = 1 - find;
    if (find == 1) then
      CastSpellByName("Find Minerals");
    else
      CastSpellByName("Find Herbs");
    end;
  end;
--  echo(seconds);
end

find = 0;
seconds1 = GetTime();

-------------- bindings
BINDING_HEADER_TOGGLEGATHER = "Toggle Gather"

BINDING_NAME_TOGGLEGATHER = "Toggle Finding Herbs / Minerals"
Download the addon here - https://github.com/FrostShock/ToggleGather
 
Top Bottom