PDA

View Full Version : Help finding variable?



chillybilly
May 10th, 2019, 20:18
Help! I'm trying to create a ruleset/extension for the Arcanis RPG. I'm having fits trying to reproduce the combat tracker rounds box onto the PC's sheet. I can't find the variable that keeps track of rounds. It appears to be "rounds" in the ct_template but then appears (maybe) as "combattracker.round" in the manager_combat lua in scripts. I'm totally confused. Is what I want to do even possible? Any ideas?

Here's a pic of what I want to move.


27310

Trenloe
May 10th, 2019, 20:33
So - one thing to remember with FG is that data is presented in the interface via a GUI control (which has a name) and that data is usually pulled from a database field - which has another name within the database hierarchy.

My recommendation is always to go and get the data from the database, not the GUI control. This is really your only option when you want to put this data in another window.

The easiest approach is to source the number control in the PC sheet on the database field "combattracker.round" - for example, if the control is a standard numberfield (https://www.fantasygrounds.com/refdoc/numberfield.xcp)and called ct_round then you could use the following as the first line of your numberfield definition in the FG XML: <numberfield name="ct_round " source="combattracker.round">

Trede
May 10th, 2019, 20:58
Thank you, Trenloe! I had to walk away from the computer screen I was getting so frustrated. Wife took me to grab a beer. I think you're saying to simply use the line of code you gave me in my PC sheet initiative frame (using number field or whatever control I have in templates... I think it's lvlnumber) and make the source combattracker.round and that ought to reproduce the actual combat tracker round counter. Thank you so much! By the way, this is chillybilly using my wife's account and smart phone.

Trenloe
May 10th, 2019, 21:04
By the way, this is chillybilly using my wife's account and smart phone.
Haha - I was confused at first!


I think you're saying to simply use the line of code you gave me in my PC sheet initiative frame (using number field or whatever control I have in templates... I think it's lvlnumber) and make the source combattracker.round and that ought to reproduce the actual combat tracker round counter.
Yes.

Enjoy your beer! :)

chillybilly
May 10th, 2019, 23:57
oops, the jpg was wrong, please see the post below this.

chillybilly
May 11th, 2019, 00:00
Darn. This doesn't seem to have worked. I entered this into the file for the main tab of my character sheet:

<numberfield name="ct_round" source="combattracker.round">
<anchored to="attackframe" position="insidetopleft" offset="90,165" width="12" height="12" />
</numberfield>

but it's not associating "combattracker.round" with the variable controlling which round it is on the combat tracker. Obviously, I'm doing something wrong.
27316

Trenloe
May 11th, 2019, 00:21
Ah, sorry - I keep forgetting a control source is relative to the window it's defined in. See info here about database paths: https://www.fantasygrounds.com/wiki/index.php/Developer_Guide_-_Rulesets_-_Database

You'll need to work out exactly where in the database the window where the numberfield is and then traverse up the hierarchy to the DB root and then that will allow combattracker.round to be reached.

Ready to start exploring the FG database? ;) Put a number in that field in the character sheet, issue a \save chat command and open the campaign db.xml file - work out where the combattracker.round field is in the <charsheet> hierarchy and then count how many levels up to get to the root - use one more dot than number of levels you need to go up to get to the root. For example, if you need to go up 4 levels to get to the DB root, use source=".....combattracker.round" (5 dots).

chillybilly
May 11th, 2019, 00:49
I have to admit that when I read your response, I wondered if you were the guy whose wife took him out for 3 beers. Then I followed your instructions AND IT WORKED!

Seriously, how awesome are you for walking me through this? Thank you very much!

damned
May 11th, 2019, 03:56
I like where this is heading chillybilly

Trenloe
May 11th, 2019, 05:08
I have to admit that when I read your response, I wondered if you were the guy whose wife took him out for 3 beers. Then I followed your instructions AND IT WORKED!
Fantastic! 3 beer coding is about the right level! :-)