5E Character Create Playlist
Page 1 of 2 12 Last
  1. #1
    Varsuuk's Avatar
    Join Date
    Dec 2015
    Location
    New York
    Posts
    2,075

    Which control/object defines ‘source=“...”’ attribute?

    Was going through the API page control by control looking for this. Basically, once found was going to see if there was any API call in lua to set/reset this db value. I. was thinking that I had 5 controls that depending on a config switch would represent one of two sets of 5 values.

    Didn’t want to use a vague path like .save1, save2, etc.

    Am I, as usual, myopic and missed the entry?

  2. #2
    In those cases, it's best to use two controls and show/hide the correct controls based on which config is active. You can't change the source of a control on the fly. For example, that's how extra fields in items are handled in the D&D rulesets.

    Another option is to dynamically create/destroy controls, but then you have to track them and lay them out dynamically as well.

    Technically, both subwindow and windowlist support source setting, but they are containers not raw data values.

    Regards,
    JPG

  3. #3
    Varsuuk's Avatar
    Join Date
    Dec 2015
    Location
    New York
    Posts
    2,075
    Yup, controlling on page display was my initial thought, just the other approach followed in my head since I didn’t need to change any physicality, just the db source.

    Will go the invis/vis route.

    Still, I couldn’t find the control in the number/string inheritance chain with the db source tag. Did I miss it or is it left out?


    PS: M-O-O-N spells Wizard of FG, thanks for the help.

  4. #4
    Still, I couldn’t find the control in the number/string inheritance chain with the db source tag. Did I miss it or is it left out?
    I'm not grokking the question this time.

    Some comments that may help.
    If a control has a name, it can be referenced from the window script scope by name.
    If a control does not have a name and is dynamically created (createControl), then you can store a reference to the control object to reference later.
    If a control does not have a name and is statically created (XML), then you can't access.
    If you really are just trying to update underlying data in the database, use the DB package API instead.

    Regards,
    JPG

  5. #5
    Varsuuk's Avatar
    Join Date
    Dec 2015
    Location
    New York
    Posts
    2,075
    I'm sorry JPG, I meant something like this:
    Code:
    			<!-- AC -->
    			<number name="armorclass"
    				source="defenses.ac.total">
    				<frame name="charsheet_attribute_bonus_frame" offset="7,5,7,5"/>
    Again, I might just be oblivious ("might", might be a bit generous, but I'll take it) but I didn't see where this might (I think I am too "mighty" today) appear in the XML and Scripting Reference page.


    So the above would be number->numberfield->numbercontrol/databasecontrol ->etc

    In none of them did I see any description of a tag or attribute "source". I mean, I know what it is, it creates/references that spot in the xml/db. I had ORIGINALLY asked o then see if there was a "change source" api for it. I get what to do now.

    I just wanted to still know where that attribute or tag was described. If only to understand why I didn't find it in case there was another set of data/pages/docs to look at.

    I hope you are grokking in fullness now?

    Thanks for your patience - I no longer "needed" the info, just want to still know where, in case.

  6. #6
    It's only mentioned in passing here in the descriptive text.
    https://www.fantasygrounds.com/refdoc/windowcontrol.xcp

    It looks like it has never been fully defined in any documentation that I can find quickly. I guess it's always been used by example.

    Regards,
    JPG

  7. #7
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,649
    Blog Entries
    1
    In every possible case where you are using data - access it from the database so you dont need to worry about consistenly using the right path for accessing via the window.
    Access via the DB always.
    Always give your control a unique name.
    Keep the db syntax consistent between npc and pc.

  8. #8
    Varsuuk's Avatar
    Join Date
    Dec 2015
    Location
    New York
    Posts
    2,075
    Thanks JPG - it's COOL if it WASN'T mentioned, I just hate looking at not seeing it like I have already done on prior questions. And of course sometimes it is not to be found like anchor=center which you blessed me with!
    I had no problem understanding how <tag source="..."> was used - it WAS indeed self-documenting. I asked, as I said before, because I figured whatever component first introduces it would also have (if ANY had it) the method for modifying/reading it if one existed.


    Quote Originally Posted by damned View Post
    In every possible case where you are using data - access it from the database so you dont need to worry about consistenly using the right path for accessing via the window.
    Access via the DB always.
    Always give your control a unique name.
    Keep the db syntax consistent between npc and pc.
    I'm only at the UI stage now, though SO close to starting on coding first page at least. Just trying to decide how will setup Saves and Movement controls. Then will see about shrinking the "Ability Modifiers" section - I did it initially like their Character Sheet but it looks too wide for such a limited use datapoint. But it's there and layed out so will wait until complete then revamp look.


    Could you maybe show a control or two with the alternate ways of accessing the data? I am not sure what you mean by the "access it from the database so you dont need to worry about consistenly using the right path for accessing via the window." since I haven't yet coded to it.

    You need not post actual controls if that would be too much to use as example. You could point to examples of alternate access methods by pointing to the free rulesets, CoreRPG or Savage Worlds or Castles & Crusades or something I can download to look at. Just mention the controls or methods to look at.

  9. #9
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,649
    Blog Entries
    1
    random code cut from MoreCore

    Code:
    				<script>
    					function onDoubleClick(x, y)
    						if getValue() > 0 then
    							local rActor = ActorManager.getActor("pc", window.getDatabaseNode());
    							Debug.console("rActor: ");
    							Debug.console(rActor);
    							local nodeWin = window.getDatabaseNode();
    							Debug.console("nodeWin: ");
    							Debug.console(nodeWin);
    							local sHeroType = nodeWin.getChild("spell_slot_1_name").getValue();
    							Debug.console("sHeroType: ");
    							Debug.console(sHeroType);
    							local msg = {font = "msgfont", icon = "spellicon"};
    							msg.text = rActor.sName .. " is using a " .. sHeroType;
    							Comm.deliverChatMessage(msg);
    							setValue(getValue()-1);
    						end
    						return true;
    					end
    				</script>
    In your case the datasource would be nodeWin.getChild("defenses.ac.total").getValue();

  10. #10
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,361
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

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
  •  
FG Spreadshirt Swag

Log in

Log in