Gargioss Posted December 27, 2018 Share Posted December 27, 2018 Hello, I ask for help for a mod xpath code, example of original code of the simplified "campfire": part of the original code: <block name="campfire"> <drop event="Destroy" count="0"/> <property name="Stacknumber" value="1"/> final results: <drop event="Destroy" name="campfire" count="1"/> <property name="Stacknumber" value="5"/> _______________________________________ I have already tried several solutions using the commands: <remove>, <setattribute> and <append> but the results lead to error. It works only <set> on "Stacknumber". But it works only if I remove the whole code and I hang the new modified code. it is the only solution ? Thank you and Happy Holidays to all. Link to comment Share on other sites More sharing options...
Khelldon Posted December 27, 2018 Share Posted December 27, 2018 This is what you are looking for. Altered from my workbench modlet to change the campfire instead I use this in my full convertion. definitely works. :-) <!-- Delete and insert drop event --> <remove xpath="/blocks/block[@name='campfire']/drop[@event='Destroy']"/> <insertBefore xpath="/blocks/block[@name='campfire']/drop[@event='Fall']"> <drop event="Destroy" name="campfire" count="1"/> </insertBefore> <!-- resize stack --> <set xpath="/blocks/block[@name='campfire']/property[@name='Stacknumber']/@value">5</set> PS: you don't need to use insert before. append will work fine. I just prefer insert before for the accuracy. Link to comment Share on other sites More sharing options...
HAL9000 Posted December 27, 2018 Share Posted December 27, 2018 You can also use the SetAttribute to add the information <setattribute xpath="/blocks/block[@name='campfire']/drop" name="name">campfire</setattribute> <set xpath="/blocks/block[@name='campfire']/property[@name='Stacknumber']/@value">5</set> <set xpath="/blocks/block[@name='campfire']/drop/@count">1</set> Link to comment Share on other sites More sharing options...
Gargioss Posted December 27, 2018 Author Share Posted December 27, 2018 Thanks a lot to both it works, the second code I had already tried, but certainly I was wrong something. Thanks again. PS: for the next post, how do I insert the appropriate table for the code? (sorry for the lack of experience). Link to comment Share on other sites More sharing options...
HAL9000 Posted December 27, 2018 Share Posted December 27, 2018 Use this but remove the spaces in the brackets [ code] stuff goes here [ /code] becomes stuff goes here Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.