Minimal coding example:
import QtBind
from phBot import *
gui = None
chk_is_activate = None
def init_gui():
global gui
global chk_is_activate
gui = QtBind.init(__name__, __name__)
chk_is_activate = QtBind.createCheckBox(gui, 'activate_on_click', 'Activate', 500, 38)
QtBind.setChecked(gui, chk_is_activate, False)
log(f"Default Checked status: {QtBind.isChecked(gui, chk_is_activate)}" )
def activate_on_click(checked):
pass
def joined_game():
global gui
global chk_is_activate
log("Joined game")
active_status = True
QtBind.setChecked(gui, chk_is_activate, active_status)
log(f"Config checked status: {QtBind.isChecked(gui, chk_is_activate)}" )
init_gui()
log("Plugin test loaded")
Am I missing something or why is this printing false in ‘joined_game’?
The actual checkbox is checked in the GUI.
I want to (de)-activate my plugin based on some conditions, therefore I’m using this checked state, but it’s returning false. Currently, I’m reading from a cfg file the activation state, but it’s always set to false.
Is there an alternative way to (de)-activate a plugin? I don’t want all chars to use the plugin, so it’s kinda bothersome doing this is checked stuff in multiple locations, but it’s doing the job.
@Ryan