I'm trying to write a function that will cause my character to use a skill based on certain inputs. I found a function in the commands list called UserActionUseSkill(), but I can't locate any documentation on it. The SkillsWindow.lua uses this command to use the skill whenever you click the button in the skills list. Can anyone help?
Code:
function SkillsWindow.SkillLButtonUp()
-- Player is using a skill by single clicking on an icon
--Debug.PrintToDebugConsole(L"SkillsWindow.SkillLButtonUp()")
--Debug.PrintToDebugConsole(L"SkillsWindow.SkillLButtonUp(): window name = "..StringToWString(SystemData.ActiveWindow.name))
local buttonNum = WindowGetId( SystemData.ActiveWindow.name)
--Debug.PrintToDebugConsole(L"SkillsWindow.SkillLButtonUp(): button = "..StringToWString(tostring(buttonNum)))
-- button number is its location on the screen (1 = top of left column, 2 = 2nd in left column, etc with left column done first before starting through the right column)
local tab = data.activeTab
--Debug.PrintToDebugConsole(L"SkillsWindow.SkillLButtonDown(): window name = "..StringToWString(SystemData.ActiveWindow.name))
local activeContent = tabContents[tab]
-- skillIndex is the line index in the csv file for this skill
local skillIndex = activeContent[buttonNum]
local skillId = WindowData.SkillsCSV[skillIndex].ServerId
--Debug.PrintToDebugConsole(L"SkillsWindow.SkillLButtonDown(): tab = "..StringToWString(tostring(tab)))
--Debug.PrintToDebugConsole(L"SkillsWindow.SkillLButtonDown(): skillIndex = "..StringToWString(tostring(skillIndex)))
--Debug.PrintToDebugConsole(L"SkillsWindow.SkillLButtonDown(): skillId = "..StringToWString(tostring(skillId)))
-- if the skill icon is not dragable, then it can't be directly used
if (WindowData.SkillsCSV[skillIndex].DragIcon == 1) then
SkillsWindow.UseSkill (skillId)
else
PrintTidToChatWindow(500014,SystemData.ChatLogFilters.SYSTEM)
end
end
function SkillsWindow.UseSkill (skillId)
-- skillId is the server id for the skill
--Debug.PrintToDebugConsole(L"SkillsWindow.UseSkill(): serverId = "..StringToWString(tostring(skillId)))
UserActionUseSkill(skillId)
end