XML?

Started by Dante King, March 23, 2015, 11:17:34 AM

Previous topic - Next topic

Dante King

What is XML? I've seen it in Defs and stuff but I don't know how to use or make it. Any help?

hyperkiller

XML (Extensible Markup Language) is like a text file but the encoding of it will allow programs be able to read and use it, like rimworld. Its more common to do it with XML since it has a nicer format for the programmer to see instead of a long line of text. (have you ever seen a minecraft crash report o.0) (you are able to view it in a regular notepad but that's what it would look like as a .txt, I tend to use notepad ++ and that can read XML how there formatted. there is a big difference in the looks.

Dante King

How do I make a XML file then? Can I use notepad, because I've been seeing them in notepad with a little bit of code at the front: <?xml version="1.0" encoding="utf-8" ?> Does this mean that it is a XML file? The other bits of coding I can figure out, it's just XML files and textures.

Ykara

Quote from: Dante King on March 23, 2015, 11:43:32 AM
How do I make a XML file then? Can I use notepad, because I've been seeing them in notepad with a little bit of code at the front: <?xml version="1.0" encoding="utf-8" ?> Does this mean that it is a XML file? The other bits of coding I can figure out, it's just XML files and textures.
Just download notepad ++ and browse the core xml files. That's very useful, especially for beginners. And usually you don't write the files by yourself, you just copy and paste them.
Have fun!

hyperkiller

I have little programming but I know how to minor programming and if i'm right, the utf-8 is the Standard Text format, which contains all the characters and special characters such as !@#$%. and to make a .XML, you just have to do a Save AS and save the file with a .XML at the end

ItchyFlea

Quote from: Dante King on March 23, 2015, 11:43:32 AM
How do I make a XML file then? Can I use notepad, because I've been seeing them in notepad with a little bit of code at the front: <?xml version="1.0" encoding="utf-8" ?> Does this mean that it is a XML file? The other bits of coding I can figure out, it's just XML files and textures.
You can use notepad and yes that means it's an XML file.

Notepad++ is being suggested because it makes reading XML files easier. (There are many other features that you'll discover over time that also make it better than notepad)

Here's one of the core files in Notepad:
http://i.imgur.com/19cpPzM.jpg
And here's the same file in Notepad++:
http://i.imgur.com/BUbdXGR.jpg
All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

apljee

As many others have suggested -- Notepad++ is reccomended (not only on the community's part but heavily on my part). If you're interested in beginning with modding, I'd look over the core files and read and try to make some sense of it. If you don't know, look it up on the forums or pop a question in the Help section of the forums.

Dante King

#7
Quote from: ItchyFlea on March 23, 2015, 04:51:27 PM
Quote from: Dante King on March 23, 2015, 11:43:32 AM
How do I make a XML file then? Can I use notepad, because I've been seeing them in notepad with a little bit of code at the front: <?xml version="1.0" encoding="utf-8" ?> Does this mean that it is a XML file? The other bits of coding I can figure out, it's just XML files and textures.
You can use notepad and yes that means it's an XML file.

Notepad++ is being suggested because it makes reading XML files easier. (There are many other features that you'll discover over time that also make it better than notepad)

Here's one of the core files in Notepad:
http://i.imgur.com/19cpPzM.jpg
And here's the same file in Notepad++:
http://i.imgur.com/BUbdXGR.jpg
Ok then, I get XML files, SO HAPPY! Now, onto textures, GIMP is good from what I hear

EDIT: How do I make the .TXT files with <?xml version="1.0" encoding="utf-8" ?>  at the top into a XML file, because they are being made into .TXT files

EDIT 2: Here is my code:



[attachment deleted due to age]

hyperkiller

save as all files then the name + .xml (you might need to go into the folder options and uncheck "hide extensions of known files"

[attachment deleted due to age]

Dante King

I figured this out with some help a few minutes ago, now, after I fixed the .XML issue, I have a "Charge Rifle has null ThingClass" in the console when I activate my mod, AND the charge rifle is gone from the dev spawn menu. I C&P'ed the Charge rifle from Weapons_Guns in ThingDefs and changed some stats, what is wrong?

cythedag

Quote
Ok then, I get XML files, SO HAPPY! Now, onto textures, GIMP is good from what I hear
I'm pretty new to modding this game, but I've been into texture editing for a while. I use Paint.net, but ive seen some others use Inkscape. Both are free programs.

cythedag

Quote from: Dante King on March 23, 2015, 08:39:29 PM
I figured this out with some help a few minutes ago, now, after I fixed the .XML issue, I have a "Charge Rifle has null ThingClass" in the console when I activate my mod, AND the charge rifle is gone from the dev spawn menu. I C&P'ed the Charge rifle from Weapons_Guns in ThingDefs and changed some stats, what is wrong?
Again I'm rather new so I may be wrong. But on line 50 you are missing a line of code from the core xml:

<ThingDef Name="BaseHumanGun" ParentName="BaseGun" Abstract="True">
    <weaponTags>
      <li>Gun</li>
    </weaponTags>
</ThingDef>

Try this out and let us know if it works or not.

cythedag

Actually wait, i just noticed you forgot to include the closing tag </ThingDefs> on the bottom of the XML. My bad I should have noticed that right as soon as I opened the file. Never forget to include the closing tags in your code. For example <ThingDefs> should always have a </ThingDefs> after all of the other content between those tags.

Liegeman

I've been doing XML mods with Brackets http://brackets.io/.
It's not as old and established as Notepad++, but it is easily extensible and has a handy project browser feature that makes organizing your mod easier. It is also able to view (but not edit) image files.

Dante King

#14
Ok then, I've added the HumanBaseGun code piece, and ending code bit, testing out now.

EDIT: It works! My first mod! Now, dropbox account made, how do I upload a folder instead of a file?