PDA

View Full Version : I need some help and tutoring...



MyGivinOpinion
March 7th, 2019, 15:46
I want to code and develop for FG but I am having the hardest time understanding how LUA and XML work, I guess mainly because I'm trying to learn two languages at once.. but I could really use some help on my understanding of how to navigate the FG code structure. I have some basic JAVA and C# knowledge and understanding. I am feeling kinda drowned at the moment. If anyone can help me I'd greatly appreciate the help. (This may take some time..)

Zacchaeus
March 7th, 2019, 17:36
Some info here https://www.fantasygrounds.com/forums/showthread.php?20651-Modifying-the-CoreRPG-ruleset

Some tutorials here https://www.fantasygrounds.com/forums/showthread.php?47382-MoreCore-Info

If you do a site search for 'coding tutorials' you'll find a few more hits.

MyGivinOpinion
March 7th, 2019, 19:28
Yes. I've got much of the information at hand.. I've got the programming ref doc and the scripting ref doc open. I've been sifting through the code. I know most of what I want to do and the areas to edit. IE I want to display a subwindow in the map around a player but i don't know how the language works enough to be able to start coding?? if that makes sense.. my buddy says i need to make some addhandlers for what i want but atm that's far above my capabilities as i'm struggling to understand the basics here.

Trenloe
March 7th, 2019, 19:59
IE I want to display a subwindow in the map around a player but i don't know how the language works enough to be able to start coding??
A subwindow is a container of other controls: https://www.fantasygrounds.com/refdoc/subwindow.xcp

You can't add a subwindow in a map. A map is presented in a imagecontrol (https://www.fantasygrounds.com/refdoc/imagecontrol.xcp) control, which has limited API functions and is not a container for other controls. The most you can add into a map (imagecontrol) is a token, in the form of the tokeninstance (https://www.fantasygrounds.com/refdoc/tokeninstance.xcp)object.

What functionality are you trying to accomplish?

MyGivinOpinion
March 7th, 2019, 20:06
A threat range indicator for newer players. To stop the age old question of can I hit it? Unless there is a barrier on the map but we don't have LoS so can't do much there. Lol it's a small step towards a future project. This was to include line and arc angles for distances, no more line drawing.. but right now I'm lacking in understanding. I successfully got "test" to appear but that's all of my success. FG's coding is hard for me to comprehend.

MyGivinOpinion
March 7th, 2019, 20:14
The part that I'm stuck at is holding the dragInfo on a onButtonPressed, scan the properties of the attack for reach, ranged (XX/XX), thrown, apply threat ranges, qthen use the dragInfo on a CT target.
I've got knowledge but can't figure it out.

Trenloe
March 7th, 2019, 20:18
A threat range indicator for newer players.
Which ruleset are you using? This is built into most rulesets - the "reach" setting in a combat tracker record. See the "Map Settings Subsection" here: https://www.fantasygrounds.com/wiki/index.php/Combat_Tracker

This is done via a token underlay: https://www.fantasygrounds.com/refdoc/tokeninstance.xcp#addUnderlay

MyGivinOpinion
March 7th, 2019, 20:27
5e.
Correct me if I am wrong but what is implemented is bound the the actor right? I'm trying to displace the weapon's reach. The map doesn't seem to display any update for a weapon with reach just the standard 5'

MyGivinOpinion
March 7th, 2019, 20:31
I'm wrong I see it

LordEntrails
March 8th, 2019, 03:19
If you are having a challenge (like me) grokking the way FG code works, I would suggest you start small. Even do something you don't need or want but is documented. Such as the decal tutorial found on the FG-con website. Create a customer decal, even if you don't plan on using it. Then do something UI like. Add a tab to the character sheet, or modify the theme/colors of the story record or chat window. Then do something that requires LUA, like adding a field on that new tab of yours that displays the sum total of all attributes.

Then when you start on your desired extension, start with the UI. Go slow :)

MyGivinOpinion
March 8th, 2019, 04:47
If you are having a challenge (like me) grokking the way FG code works, I would suggest you start small. Even do something you don't need or want but is documented. Such as the decal tutorial found on the FG-con website. Create a customer decal, even if you don't plan on using it. Then do something UI like. Add a tab to the character sheet, or modify the theme/colors of the story record or chat window. Then do something that requires LUA, like adding a field on that new tab of yours that displays the sum total of all attributes.

Then when you start on your desired extension, start with the UI. Go slow :)

This is good advice. Thank you kindly. I had something working once that modified or extended an XML file used by FG.. but I can't remember the coding now for that. Can you help me? I added an extra call to the onHover(bOnControl) function of the record_char_weapons.xml

LordEntrails
March 8th, 2019, 05:20
This is good advice. Thank you kindly. I had something working once that modified or extended an XML file used by FG.. but I can't remember the coding now for that. Can you help me? I added an extra call to the onHover(bOnControl) function of the record_char_weapons.xml
Not me. I've created a decal extension, added a tab to the CoreRPG sheet and added some fields etc, but your never got to any of the handlers and/or LUA stuff *G*

But, I'm sure if you code and what you are hoping to accomplish, someone will be willing to help out :)

damned
March 9th, 2019, 00:38
If you are having a challenge (like me) grokking the way FG code works, I would suggest you start small. Even do something you don't need or want but is documented. Such as the decal tutorial found on the FG-con website. Create a customer decal, even if you don't plan on using it. Then do something UI like. Add a tab to the character sheet, or modify the theme/colors of the story record or chat window. Then do something that requires LUA, like adding a field on that new tab of yours that displays the sum total of all attributes.

Then when you start on your desired extension, start with the UI. Go slow :)


This is good advice. Thank you kindly. I had something working once that modified or extended an XML file used by FG.. but I can't remember the coding now for that. Can you help me? I added an extra call to the onHover(bOnControl) function of the record_char_weapons.xml

He did help... dont start at the deep end of the pool...

MyGivinOpinion
March 9th, 2019, 01:26
He did help... dont start at the deep end of the pool...

I didn't say or imply he didn't help. But thanks for pointing out the obvious!

MyGivinOpinion
March 9th, 2019, 17:16
merge="join" was what i was looking for when i asked lordentrails for help directly, damned.. didn't think that was that deep but okay.

damned
March 9th, 2019, 23:28
merge="join" was what i was looking for when i asked lordentrails for help directly, damned.. didn't think that was that deep but okay.

that is indeed not deep but it wasnt apparent to me that was what you were asking for...

MyGivinOpinion
March 9th, 2019, 23:41
Yes, my communication skills need work. Coincidently it was your videos I learned it from the first and second time. I've been beating my head against a wall trying to understand the basics of this but I just can't grasp it. Diablobob has been trying to help me, but both of our lives are so hectic we barely have much time if at all to work together. I've tried learning from videos but LUA is so vast and to have to learn not one but two languages at once is getting tiresome.

damned
March 9th, 2019, 23:46
xml just manages the layout and presentation
any data manipulation is done by Lua

Varsuuk
March 10th, 2019, 05:27
Damned, I think the thing he is getting at is that it is Lua and the FG API for Lua ;)

The former I was able to half-wittedly read some wiki on and occasionally reference that online Lua ref or google as needed. The latter is tricker as it is accessed via the wiki where there is GREAT info and docs but it is not a tutorial or lesson based learning (not even an index covering all - sometimes I look one thing at time is it in DB, no, Interface, no... ... windowless, no, ... and so on -- THOUGH, it does get easier ;) when you get feel for what topic should cover it.

Perhaps an index and/or search capability covering all the pages (and example page: "https://www.fantasygrounds.com/refdoc/Interface.xcp#openWindow" ) would be helpful - so if you had stumbled across "getDatabaseNode()" and how no clue (yeah, I know - but picked one out my buttocks) you could just type it in the search box and it takes you to the page on which it is covered.

That said, the API documentation is really really useful and I'd suggest after reading all the "developer notes" stuff (even some older ones) and then paging through every item on left side of those API pages so you get a slight feel of what goes where - that next you find a walk through on cloning a simple ruleset like CoreRPG and make minor change as has been suggested above. There are at least 2 of those I think. Then, probably read through the stuff starting with record_char, record_char_main, the sub windows and things like Charmanager that interact with it. By then and specific questions asked/answered you should be at least as well off as me (which is not saying all that much BUT it is much more than when I started - if only I could spend more than week or two with huge multi month even year hiatuses...hiati ;)

Life is more settled now. We rewrote all of the FIX and OUCH gateways along with matchers and engines in 5 months from C++ to a Java system based on an experimental internal new framework (which was being designed as we were coding) all with folks with none or next to no professional Java experience. Way fun...OK, stressful. But, we DID it - it's been live a couple months. we got bonuses and acknowledgment from CEO etc - so I can have a life again until the next big thing. (Original FIX Gateway, I was part of a 6 man team developing all the moving parts over 1 year and 2 months as a point of reference. In this, the gateway was a team of 3 for 3 months then 1.5 until the end... OK, maybe I am not yet "settled" if I can be so easily triggered into flashbacks and twitching over it still...)

But ya, it get's better. Ya just can't really ask for a "personal tutorial thing" cos the folks who really know it well just don't have that sort of time. It's one reason they also suggest posting questions so answers are posted as well vs only speaking. And those folk usually also have day jobs in ADDITION to amazingly answering your, others and my questions so quickly and with such patience :)

Since I am reading again I am making a point of trolling (the fishing term!) these forum regularly on the off chance I can help and pay it forward. So far since returned to it, only once could I answer and was beaten to it by 2 posts :( lol. But I have hopes for future!

MyGivinOpinion
March 10th, 2019, 13:42
No that's exactly my problem. I can kinda understand what i see. I kinda understand how it's structured i can read it and figure out what's going on, but i can't grasp nodes parents children. it's all so confusing and I swear i'm so close but can't finish it, the tutorials online for parents and children don't help exactly, i understand the concept, but knowing when and where to use these commands is where i'm lost. i'm still thinking in object-oriented programming and not scripting because i'm not familiar with it. I can't make sense of API's never have been able to. I've looked over the Ref doc countless times and always leave more confused than when i started.

Trenloe
March 10th, 2019, 18:35
No that's exactly my problem. I can kinda understand what i see. I kinda understand how it's structured i can read it and figure out what's going on, but i can't grasp nodes parents children. it's all so confusing and I swear i'm so close but can't finish it, the tutorials online for parents and children don't help exactly, i understand the concept, but knowing when and where to use these commands is where i'm lost. i'm still thinking in object-oriented programming and not scripting because i'm not familiar with it. I can't make sense of API's never have been able to. I've looked over the Ref doc countless times and always leave more confused than when i started.
I understand your position but just posting something nebulous like the issues you've posted so far in this thread doesn't give us a chance to help you. There's lots of information out there, but if you're not understanding it, and not giving us a very specific problem you're looking at (details, not just high level description), we're not going to be able to help you - because all I'll do is point you at current documentation, which from the sounds of it isn't helping. For example, database nodes are described here: https://www.fantasygrounds.com/wiki/index.php/Developer_Guide_-_Rulesets_-_Database. But without you telling us exactly what your issues are with programming with database nodes we can't help any further.

And, you're going to *have* to understand the FG API if you're planning on doing any customization beyond basic graphical changes. You say "I can't make sense of API's never have been able to." - in this case maybe delving into FG customization isn't for you? Sorry, I'm being realistic here and don't want you to waste your time (and the time of others) but this is not something you can just pick up, you'll need to work at it and mostly learn from what's available (documentation and the massive amount of example code in rulesets and extensions).

Like I said, if this is something you really want to pursue, give us a detailed example of something you're trying to do, and are struggling with, and we'll try to point you in the right direction.

MyGivinOpinion
March 10th, 2019, 18:41
I am trying to do so, I'm writing it all up. Problem is that I don't have the ability to even look at it today. I am on the road, but I will be preparing for a new post(in a more appropriate section) with more details and coding if what I'm trying to accomplish with my extension/s.

Moon Wizard
March 10th, 2019, 19:09
I think you may need to rethink the scope of what you're trying to do. Every person who has picked up the FG API for programming has started from an existing ruleset, and made very small modifications to sheets to begin with. (i.e. copy existing window definition and move fields around; or add a new field; or make an existing field accept a number drop; or something simple like that) When you state that you need to "write it all up", it makes me think that you are trying to redefine multiple windows and fields to create support for a big project, like programming support for a whole game system.

For the database, I find the database for FG (and for XML in general) to be conceptualized as an upside-down tree. It's easy to draw on paper to work out the parent/child relationships that way. It's typically just called a tree data structure in programming.
https://en.wikipedia.org/wiki/Tree_(data_structure)

Regards,
JPG

MyGivinOpinion
March 10th, 2019, 19:13
I am not at HOME to write up what I am trying to do. And yes it is a big scope. No I'm not trying to work out a new ruleset. Stop jumping to conclusions and allow me to repost my help request. I've narrowed it down to a very simple modification. To start which will be expanded upon later. For now, patience in a virtue. My son's birthday is more important than getting help for a program.

Moon Wizard
March 10th, 2019, 19:17
We're not trying to jump to conclusions or pressure you. Since you're responding so quickly, it seemed like you're actively looking for help, so we were trying to be helpful and make suggestions.

Your family time is definitely more important than any gaming project. I suggest ignoring any notifications from the forum until you are ready to work on your project further.

Regards,
JPG