2023-05-14 00:36
#0
The following code changes to the EC will allow you to script pressing buttons in the legacy rune books.
To the file source\LegacyRunebook.lua
Modify the function LegacyRunebook.OnRuneClicked
To select the first rune use the following script command
script LegacyRunebook.ClickOnRune(1)
To select the recall button use the following script command
script LegacyRunebook.ClickDefaultButton(3)
The button numbers to use with ClickDefaultButton are
To the file source\LegacyRunebook.lua
Modify the function LegacyRunebook.OnRuneClicked
function LegacyRunebook.OnRuneClicked()
local windowName = WindowUtils.GetActiveDialog()
local buttonNum = WindowGetId(SystemData.ActiveWindow.name)
local self = LegacyRunebook.knownWindows[windowName]
--start of added code
LegacyRunebook.RuneClicked(windowName, buttonNum, self)
end
function LegacyRunebook.ClickOnRune(runeNumber)
local windowName = "LEGACY_Runebook_GUMP-1"
local buttonNum = runeNumber
local self = nil
local index = 0
while(self == nil and index < 100000)
do
index = index + 1
windowName = "LEGACY_Runebook_GUMP-"..index
self = LegacyRunebook.knownWindows[windowName]
end
LegacyRunebook.RuneClicked(windowName, buttonNum, self)
end
function LegacyRunebook.RuneClicked(windowName, buttonNum, self)
--end of added code
if(self) then
Modify the function LegacyRunebook.OnDefaultClicked
function LegacyRunebook.OnDefaultClicked()
local currWindow = WindowUtils.GetActiveDialog()
local buttonNum = WindowGetId(SystemData.ActiveWindow.name)
local self = LegacyRunebook.knownWindows[currWindow]
--start of added code
LegacyRunebook.DefaultButtonClicked(currWindow, buttonNum, self)
end
function LegacyRunebook.ClickDefaultButton(buttonNum)
local currWindow = "LEGACY_Runebook_GUMP-1"
local self = nil
local index = 0
while(self == nil and index < 100000)
do
index = index + 1
currWindow = "LEGACY_Runebook_GUMP-"..index
self = LegacyRunebook.knownWindows[currWindow]
end
LegacyRunebook.DefaultButtonClicked(currWindow, buttonNum + 1, self)
end
function LegacyRunebook.DefaultButtonClicked(currWindow, buttonNum, self)
--end of added code
if(self) then
script LegacyRunebook.ClickOnRune(1)
To select the recall button use the following script command
script LegacyRunebook.ClickDefaultButton(3)
The button numbers to use with ClickDefaultButton are
LegacyRunebook.DefaultNum.RENAME_BOOK = 1
LegacyRunebook.DefaultNum.DROP_RUNE = 2
LegacyRunebook.DefaultNum.RECALL = 3
LegacyRunebook.DefaultNum.GATE_TRAVEL = 4
LegacyRunebook.DefaultNum.SACRED = 5
LegacyRunebook.DefaultNum.SET_DEFAULT = 6
