Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#43 closed enhancement (duplicate)

xmlTools feature request: conditions-based replace command

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

Description (last modified by Paradox-01)

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?

.. edit test ..

Change History (9)

comment:1 Changed 11 years ago by Paradox-01

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 Changed 11 years ago by Iritscen

  • 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 Changed 11 years ago by Iritscen

  • 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.

comment:4 Changed 11 years ago by Paradox-01

If I haven't learned English by now I will never.

When I click on "Modify Ticket" I still don't see where to edit the text.
https://dl.dropboxusercontent.com/u/139715/temp/no_edit.png

comment:5 Changed 11 years ago by Iritscen

Try again :-) I just tried to enable that right for regular users; I hadn't realized it was only showing up for me as an admin.

comment:6 Changed 11 years ago by Paradox-01

  • Description modified (diff)

comment:7 Changed 11 years ago by Paradox-01

Ok thanks, edits work now.

Last edited 11 years ago by Paradox-01 (previous) (diff)

comment:8 Changed 11 years ago by s10k

  • Resolution set to duplicate
  • Status changed from new to closed

Let's discuss this here:
http://www.bugs.oni2.net/ticket/44

comment:9 Changed 10 years ago by Iritscen

  • Component changed from Vago to XmlTools
Note: See TracTickets for help on using tickets.