DICE PACKS BUNDLE
  1. #1

    Combat Tracker Hierarchy

    So, this is a high level question, but the further i dig into the structure of things, the harder it becomes to get a top-down view. And some of this might technically be a more general FG question than a SW question, but I'm not sure.

    1. Looking at the general structure of the combat tracker (specifically, the initiative card portion) CT>???>ct_host/ct_client>???>cardhand>card, but I'm not sure what is in place of those ??? to hold the whole thing together. What are the "moving" parts of the CT?
    2. Is there a way to reference higher elements of the structure - for instance, if I'm in an individual "card", how do I reference the cardhand and character line in the CT? For instance, I have an extension sending a message to the chat window when a card is discarded in the CT (and trying to figure out how to give that capability to the player as well as the GM), and that works, but I cannot figure out how to add information on which player the card belonged to. I tried using "getOwner", but wasn't sure what to do with the object returned.

  2. #2
    I'll discuss in general; since I'm not as familiar with SW-specific code.

    1.
    Relationships in FG rulesets are pretty straightforward at their core. Windows hold controls; and basic controls are: string, number, generic, button, formattedtext, dice, link, image, token, scrollbar, window list, window container. (with a few specialized controls as well for chat/assets)

    Most rulesets follow the basic model that is provided in CoreRPG. CT button opens an instance of combattracker_host / combattracker_client window class. The window instance contains a list of actors (i.e. PCs/NPCs) with their own window class (ct_entry). Each CT actor window contains quite a few fields/lists that contain all the information that could possibly be shown in the combat tracker. (I think that the SW combat tracker is a little more complex, since it involves actor "groups"; but I'm not as familiar with that.) When an actor is added to the combat tracker, the PC fields are mapped or the NPC fields are copied so that they match what the CT shows.

    2.
    getOwner() will not give you what you want. It refers to to the "owning player" of a database node (i.e. the physical player who logged into session), which is completely separate from CT actors.

    Usually, scripts do one of the following to access parent or sibling relationships:
    * Get the database reference for the field, and traverse the database relationships using getParent/getChild APIs to access the correct data.
    * Traverse the UI window/control relationships to access the correct data. This involves following the control/window chain up until you reach the UI parent using "window" (for controls), "windowlist" (for child windows inside list controls), or "parentcontrol" (for child windows inside window containers). Then, you can go down the chain using control names (for controls), getWindows API (for list controls), or "subwindow" (for child windows inside window containers).

    That's probably getting too detailed for what you want; so I would suggest looking at examples for other fields within the CT actor entry window class and seeing how they get access the CT actor reference.

    Regards,
    JPG

  3. #3
    "That's probably getting too detailed for what you want"

    No, not at all. This is helping. I was looking for the "getParent/getChild" when i found getOwner and thought I had found a way to leapfrog the whole mess.

    "so I would suggest looking at examples for other fields within the CT actor entry window class and seeing how they get access the CT actor reference."

    Been there and done that, but unfortunately, for those examples, the functions seem to be called by other functions that pass down an rActor variable which holds the information. And, since the function I'm trying to replace doesn't have that, I'd need to find the original calling function and the function that calls that and ... until I get to the source and add a new parameter to each of those on down the line. I can do that method, but I'm just hoping to find another way. Trying to use a scalpel instead of a chainsaw for my incisions into the code.

  4. #4
    Understood. I guess the real answer is that their is no quick and dirty way for FG to know what you're after (since it's a general purpose platform); so you have to specify the parent/child relationships either through UI or database to get what you want.

    Try looking at campaign/scripts/char_weapon.lua in the 5E ruleset. It specifically knows that when a weapon entry attack is triggered, the code is hard-coded that it needs to go up two levels to find the character node. (i.e. nodeChar = nodeWeapon.getChild("...")) This is purely because that's how the data is defined for 5E character records.

    You might have some luck modifying a field in the ruleset you're working in, then inspecting the resulting XML to see where it sits in the database parent/child hierarchy.

    Regards,
    JPG

  5. #5
    What are you trying to do, would be my first question. I saw about having it state who discards a card. Is that all or aiming for something bigger?
    Location: Central Pa (East -5)
    Ultimate License Holder
    Current Campaign: Necessary Evil
    Current Project: Dawn of Daikaiju: Converting, Deadlands: Reloaded The last Sons - Quality Assurance Checking
    Discord: Mgrancey#4994
    "Mad Science" means never stopping to ask "what's the worst thing that could happen?" -- Maxim 14 of The Seventy Maxims of Maximally Effective Mercenaries
    Adventure: Keep Living Life Like There's No Tomorrow and You'll Eventually Be Right,

  6. #6
    Quote Originally Posted by Mgrancey View Post
    What are you trying to do, would be my first question. I saw about having it state who discards a card. Is that all or aiming for something bigger?
    Right now, just getting the character name to make a custom message when discarding. One step at a time.

    But in a broader sense, I'm trying to mentally construct a schema of the SW combat tracker in order to make several changes (for instance, moving the on/off toggles and delete buttons from effects rows that appear in the GM version of the CT over to the client version. I tried the quick and dirty version of the move, but found there was a lot of hooking going on there that I need a deeper understanding to replicate.)

    Edit: oh yea, and if a character has 2 cards and deletes the higher one, I am trying to have the delete auto select the new highest card, like it does when you deal a new card that is higher. I have dug down to "winGroup.addCard(oCard, true)". I know that does the update, but can't find it in the code and that seems to be in the cardhand object, so I would need to jump up a level to do that.
    Last edited by ApesAmongUs; September 16th, 2020 at 01:16.

  7. #7
    Guess I am not sure what you mean by discarding cards. I played around with CT in FGC briefly but outside of picking when getting multiple cards due to levelheaded and as a player I was able to pick which one I wanted.

    Is that what you mean, when a player picks one in that situation or are you talking about Tactician which gives a player cards that they can distribute?
    Location: Central Pa (East -5)
    Ultimate License Holder
    Current Campaign: Necessary Evil
    Current Project: Dawn of Daikaiju: Converting, Deadlands: Reloaded The last Sons - Quality Assurance Checking
    Discord: Mgrancey#4994
    "Mad Science" means never stopping to ask "what's the worst thing that could happen?" -- Maxim 14 of The Seventy Maxims of Maximally Effective Mercenaries
    Adventure: Keep Living Life Like There's No Tomorrow and You'll Eventually Be Right,

  8. #8
    I'm making an extension that operates on my house rules. I don't want to go into what they are extensively (because I do not house rule lightly), but discarding a card is exactly that - a player has multiple cards in their hand and throws one away. But, yes, characters have multiple cards a la Level-Headed/Improved Level-Headed, not Tactician. For those you are not forced to select the highest card, the player can click on a lower card and choose to use that for initiative. When the player does that, it changes the display of the active initiative card. I'm trying to use that functionality elsewhere.

    In the official ruleset, the GM can right click on a card and select the Remove Card option. I am giving that ability to players, but want to have it announced in Chat who discarded what card and also to reset the initiative card for that player to the highest card in the hand if the highest one was discarded (like would happen if the player selected a card to use from level-headed, but I don't want them to have to click again. I want it to happen automatically when the old card is discarded).

    I have the "what card" part working and I have found the next highest card in the hand (ctrlCardHand.getBestCard()). I even found the correct function for setting the card to the active initiative card (setInitiativeCard(oCard) in template_initcontrol.lua). I'm just trying to navigate my way from card to cardhand to ??? to initcontrol.

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
  •  
FG Spreadshirt Swag

Log in

Log in