Execute LUA

Use this event if you want to execute one or more LUA commands.

You can combine official LUA commands with custom LUA commands (line by line).

Index


Official Commands

The official WoW LUA API comes with a bunch of commands and functions that anyone can access and use.

Here you can find a clear list.

These commands have different execution levels. Most can be executed individually or in combination directly. Others require a hardware event and can only be executed with a mouse click or key press.

  • Copy the following command into the LUA event text field.

print("My name is "..UnitName("player")..".")
  • Click on the "Test" button to test the command.

  • The output in your in-game chat should look like this:

Since this command doesn't really give us anything, we'll build ourselves a little conditional query to check if we have a Hearthstone in our bags:

if GetItemCount(6948) == 1 then
    print("Yay, i have a Hearthstone in my bag.")
else
    print("I have no Hearthstone in my bag ;(")
end

Also possible as a function:

function CheckMyHearthstone()
    if GetItemCount(6948) >= 1 then
        print("Yay, i have a Hearthstone in my bag.")
    else
        print("I have no Hearthstone in my bag ;(")
    end
end

CheckMyHearthstone()

If a function is passed, it remains until the next reload of the game.

Alternatively, we can trigger commands or a conditional query as a Key Press event by placing a /run in front of it.

/run print("My name is "..UnitName("player")..".")

Enter commands line by line if you want to execute several in a row:

/run print("My name is "..UnitName("player")..".")
/dance

Custom Commands

  • Click on "Show custom commands" to display a list and descriptions of all custom commands.

To explain the structure, we click on the "WaitForNPC" command on the left.

  1. Name of the command.

  2. Duty Argument.

  3. Optional arguments.

WaitForNPC("NameOrID" [, "MaximumWaitTime", "DistanceInYards", "DeadOrAlive"])

All arguments in square brackets are optional.

  1. Description of the command and what it does.

  2. Description of all arguments and what influence they can have.

  3. Example(s) of correct execution of the command.

We have here a command with 4 arguments. One mandatory and three optional.

First we look for the name or ID of the NPC we want to wait for. We simply take the ID "12345" as an example.

The simplest execution of the command would now look like this:

WaitForNPC("12345")

If we now want to change the maximum waiting time, we extend the command and specify a waiting time of 30 seconds:

WaitForNPC("12345", "30")

We would now like to extend the maximum search radius to 60 yards:

WaitForNPC("12345", "30", "60")

If we assume that we are looking for a dead target, we set the DeadOrAlive argument to "0":

WaitForNPC("12345", "30", "60", "0")

Custom LUA commands cannot be tested.