Jump to content

Help with Xpath - modded campfire.


anomie

Recommended Posts

I've modded the campfire to use generic cooking tools. This works fine when the default windows.xml is edited, but I really want to add this to the mod that me and my friends play. I've used xpath to append the code but it's not recognising it.

 

I'm guessing that it's not the "append" function I need to use, and that I need to do something to have the game recognise my modded campfire code rather than the default, and I'd rather not tell everyone to go into the default XML and copy and paste this code.

 

Can anyone help with this? Keep in mind I only started messing around with this kind of thing a few days ago.

Link to comment
Share on other sites

I've modded the campfire to use generic cooking tools. This works fine when the default windows.xml is edited, but I really want to add this to the mod that me and my friends play. I've used xpath to append the code but it's not recognising it.

 

I'm guessing that it's not the "append" function I need to use, and that I need to do something to have the game recognise my modded campfire code rather than the default, and I'd rather not tell everyone to go into the default XML and copy and paste this code.

 

Can anyone help with this? Keep in mind I only started messing around with this kind of thing a few days ago.

 

Can you provide us what your XML files look like, as well as your Mods folder structure?

Link to comment
Share on other sites

Can you provide us what your XML files look like, as well as your Mods folder structure?

 

Ok but don't laugh! And also: not every slot will be for the frying pan. This was just for testing.

 

<windows>

 

<append xpath="/windows">

 

<!--#$-IGS BEGIN: Adding cursor area. -$#-->

<window name="windowToolsCampfire" width="228" height="121" panel="Right" cursor_area="true" >

<!--#$-IGS END.-$#-->

<panel style="header.panel">

<sprite style="header.icon" sprite="ui_game_symbol_cookware"/>

<label style="header.name" text="TOOLS" text_key="xuiTools" />

</panel>

 

<rect name="content" depth="0" pos="0,-46" height="75" disablefallthrough="true" on_press="true">

 

<grid name="inventory" rows="1" cols="3" pos="3,-3" cell_width="75" cell_height="75" controller="WorkstationToolGrid" repeat_content="true" allow_sort_order="false" required_tools="toolFryingpan,toolFryingpan,toolFryingpan" required_tools_only="true">

<required_item_stack name="0"/>

</grid>

 

</rect>

</window>

</append>

 

 

</windows>

 

--

 

This windows.xml is in Mods>Modname>Config>XUi

 

--

 

Now that I see your name, by the way, another modder who has been helping me a lot recommended I speak with you personally about this, so I'm glad you answered.

Link to comment
Share on other sites

Ok but don't laugh! And also: not every slot will be for the frying pan. This was just for testing.

 

<windows>

 

<append xpath="/windows">

 

<!--#$-IGS BEGIN: Adding cursor area. -$#-->

<window name="windowToolsCampfire" width="228" height="121" panel="Right" cursor_area="true" >

<!--#$-IGS END.-$#-->

<panel style="header.panel">

<sprite style="header.icon" sprite="ui_game_symbol_cookware"/>

<label style="header.name" text="TOOLS" text_key="xuiTools" />

</panel>

 

<rect name="content" depth="0" pos="0,-46" height="75" disablefallthrough="true" on_press="true">

 

<grid name="inventory" rows="1" cols="3" pos="3,-3" cell_width="75" cell_height="75" controller="WorkstationToolGrid" repeat_content="true" allow_sort_order="false" required_tools="toolFryingpan,toolFryingpan,toolFryingpan" required_tools_only="true">

<required_item_stack name="0"/>

</grid>

 

</rect>

</window>

</append>

 

 

</windows>

 

--

 

This windows.xml is in Mods>Modname>Config>XUi

 

--

 

Now that I see your name, by the way, another modder who has been helping me a lot recommended I speak with you personally about this, so I'm glad you answered.

 

I wouldn't laugh :) You are trying something new, which is something everyone should be brave enough to try.

 

That window name already exists in vanilla, so if you are replacing it, you'll have to remove the existing one first

 

<windows>
   <remove xpath="/windows/window[@name='windowToolsCampfire']" />
   <append xpath="/windows">

<!--#$-IGS BEGIN: Adding cursor area. -$#-->
<window name="windowToolsCampfire" width="228" height="121" panel="Right" cursor_area="true" >
<!-- snip -->
</windows>

 

or if you are just updateing the required_tools, you could replace all that with:

 

<windows>
   <set xpath="/windows/window[@name='windowToolsCampfire']/rect[@name='content']/grid[@name='inventory']/@required_tools">toolFryingpan,toolFryingpan,toolFryingpan</set>
</windows>

 

This will just change the required_tools attribute.

Link to comment
Share on other sites

So, if I add that first part of the code you've given me there into my modded windows.xml, it will essentially have the game recognised my modded version by default? I'm trying to do all of this without messing around with the default xml files, so... If that's what that top part of code you gave me there will do, that's exactly what I'm after.

Link to comment
Share on other sites

So, if I add that first part of the code you've given me there into my modded windows.xml, it will essentially have the game recognised my modded version by default? I'm trying to do all of this without messing around with the default xml files, so... If that's what that top part of code you gave me there will do, that's exactly what I'm after.

 

Both will work. The second one is a much smaller change, doing the exactly same thing.

Link to comment
Share on other sites

I'd be timing you!

Now, one more thing, if I removed those three instances of toolFryingpan from that code, would it leave blank input spaces? I'd like for pretty much anything to go into those boxes. Of course, if you put a piece of corn in there, that'd be pointless... but having blank spaces there would be ideal. Either that, or some generic cooking utensils icon.

-- just tried removing the toolFryingpans and got an error. So, something has to go in there, or is there a tweak that I can't spot that'd leave the spaces open?

 

Edit: ♥♥♥♥. Will I need a new object/prefab for the frying pan?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...