5E Character Create Playlist
  1. #1

    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?

  2. #2
    LordEntrails's Avatar
    Join Date
    May 2015
    Location
    -7 UTC
    Posts
    17,242
    Blog Entries
    9
    /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.

  3. #3
    Quote Originally Posted by LordEntrails View Post
    /reload might work. Otherwise probably the way you are doing it.
    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
    This doesn't work however. /reload just reloads the ruleset and I am looking for a way to refresh the screen after a handleDrop function.
    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

  4. #4
    Oh, I have the chat messager in there as a debugging tool, it should be removed.

  5. #5
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,678
    Blog Entries
    1
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
DICE PACKS BUNDLE

Log in

Log in