Opened 12 years ago

Last modified 11 years ago

#43 closed enhancement

xmlTools feature request: conditions-based replace command — at Version 3

Reported by: Paradox-01 Owned by: s10k
Priority: major Component: XmlTools
Keywords: Cc:

Description (last modified by Iritscen)

Sometimes the replace command is not precise enough.

We had two incidents where it would be useful to have a more powerful version of that command.

1) Incoming from the wiki. (Changing content in object collection(s).)
2) And ticket:41. (Changing content in ONGS.)

There are probably many more situations you can think of, like in particle where you can have multiple emitter, etc.

@ReplaceValueInSection Section "name" ParentTag "name" Tag "tame" ConditionParentTag "name" ConditionTag "name" ConditionValue "name/value"

Note 1: Section is here just another word for GrandparentTag.
Note 2: Maybe the ConditionValue should also allow for a "*" to replace any old content.


Using the examples again, that's how I imagine the solution for ...

Example 1

@ReplaceValueInSection Section "CHAR" ParentTag "Scripts" Tag "Spawn" ConditionParentTag "OSD" ConditionTag "Flags" ConditionValue "IsPlayer"

<xml>
  <Spawn>load_prone_mode_logic</Spawn>
</xml>

Example 2

@ReplaceValueInSection Section "AutoPrompts" ParentTag "ONGSAutoPrompt" Tag "LastAutopromptLevel" ConditionParentTag "ONGSAutoPrompt" ConditionTag "SubtitleName" ConditionValue "autoprompt_weapon"

<xml>
   <LastAutopromptLevel>19</LastAutopromptLevel>
</xml> 

Is that feature desirable and possible to create?

Change History (3)

comment:1 by Paradox-01, 12 years ago

In Example 2 I made mistakes.

I wanted to write:

@ReplaceValueInSection Section "AutoPrompts" ParentTag "ONGSAutoPrompt" Tag "LastAutopromptLevel" ConditionParentTag "ONGSAutoPrompt" ConditionTag "SubtitleName" ConditionValue "autoprompt_weapon"

<xml>
   <LastAutopromptLevel>19</LastAutopromptLevel>
</xml> 

(Tickets can't be edited??)

comment:2 by Iritscen, 12 years ago

Description: modified (diff)

You have to click on the Modify Ticket section to expand it in order to edit the original ticket. I've carried over your change.

comment:3 by Iritscen, 12 years ago

Description: modified (diff)

To be honest, that sample syntax makes me want to shoot myself in the head, although XmlTools' existing syntax is almost as bad sometimes :-)

There's a whole can of worms that I could open here about the additional need for 'for' loops and variables in order to make some patch mods possible. I think I'll open a new ticket for that so that s10k can reply to this on its own if he desires, but I encourage everyone to take a higher-level look at what we're trying to do here rather than shoe-horning increasingly complex concepts into a linear, very unreadable and fragmented grammar. That higher-level look will be in a new ticket shortly.

Note: See TracTickets for help on using tickets.