• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Difference between Save and Reload?

TCArknight

Well-known member
Hello all!

I am trying to figure this out and drawing a blank.

I have a ruleset where Talents exist on a tree. Each row of the tree has a specific cost (5/10/15/etc). Some talents can be taken multiple times at different costs and so can appear in two (or more) different places on one tree.

The example I'm using is this. "Talent 5" exists on row 1 and row 2. If I select the one on row 2, all is good it seems. However, when I exit and reload the version of Talent 5 on row 1 is suddenly the one selected.

Is there a way to retain each position's (checkbox) state between save/reload? Any ideas otherwise?

Thanks!
TC
 

Attachments

  • Talents - Before.png
    Talents - Before.png
    204 KB · Views: 1
  • Talents - After.png
    Talents - After.png
    187.2 KB · Views: 1
It looks like you're building this with a 4-column table with 20 picks in it, am I correct?


If so, I'd start with your sort order. As a debugging tool, have your visual display show every value that goes into the sort order - this is something you can roll back once you've figured out the issue, but I'm guessing that the values you're using to build your sort order aren't being generated in a way that's totally consistent, or that there's a bug somewhere in how the values are being generated.

For example:

column: 4
Row: 2

Would display on everything, and then on the ones that are real entries, the ? icon would be shoved to one side or another temporarily
 
Thank you mathias. :)

No sir. each leaf is an individual fixed table:
Code:
  <portal
    id="stRow1Col4"
    style="tblOuter">
    <table_fixed
      component="Talent"
      showtemplate="stTalent"
      scrollable="no"
      alwaysupdate="yes"
      agentlist="SpecTree">
      <list>SpecRow.1 & SpecCol.4</list>
      </table_fixed>
    </portal>

  <portal
    id="stRow2Col1"
    style="tblOuter">
    <table_fixed
      component="Talent"
      showtemplate="stTalent"
      scrollable="no"
      alwaysupdate="yes"
      agentlist="SpecTree">
      <list>SpecRow.2 & SpecCol.1</list>
      </table_fixed>
    </portal>

Each talent has a SpecRow.? and a SpecCol.? tag associated with it to indicate it's position on the tree.

The stTalent template is:
Code:
  <template
    id="stTalent"
    name="Talent Pick"
    compset="Talent">

    <portal
      id="name"
      style="lblTitle"
      showinvalid="yes">
      <label>
        <labeltext><![CDATA[
          ~set the color based on if career skill or not
          if (tagcount[Talent.SelectedFromOther] = 0) then
            @text = "{text ffffff}"
          else
            @text = "{text 00ff00}"
            endif
          
          @text &= field[name].text
          ]]></labeltext>
        </label>
      </portal>

    <portal
      id="select"
      style="chkNormal"
      showinvalid="yes">
      <checkbox
        field="talSelect">
        </checkbox>
      <mouseinfo/>
      </portal>
	  
    <portal
      id="info"
      style="actInfo">
      <action
        action="info">
        </action>
      <mouseinfo/>
      </portal>

    <position><![CDATA[
      ~set up our height based on our tallest portal
      height = portal[info].height + portal[select].height + 10

      ~if this is a "sizing" calculation, we're done
      doneif (issizing <> 0)
      
	  if (tagis[Talent.SelectedFromOther] <> 0) then
	    if (tagis[Talent.UserSelected] = 0) then
	      portal[select].freeze = 1
		  portal[select].visible = 0
		  endif
	    endif
		
      ~position our tallest portal at the top
      portal[name].top = 0
      
      ~center the other portals horizontally
      perform portal[info].centerhorz

      ~position the delete portal on the far right
      portal[info].top = portal[name].bottom + 5
      ~perform portal[info].alignedge[left,0]

      ~position the name on the left and let it use all available space
      portal[select].left = 0
	  if (portal[select].visible = 0) then 
	    portal[name].left = 0
	  else 
	    portal[name].left = portal[select].right + 2
		endif
      portal[name].width = width

      ]]></position>

    </template>

Because each tree is a SpecTree component, I thought about having a Matrix field on the SpecTree that stored the 0/1 values of the Talent selections.
 
Annnnnddddd that seemed to be the way to go. :) With the matrix on the tree holding the value for the "Selected" field of each Talent on the tree I can have the talents themselves pull that value to set it as the character is reloaded.
Code:
<eval index="1" phase="Initialize" priority="500"><![CDATA[
	  doneif (state.isload = 0)
	  
	trustme
	
	  ~ initialize selected talents on a load
	  var myTree as string
	  var myRow as number
	  var myCol as number
	  myTree = tagids[SpecTree.?,"|"]
	  myRow = tagvalue[SpecRow.?]
	  myCol = tagvalue[SpecCol.?]
	  
	  field[talSelect].value = hero.findchild[SpecTree].field[stSelectedTal].matrixvalue[(myRow-1),(myCol-1)]
		
      ]]></eval>
 
Back
Top