From f957ea25118c5e25baeef53515615210a0165a98 Mon Sep 17 00:00:00 2001 From: dscarpac Date: Wed, 31 Jul 2024 15:36:43 -0500 Subject: [PATCH] more changes --- src/playercards/cards/NkosiMabati3.ttslua | 51 +++++++++++++---------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/src/playercards/cards/NkosiMabati3.ttslua b/src/playercards/cards/NkosiMabati3.ttslua index 91208972..e5cf8643 100644 --- a/src/playercards/cards/NkosiMabati3.ttslua +++ b/src/playercards/cards/NkosiMabati3.ttslua @@ -27,15 +27,17 @@ function updateSave() end function onLoad(savedData) - syncDisplayWithOptionPanel() if savedData and savedData ~= "" then local loadedData = JSON.decode(savedData) isHelperEnabled = loadedData.isHelperEnabled sigil = loadedData.sigil - makeXMLButton() + if sigil and sigil ~= nil then + makeXMLButton() + end self.clearContextMenu() self.addContextMenuItem("Clear Helper", toggleHelper) end + syncDisplayWithOptionPanel() end function makeXMLButton() @@ -67,30 +69,35 @@ function makeXMLButton() } } ) + updateSave() end -- Create XML button to prompt choosing a sigil; acts as this card's helper function initialize() - self.UI.setXmlTable({ - { - tag = "Button", - attributes = { - height = 450, - width = 1400, - rotation = "0 0 180", - scale = "0.1 0.1 1", - position = "0 -55 -22", - padding = "50 50 50 50", - font = "font_teutonic-arkham", - fontSize = 300, - onClick = "chooseSigil", - color = "#77674DE6", - textColor = "White" - }, - value = "Choose Sigil" + if sigil and sigil ~= nil then + makeXMLButton() + else + self.UI.setXmlTable({ + { + tag = "Button", + attributes = { + height = 450, + width = 1400, + rotation = "0 0 180", + scale = "0.1 0.1 1", + position = "0 -55 -22", + padding = "50 50 50 50", + font = "font_teutonic-arkham", + fontSize = 300, + onClick = "chooseSigil", + color = "#77674DE6", + textColor = "White" + }, + value = "Choose Sigil" + } } - } - ) + ) + end end -- Create dialog window to choose sigil and create sigil-drawing button @@ -112,11 +119,13 @@ function chooseSigil(player) makeXMLButton() end ) + updateSave() end function shutOff() self.UI.setXml("") sigil = nil + updateSave() end function resolveSigil()