PDA

View Full Version : coding for morons



toastsniffer187
November 12th, 2021, 18:07
im a cnc programmer so this is not above my understanding. but where to start im trying to do something that seems simple when said but probably not in actuality with the way everything seems interlaced. I have notepad++ but cant seem to understand anything like i should be able to. Where do i start when trying to modify an existing extension? Like I cant quite figure out step by step do this then this then this ect....

Zarestia
November 12th, 2021, 18:21
I'd advise to check out the following:

- https://www.youtube.com/watch?v=54PSYMXmyvs&list=PLsgd1zJLdiKW23yt4X2qc_9w1TWQfTPUA
- https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996644285/Developer+Guide

You can also look at all the included rulesets such as CoreRPG and D&D 5e for example. Extract the .pak file and you're good to go.

With the chat command '/debug on' you can see the XML elements when hovering over with your mouse inside FGU.

toastsniffer187
November 12th, 2021, 18:26
Thanks im trying to move the location of a tab of an extension. example its an extension for 5e but works for pf2e(some of it. the part about the extension i like does)but it covers up the spells tab on the npc for gm. So im trying to move the inventory tab of this extension to a different spot.

superteddy57
November 12th, 2021, 18:55
Can you show me an image of what you are trying to accomplish?

Trenloe
November 12th, 2021, 19:02
Thanks im trying to move the location of a tab of an extension. example its an extension for 5e but works for pf2e(some of it. the part about the extension i like does)but it covers up the spells tab on the npc for gm. So im trying to move the inventory tab of this extension to a different spot.
I don't know exactly what the extension code is doing, but I would imagine it's not covering the PF2 spells tab, but not even having that tab present because the code is based on the 5e NPC which doesn't have a spell tab.

For an example of how to setup the tabs, in the "tabs_recordsheet" XML, see the PFRPG2 ruleset campaign\record_npc.xml file - search for "tabs_recordsheet" - you'll also need to ensure the subwindow_record and scrollbar_record entries are correct. Look for similar code within the extension and adjust as needed.

Also keep in mind that the extension you're using was written for 5e, and uses 5e code. Even if you display the PF2 spells tab, there is no guarantee that the rest of the code in the extension is fully compatible with the PFRPG2 ruleset code - just because something appears to be working doesn't mean that it's 100% compatible and isn't overriding PF2 code with 5e code.

SilentRuin
November 12th, 2021, 19:28
The directions I gave you in the PM are the best way to approach these things (minus the typo of me calling the .pak ruleset zips a .rul file).

Tabs are notoriously a pain in the *** in FGU. There is no simple way to describe it - polymorphism out of my stuff is the most tab centric complex thing you can look at. But gist is - most coding in FGU - or least for the things I do - are nebulous and trial and error where you have to figure out stuff on your own and sometimes its counterintuitive on what is required. Gist is - using example .ext to work from and experiment with is your best course of action.

As I told you I don't support rulesets I don't use and while I naively tried in the early days to do so - I found that while CoreRPG was used as a base platform to code to - most people writing rulesets rapidly diverged from it doing their own things with no care about keeping it overridable or in a pattern that could be consistent between other things based on CoreRPG. I found this especially true in .xml code where you would literally have to rewrite large chunks of it just to override tiny part of it.

And tabs are the worst of them. Polymorphism.ext is where I had to the most horror work bashing it with a hack hammer to what I wanted - but I'd not claim that "code" is the most readable and straightforward though I did comment it alot.

My advice stands though - start with the MapParcel.ext and experiment around with it till you figure it out for what you want to do. And don't assume things are written with consistency or a common pattern. Rulesets are not. You have to be willing to experiment with the ruleset/engine/extension code to get where you want to be and even then it may look like a total hack. Do what you gotta do is my policy. And keep it as simple as you can - and code as to be the least conflicting with other things you can (as in keep that in mind while you code - many don't).

toastsniffer187
November 12th, 2021, 19:37
it does what i want it to do. I just want the tab moved to its own location i will post a pic in a min of before and after map parcel ext.

toastsniffer187
November 12th, 2021, 19:44
I'd advise to check out the following:

- https://www.youtube.com/watch?v=54PS...qc_9w1TWQfTPUA
- https://fantasygroundsunity.atlassia...eveloper+Guide

You can also look at all the included rulesets such as CoreRPG and D&D 5e for example. Extract the .pak file and you're good to go.

With the chat command '/debug on' you can see the XML elements when hovering over with your mouse inside FGU

see how in the video you can read his. Even when i set my note++ to lua it is jumbled wording. Is what I was asking. How do I make it readable?

toastsniffer187
November 12th, 2021, 19:47
Can you show me an image of what you are trying to accomplish?

49931
49932

SilentRuin
November 12th, 2021, 19:52
it does what i want it to do. I just want the tab moved to its own location i will post a pic in a min of before and after map parcel ext.

As I said, not something I plan on doing. The only part of Map Parcels that interacts with an NPC sheet is the inventory tab it adds in. You can just remove it if you don't need or want it by removing that tab logic completely out of record_npc.xml logic. The code he wants to change is this...



<windowclass name="npc" merge="join">
<sheetdata>
<subwindow_record name="npc_inventory">
<class>charsheet_inventory</class>
</subwindow_record>

<tabs_recordsheet name="tabs" merge="join">
<tab merge="add">
<icon>tab_inventory</icon>
<subwindow>npc_inventory</subwindow>
</tab>
</tabs_recordsheet>
</sheetdata>
</windowclass>


For whatever reason 2E does not like it and having looked at how rulesets go off and hardcode references or positions and other things I have no plans on supporting it. Just FYI.

I only use 5E as I told you - no plans on changing that anytime soon. And I won't support things I don't actively use unless they just "work" as is in the 5E implementation.

toastsniffer187
November 12th, 2021, 20:34
well i need to inventory tab to add items to be dropped upon death. That is the whole point of this that is cool to have. What i was originally asking is when i open the ruleset and extension in note++ its indescernable writing. Even when i set it to LUA.

toastsniffer187
November 12th, 2021, 20:37
well i need to inventory tab to add items to be dropped upon death. That is the whole point of this that is cool to have. What i was originally asking is when i open the ruleset and extension in note++ its indescernable writing. Even when i set it to LUA.
49934

SilentRuin
November 12th, 2021, 20:41
well i need to inventory tab to add items to be dropped upon death. That is the whole point of this that is cool to have. What i was originally asking is when i open the ruleset and extension in note++ its indescernable writing. Even when i set it to LUA.

Ok - I told you .ext, .mod, and .pak files are zip files which you can unzip with something like 7-zip. I did this in the PM I sent you describing all this before you ever posted this thread.

I can't help it if you ignored that and tried to edit a zip file. I wish you luck - I'm sure you'll eventually get it but I've given what help I could.

damned
November 13th, 2021, 02:18
see how in the video you can read his. Even when i set my note++ to lua it is jumbled wording. Is what I was asking. How do I make it readable?

Unzip the extension or ruleset