Thread: Refreshing a char sheet?
-
July 4th, 2019, 23:58 #1
- Join Date
- Jun 2018
- Posts
- 31
Refreshing a char sheet?
I have a function that adds widgets, these widgets are dots.
I plan on linking the dots to a shortcut for discipline features.
However as I add dots, the char sheet must be exited and reentered to display the new dots.
How do I refresh the screen?
-
July 5th, 2019, 00:10 #2
/reload might work. Otherwise probably the way you are doing it.
Problems? See; How to Report Issues, Bugs & Problems
On Licensing & Distributing Community Content
Community Contributions: Gemstones, 5E Quick Ref Decal, Adventure Module Creation, Dungeon Trinkets, Balance Disturbed, Dungeon Room Descriptions
Note, I am not a SmiteWorks employee or representative, I'm just a user like you.
-
July 5th, 2019, 02:25 #3
- Join Date
- Jun 2018
- Posts
- 31
Well I was hoping for something like:
inside the template.LUA
function updateStatus()
window.update();
end
Then inside the XML file
Code:function onInit() update(); end function update() local bReadOnly = WindowManager.getReadOnlyState(getDatabaseNode()); name.update(bReadOnly); end
Also here is how I am adding the widgets
Code:local readonlyflag = false; levels = {}; local nMaxSlotRow = 10; local nDefaultSpacing = 10; local nSpacing = nDefaultSpacing; local clicknX = {}; local clicknY = {}; function onInit() setIcon(stateicons[1].off[1]); --initals value as 0 local node = DB.setValue(node, "level", "number", 0); --grab value node = window.getDatabaseNode(); local initialnode = nil; if spacing then nSpacing = tonumber(spacing[1]) or nDefaultSpacing; end setAnchoredHeight(nSpacing*2); setAnchoredWidth(nSpacing); if node then -- Determine readonly state if NodeManager.isReadOnly(node) then readonlyflag = true; end -- Determine the name we should use for the node local srcname = getName(); local srcvalue = node.getChild("level").getValue() local i = 1; while srcvalue >= i do local widget = nil; widget = addBitmapWidget(stateicons[1].on[1]); local nW = (i - 1) % nMaxSlotRow; local nH = math.floor((i - 1) / nMaxSlotRow); local nX = (nSpacing * nW) + math.floor(nSpacing / 2); local nY; if srcvalue > nMaxSlotRow then nY = (nSpacing * nH) + math.floor(nSpacing / 2); else nY = (nSpacing * nH) + nSpacing; end widget.setPosition("topleft", nX, nY); local disciplinename = DB.getValue(node, "name", ""):lower(); local sRecord = "reference.disciplines." .. disciplinename .. "@VtM 20th Anniversary Edition"; local sFormat = Interface.getString("char_message_disciplineadd"); local sMsg = string.format(sFormat, sRecord, DB.getValue(nodeChar, "name", "")); ChatManager.SystemMessage(sMsg); --DB.setValue(widget, "shortcut", "windowreference", "referencediscipline", sRecord); levels[i] = widget; i = i + 1; updateStatus(); end end end function updateStatus() window.update(); end --[[function onClickDown(button, x, y) return true; end]]-- function onClickRelease(button, x, y) Interface.openWindow("referencediscipline", window.getDatabaseNode()); end function setReadOnly(state) readonlyflag = state; end
-
July 5th, 2019, 02:27 #4
- Join Date
- Jun 2018
- Posts
- 31
Oh, I have the chat messager in there as a debugging tool, it should be removed.
-
July 5th, 2019, 04:55 #5
If your code is running in onInit it will only do it on initialising the sheet.
Move the code to a function like onChangeValue or similar an in onInit also call the onChangeValue function.
That is how most of the systems do it.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks