Jump to content

Syntax - Looking for


Apaseall

Recommended Posts

Hi, I am frustrated. Is there a location/place where I can read the syntax for the xml?

Where can I find a list of what properties/attributes I can or cannot assign to something?

What does a perfectly formed thing look like?

If I do not assign a property/attribute to something, is there a parent it inherits the none assigned property?

 

Here is an example to help clarify what I mean.

Take a bedroll. How would I know if it is an item, to be coded in items.xml or a blocks.xml?

Ok, by inspection I can see it is a thing to be coded in blocks.xml, because there is already one there.

But what if there was not? How would I know where I needed to code for it?

 

Say that I guess correctly and start to code for bedroll in blocks.xml.

How do I know what the list of valid attributes and or properties are?

Ok, by inspection I can see that this thing can have a Class. Its property Class is assigned an attribute named value.

How do I know that the property Class can be assigned an attribute called value, rather than say called name?

I see the attribute value is assigned text which reads as SleepingBag.

How do I know that SleepingBag is a vaild assignment to the attribute value?

Indeed doing a search I cannot find any definition or mention of SleepingBag being a Class at all!

 

Not all things in blocks.xml are assigned properties of Class.

How do I know if my thing needs a property called Class?

How do I know what a valid attribute would be?

How do I know what a vaild assignent to that attribute could be?

 

ATM I seem to be left with trying to populate ven diagrams trying to see what is needed for something.

Or to put it bluntly, I am groping around in the dark trying to find a cookie, not a monster.

 

So...Since I seem to have a basic grasp of xml (nodes, subnodes etc) and I can batter together some new xml or manipulate existing xml (append,insertBefore,set etc), where can I find the things that will interact correctly with the Fun Pimps code?

Since I am of the belief that we can create palaces of xml, but they are meaningless if they cannot interact with the reality within the game.

 

Can anyone point me in the right direction?

Nope, I do not want to sit through educational classes to teach me how to craft unity entities etc, what I am looking for is what every other programming language has, a dictionary of valid code and syntax.

I know that at least one person out there knows what valid code looks like.

Link to comment
Share on other sites


What you're asking for is fairly broad, and wouldn't be all in one place.

 

XML itself is a language with a standardized syntax. If you want to learn about it, this is an OK place to start:
https://www.w3schools.com/xml/

 

Of course, 7D2D doesn't use just any XML. It uses specific XML files, with specific tags, to configure the program. There is a file called XML.txt in the same directory as the game's XML config files, which explains it (more or less):
[game directory]/Data/Config/XML.txt

 

There is also a Stealth.txt file which has stealth info, and several of the XML files themselves (like buffs.xml) have extensive comments.

 

To create a modlet that modifies those files at runtime, you can put your own XML files in a Config directory of your modlet. The modlet's XML files use XPath to target nodes in the game's XML files. (The game does not recognize XPath in its own game files.)

 

While XPath is also a standard, 7D2D does not support all of it. This forum thread by SphereII is the best reference that I've found:

 

 

(You only need to read the first six posts or so, the rest of the thread is people asking for help.)

 

If you want to dig deeper into XPath, here are a couple of sites where you can learn more:
https://www.w3schools.com/xml/xpath_intro.asp


https://developer.mozilla.org/en-US/docs/Web/XPath

 

...though, any XPath docs you'll find on the Web will focus mainly on using XPath with XSLT or JavaScript. That's how most people use XPath, but it's not what 7D2D does.

Hope that helps.

 

And, if you need more, or to figure out how to do something specific - ask here, there are lots of people who are happy to answer specific questions.

Link to comment
Share on other sites

Big, reply, many thanks.

Short comment, the part about [game directory]/Data/Config/XML.txt  might be what I am seeking.

As also the Stealth.txt file.

Yes I have noticed that some mod authors have included some very helpful comments in their files, the comments about engine gears springs to mind.

 

Longer comment, thanks for the xml stuff, but I think I have a good enough working knowledge of that, good enough for 7D2D limited use of xml.

I have created successfully patches for other peoples modlets, either to bring up to game version, change some values and even created some new modlets (basically new items with different properties of copied items/blocks/item_modifications/recipes/localization/vehicles/etc etc).

 

It's the specific attributes/properties/values that the game code uses that has me a bit stumped.

Again thanks for the post.

 

If anyone else has information regarding the way the game code looks for specific properties/attributes/values and what VALID data for those is/are, please point me them out, or let me know.

Thanks.

Link to comment
Share on other sites

unfortunately a complete listing of all the XML attributes, properties, and their values (that the game uses) does not exist.. or, i'm not aware of it. The most you can do to, as @khzmusik has alluded to is to read the bits and pieces accumulated here on the forum and to open up an XML file in the game and eyeball through it.

 

it would certainly make the xpath modders' lives easier to have an XML reference bible for the game, but the devs likely don't have the time/resources to maintain that for us... as it would need be updated with each new game version release since new attributes/properties/values are often added and removed for the game.

 

there is a tool called the 7D2D Mod Creator by @wrathmaniac which is a windows application that reads in the games' XML files and let's you point and click your way into creating xpath mods. one feature is that it aggregates all the attribute/property/values for your chosen XML file in the game, and it presents it as a convenient drop down list. even though there is no explanation as to what each attribute/property/value means (nor does it know if one particular value is valid when paired to a particular attribute or property), at least the modder can see the full range of existing attribute/property/value that is available.. and have a solid base to start experimenting.

 

 

this tool is certainly very useful, but unfortunately it has no way of knowing of any unused XML attributes/properties/values that the devs use but are still valid. to be fair, no modder has any way of knowing this - otherwise it would already be pinned on this forum. ha.

 

in addition to 7D2D, i've done lots of modding with Minetest. The modding community for that game spoiled me, as they do in fact have a comprehensive mod programming reference detailing each attributes/properties/values that the modder can use. every modding community is different, and the one we have here for 7D2D just requires you roll up your sleeves and get your hands dirtier. it's the apocalypse afterall. 😁

 

 

Link to comment
Share on other sites

Sorry, neglected to pop back to this thread.

Many thanks for the reply @ErrorNull

I will take a look at the stuff you linked.

My greatest achievement for today...

    <!-- Tags for doors, using Class SecureLoot, should only tag locked things like locked doors and not all doors -->
    <append xpath="//block/property[@name='Class'and @value='DoorSecure']/../property[@name='Tags' and not (contains(@value, 'lockedDoor'))]/@value">,lockedDoor</append>


I must admit, it took a few looks at the code to get it right, but it is satisfying when it works.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...