5E Product Walkthrough Playlist
Page 2 of 2 First 12
  1. #11
    Varsuuk's Avatar
    Join Date
    Dec 2015
    Location
    New York
    Posts
    2,075
    Quote Originally Posted by damned View Post
    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();
    Got the gist of what it is doing there, presumably this is a button that causes a cast and the last step updates the remaining spells in the slot.

    What would be a similar control/action but where you DIDN'T: "access it from the database so you dont need to worry about consistenly using the right path for accessing via the window." so I can get the contrast. I'm pretty sure I am missing a fine point (or gross one for that matter) here

    Off to bed, so will see any replies tomorrow.

    PS - Thanks Trenloe I had actually! read all of those fully except DB.xcp which I had only skimmed along with couple other packages. I haven't yet been that attentive to those since all my work has been on creating controls and labels thusfar

  2. #12
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,678
    Blog Entries
    1
    Quote Originally Posted by Varsuuk View Post
    Got the gist of what it is doing there, presumably this is a button that causes a cast and the last step updates the remaining spells in the slot.

    What would be a similar control/action but where you DIDN'T: "access it from the database so you dont need to worry about consistenly using the right path for accessing via the window." so I can get the contrast. I'm pretty sure I am missing a fine point (or gross one for that matter) here

    Off to bed, so will see any replies tomorrow.

    PS - Thanks Trenloe I had actually! read all of those fully except DB.xcp which I had only skimmed along with couple other packages. I haven't yet been that attentive to those since all my work has been on creating controls and labels thusfar
    I could give you the alternative but I dont want you to use it. So I wont
    Instead of referencing the db value you reference the same value but do it by its window.control name...

  3. #13
    You'd have to walk up and/or down the window/control parent relationship tree.
    https://www.fantasygrounds.com/wiki/...pt_Block_Scope

    Cheers,
    JPG

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
  •  
5E Character Create Playlist

Log in

Log in