- set sandboxed to false for both modules (otui)
- create a variable that isn't local
- use same function to enable/disable both buttons at the same time
thought you're more advanced judging by the heavily modded client you're using
1. yes
2. that button on the console I think, it's only thing you need to access through other module
3. yeah, should be togglechat
actionsWindow = nil
actionsPanel = nil
chaseModeButton = nil
function init()
actionsWindow = g_ui.loadUI('actions', modules.game_interface.getRightPanel())
actionsWindow:open()
actionsWindow:disableResize()
actionsPanel = actionsWindow:getChildById('contentsPanel')
chaseModeButton = actionsWindow:recursiveGetChildById('chaseModeBox')
connect(chaseModeButton, { onCheckChange = onSetChaseMode })
connect(g_game, {
onGameStart = online,
onGameEnd = offline,
onChaseModeChange = update
})
if g_game.isOnline() then
online()
end
actionsWindow:setup()
end
function terminate()
if g_game.isOnline() then
offline()
end
actionsWindow:destroy()
disconnect(g_game, {
onGameStart = online,
onGameEnd = offline,
onChaseModeChange = update
})
end
function update()
local chaseMode = g_game.getChaseMode()
chaseModeButton:setChecked(chaseMode == ChaseOpponent)
end
function check()
if modules.client_options.getOption('autoChaseOverride') then
if g_game.isAttacking() and g_game.getChaseMode() == ChaseOpponent then
g_game.setChaseMode(DontChase)
end
end
end
function onSetChaseMode(self, checked)
local chaseMode
if checked then
chaseMode = ChaseOpponent
else
chaseMode = DontChase
end
g_game.setChaseMode(chaseMode)
end
function getActions()
return actionsWindow
end
MiniWindow
id: actionsWindow
!text: tr('Actions')
height: 197
width: 165
MiniWindowContents
InsideWindow
id: insidewindow1
size: 151 42
image-border: 3
anchors.top: parent.top
anchors.left: parent.left
margin-top: 3
margin-left: 4
ActionButton
id: button1
!text: tr('Buy Premium Cards')
font: verdana-11px-rounded
color: #82ff82
size: 149 20
anchors.top: insidewindow1.top
anchors.left: insidewindow1.left
margin-top: 1
margin-left: 1
ActionButton
id: button2
!text: tr('Open Premium Shop')
font: verdana-11px-rounded
color: #82ff82
size: 149 20
anchors.top: button1.bottom
anchors.left: button1.left
margin-top: 1
InsideWindow
id: insidewindow2
size: 151 22
image-border: 3
anchors.top: insidewindow1.bottom
anchors.left: insidewindow1.left
margin-top: 5
CheckBox2
id: chaseModeBox
!text: tr('Autofollow')
font: verdana-11px-rounded
color: #c8c8c8
size: 74 20
anchors.top: insidewindow2.top
anchors.left: insidewindow2.left
margin-top: 1
margin-left: 1
CheckBox2
id: toggleChat
!text: tr('Fightmode')
font: verdana-11px-rounded
color: #c8c8c8
size: 74 20
anchors.top: insidewindow2.top
anchors.left: chaseModeBox.right
anchors.right: insidewindow2.right
margin-top: 1
margin-left: 1
margin-right: 1
@onCheckChange: modules.game_console.toggleChat()
InsideWindow
id: insidewindow3
size: 151 82
image-border: 3
anchors.top: insidewindow2.bottom
anchors.left: insidewindow2.left
margin-top: 5
ActionButton
id: button4
!text: tr('Quests')
font: verdana-11px-rounded
color: #c8c8c8
size: 74 20
anchors.top: insidewindow3.top
anchors.left: insidewindow3.left
margin-top: 1
margin-left: 1
ActionButton
id: button5
!text: tr('Spells')
font: verdana-11px-rounded
color: #c8c8c8
size: 74 20
anchors.top: insidewindow3.top
anchors.left: button4.right
anchors.right: insidewindow3.right
margin-top: 1
margin-left: 1
margin-right: 1
ActionButton
id: button6
!text: tr('Talents')
font: verdana-11px-rounded
color: #c8c8c8
size: 74 20
anchors.top: button4.bottom
anchors.left: button4.left
margin-top: 1
ActionButton
id: button7
!text: tr('Guild')
font: verdana-11px-rounded
color: #c8c8c8
size: 74 20
anchors.top: button6.top
anchors.left: button6.right
anchors.right: insidewindow3.right
margin-left: 1
margin-right: 1
ActionButton
id: button8
!text: tr('Options')
font: verdana-11px-rounded
color: #c8c8c8
size: 149 20
anchors.top: button6.bottom
anchors.left: button6.left
margin-top: 1
@onClick: modules.client_options.show()
ActionButton
id: button9
!text: tr('Logout')
font: verdana-11px-rounded
color: #c8c8c8
size: 149 20
anchors.top: button8.bottom
anchors.left: button8.left
margin-top: 1
@onClick: g_game.safeLogout()
function toggleChat()
if toggleChat:isChecked() then
consoleToggleChat:setChecked(true)
else
consoleToggleChat:setChecked(false)
end
end
ERROR: protected lua call failed: LUA ERROR:
/game_actions/actions.lua:32: attempt to index global 'buttonChat' (a nil value)
stack traceback:
[C]: in function '__index'
/game_actions/actions.lua:32: in function 'ligaChat'
/game_actions/actions.otui:69: [@onCheckChange]:2: in function </game_actions/actions.otui:69: [@onCheckChange]:1>
[C]: in function 'setChecked'
/corelib/ui/uicheckbox.lua:12: in function </corelib/ui/uicheckbox.lua:11>
actionsWindow = nil
actionsPanel = nil
chaseModeButton = nil
function init()
actionsWindow = g_ui.loadUI('actions', modules.game_interface.getRightPanel())
actionsWindow:open()
actionsWindow:disableResize()
actionsPanel = actionsWindow:getChildById('contentsPanel')
chaseModeButton = actionsWindow:recursiveGetChildById('chaseModeBox')
connect(chaseModeButton, { onCheckChange = onSetChaseMode })
connect(g_game, {
onGameStart = online,
onGameEnd = offline,
onChaseModeChange = update
})
if g_game.isOnline() then
online()
end
actionsWindow:setup()
end
function ligaChat()
local buttonChat = actionsWindow:recursiveGetChildById('actionsToggleChat')
if buttonChat:isChecked() then
consoleToggleChat:setChecked(true)
else
consoleToggleChat:setChecked(false)
end
end
function terminate()
if g_game.isOnline() then
offline()
end
actionsWindow:destroy()
disconnect(g_game, {
onGameStart = online,
onGameEnd = offline,
onChaseModeChange = update
})
end
function update()
local chaseMode = g_game.getChaseMode()
chaseModeButton:setChecked(chaseMode == ChaseOpponent)
end
function check()
if modules.client_options.getOption('autoChaseOverride') then
if g_game.isAttacking() and g_game.getChaseMode() == ChaseOpponent then
g_game.setChaseMode(DontChase)
end
end
end
function onSetChaseMode(self, checked)
local chaseMode
if checked then
chaseMode = ChaseOpponent
else
chaseMode = DontChase
end
g_game.setChaseMode(chaseMode)
end
function getActions()
return actionsWindow
end
function ligaChat()
local buttonChat = actionsWindow:recursiveGetChildById('actionsToggleChat')
if buttonChat:isChecked() then
consoleToggleChat:setChecked(true)
else
consoleToggleChat:setChecked(false)
end
end
- set sandboxed to false for both modules (otui)
- create a variable that isn't local
- use same function to enable/disable both buttons at the same time