Need help with modding, google a lot and still have no idea.

Started by liuqixind123, January 26, 2022, 01:18:10 PM

Previous topic - Next topic

liuqixind123

In interactiondefs ->Defs->InteractionDef->logRulesInitiator->rulesStrings,
there are many <li> elements and i see this:
<li>gamePTD01bj(p=3)->traitor</li>

What is this (p=3)? I thought it was some kind of xml feature and google it , of course no clue.
So i guess it is some kind of "repeatable elements",p=3 means it will be equal to show up for 3times.
This is stupid guess no doubt, so could anyone tell me what that is?

GhostData

The code you're looking for is the class Rule_String, which more or less
1. Uses Match to match the ruleStrings you see in the XML file to a very scary looking Regex - This essentially breaks the string in xml down into a key, a collection of parameters, and an output value.
2. Parse all of the params and validate that they are correct
3. Store the parsed values in the fields of Rule_String

These are later referenced to determine how and what to display when logging social interactions - this is a grammar used to define and parse log entries.

Now for what p=3 means: It's the "weight" of that element. By default, every list item will have a weight of 1, but p=x will set the weight of that specific element to some other number.
The short version is that higher weighted strings are more likely to be selected.

liuqixind123

Quote from: GhostData on January 30, 2022, 05:37:57 PM
The code you're looking for is the class Rule_String, which more or less
1. Uses Match to match the ruleStrings you see in the XML file to a very scary looking Regex - This essentially breaks the string in xml down into a key, a collection of parameters, and an output value.
2. Parse all of the params and validate that they are correct
3. Store the parsed values in the fields of Rule_String


These are later referenced to determine how and what to display when logging social interactions - this is a grammar used to define and parse log entries.

Now for what p=3 means: It's the "weight" of that element. By default, every list item will have a weight of 1, but p=x will set the weight of that specific element to some other number.
The short version is that higher weighted strings are more likely to be selected.

Thank you, that explains very clearly. It did huge help.