-
April 30th, 2019, 00:00 #1
- Join Date
- Jun 2018
- Posts
- 29
Starfinder, Starship Stuff, struggling with DB node navigation.
I'm working on the Starfinder starship dice rollers. Not sure how many are familar with it. But heres what I've got so far:
bob.png
On the screen shot when you click the dice at the end it calls a function that I've traced down that calls:
Code:local nodeChar = window.getDatabaseNode(); local rActor = ActorManager.getActor("pc", nodeChar); ChatManager.SystemMessage(rActor.sType .. "", false); ChatManager.SystemMessage(rActor.sName .. "", false); ActionSkill.performRoll(draginfo, rActor, sSkill, nValue);
The chatManager.SystemMessagers were just messages to me so see what the values held, as the dice roll wasn't for Bob, but was for "Audacious Gambit", so I figure that it's taking that part of the screen and trying to make an actor out of it, which given they aren't a PC then it falls flat.
However in the DB.xml we have:
Code:<id-00001> <public /> <actions> <public /> <audacious_gambit> <public /> <attackmod1 type="number">0</attackmod1> <attackmod2 type="number">0</attackmod2> <attackmod3 type="number">0</attackmod3> <attackmod4 type="number">0</attackmod4> <name type="string">Audacious Gambit</name> <skill1 type="string">piloting</skill1> <type type="string">skill</type> </audacious_gambit> ... </actions> <link type="windowreference"> <class>charsheet</class> <recordname>charsheet.id-00001</recordname> </link> <minoractions>... </minoractions> <name type="string">Bob</name> <role type="string">Pilot</role> <roleclass type="string">officer</roleclass> <token type="token"></token> <tokenscale type="number">1</tokenscale> </id-00001>
If anyone has an insight that they could off that would be cool. I need to get some sleep.
Thank you all in advance.
-
April 30th, 2019, 00:43 #2
- Join Date
- Jun 2018
- Posts
- 29
Actually, I think I need this bit:
<link type="windowreference">
<class>charsheet</class>
<recordname>charsheet.id-00001</recordname>
</link>
if I can grab that note and make a PC out of it... I think that might sorted it... too tired to try now, and if anyone has the exact code just to grab that it would be appreciated.
-
April 30th, 2019, 17:18 #3
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,541
Nutter4Ever,
You can also use the Debug.chat and Debug.console APIs to output any list of variables to the chat window or console window.
Ex: Debug.chat(rActor.sType, rActor.sName)
Ex: Debug.chat(rActor)
Depending on what scope your code is running in, you would get something like this. (This code assumes it is running in control context of a control that is a child of the same window as the link.)
Code:local node = window.getDatabaseNode(); local sClass, sRecord = DB.getValue(node, "link", "", ""); if sClass ~= "charsheet" then return; end local nodeChar = DB.findNode(sRecord); if not nodeChar then return; end local rActor = ActorManager.getActor("pc", nodeChar); ActionSkill.performRoll(draginfo, rActor, sSkill, nValue);
JPG
-
April 30th, 2019, 20:19 #4
- Join Date
- Jun 2018
- Posts
- 29
Thank you for your reply. It gives me something to work with, it's not working out the box but not expecting that.
I just wish I understood half of what you said and this might all make sense :-)
The link was a couple of steps up, so if that's what you meant by scope I had to "...link" (that bit was learnt from a really old post, that turned out also to be authored by you :-).
And now there are some other quirks need to work out, but now I've gotten a little bit better at navigating the DB hopefully it should prove a little easier.
Thank you
-
April 30th, 2019, 20:27 #5
If you haven't seen it already, the Database page in the developer Wiki might help explain a few things: https://www.fantasygrounds.com/wiki/...ets_-_Database This explains, with examples, things like database paths (absolute and relative)
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!
-
April 30th, 2019, 21:09 #6
- Join Date
- Jun 2018
- Posts
- 29
Thank you Trenloe, I have seen that document, but I'm so not familar with Lua or the coding in FG to make sense of the documents without the try it and see approach.
Would also suggest the https://www.fantasygrounds.com/refdoc/DB.xcp page for what the DB.xxx commands do.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks