Topic on User talk:Mehni

Jump to navigation Jump to search
Pangaea (talkcontribs)

Hi Mehni, you seem to know your way around the modding and coding stuff in the game, so figured I'd ask you directly. I'm working on rewriting a bunch of templates, and am looking at the game XML files. One of the defs is work to make, which is typically a high number in the XMLs, e.g. 4000. How is this translated to the actual game? Is it an easy and straightforward formula?

Jimyoda (talkcontribs)

Think I can shed some light on this. The WorkToMake (for items) and WorkToBuild (for buildings) stats are in units of game ticks.
Now I'll explain the messy bits....

  • Many properties for stats used to be listed like "Flammability" and later changed to be like "Flammability Base". The WorkToMake XML tag should be stored in the property "Work To Make Base", however, many pages were never changed over from the obsolete "Work To Make". I think I tried cleaning up alot of that, but clearly missed some.
  • Here's the other mess... At normal speed, there are 60 game ticks per second. If an item's XML says its WorkToMake is 450 but the wiki says "Work To Make Base" is 8, then that is in units of seconds; ticks divided by 60 and then rounded up. The author either got that by doing the math, or more likely from the stat listed from the game's GUI for that item. Apparently the game converts it rather than showing you the raw tick count from the XML. The problem is that some pages have "Work To Make Base" in ticks while some are in seconds. That should be fixed for consistency.


Feel free to reach out to me for most anything. Starting about 4 years ago, I've worked on this wiki with properties, tables, infoboxes, templates, and SMW queries. I've never worked with Cargo, but I'm willing to learn and help.

Pangaea (talkcontribs)

Thanks, this sounds great. Can get confusing though, when WorkToMake in the XML files say one thing, and Work amount in-game - what one would think is the same - say something completely different. Probably best to rely on the XML values. But then people will see a high value when editing the page, and maybe input what they see in-game.

I see this process is going to be much the same as earlier, though. The hard part isn't really the SMW to Cargo transition itself, but making sure the data is correct and structured sensibly. And unfortunately it's much harder to get a good overview of the actual data in this game compared to some others. As you touch on, the data for the same item/whatever is stored in several different files. Typically at least one parent/base item. Makes sense from a programming point of view of course, but makes it difficult for mere mortals to know what is going on. Currently I'm looking at animals, and good grief. I'm up to some 60-70 fields, and that is after tossing attack data into its own table. And doubt I've found it all. If you happen to have some type of list for all data that is truly associated with each thing, that would help out a lot.

Tiny example: I've found minimum comfy temp for wolves and whatnot, but haven't come across maximum comfy temp yet. Strange.

Anywho, I've written a bit on the forum instead since there is more feedback for some reason, and here is an early draft of a new animal infobox, with the attack data split out. Forum post.

On the topic of attack data, do you know more about how these surprise-related fields behave? And when there are two different attacks under <capacities><li>, does that mean both get applied, or is there a 50% chance for each? Some mechs have it for instance.

Pangaea (talkcontribs)

Oh nuts. I hoped to be able to rely on XML data instead of jotting down from the game (time-consuming), but then I noticed leather amount for a lynx. Base is 30. Then body size is 80%. So we're down to 24. Then post-process curve enters the fray, and boosts it to 28. This is going to be a slight nightmare. Well, I'll try to work on the template at least. Try to get somewhere in between the confusion and mess :X

Pangaea (talkcontribs)

Probably not the best place to discuss this now, but in any case -- here is a page I created with some notes about the infoboxes. Currently a bunch of data about animals, though I'm thinking about putting mechs into such a template too.

Also think it might be better to not separate clothing and armour. It's mostly the same data, apart from better protection from what is called armour.

Pangaea (talkcontribs)

Hi Jimyoda, since you've worked on all aspects on the wiki for 4 years, figured I'd reach out to you and hope you see what the issue is. I'm working more on the animal template and trying to put in code similar to in the infobox main template, so there is a backup for mass_young and such, which relies on a formula. The code looks correct to my eyes, but something is wrong because I get an error on the actual page: Expression error: Unrecognized punctuation character "{".

This is what the code in the template looks like:

| mass_baby          = {{#vardefine: mass_baby | {{#if: {{{mass_baby|}}} | {{{mass_baby}}} | 
    {{#if: {{{mass_adult|}}} | {{#expr:{{{massadult}}}/5}} }} }} }} {{#var:mass_baby}}

The idea is to use vars to be able to store the correct data in Cargo, but without having to use the same chained ifs and whatnot in the output display section as well.

The output looks like this, but I think the error is further up, in the above section:

{{#if: {{#var:mass_baby}} | {{!}} <div>Mass baby test</div> {{!!}} {{#var:mass_baby}} kg }}
Pangaea (talkcontribs)

Strange. I tried to post the exact same text on Jimyoda's discussion page, but kept getting an internal error, even when I removed all but one normal sentence without any code. Weird.

Pangaea (talkcontribs)

Woot. It finally worked. For some reason I don't really understand given the definitions, I had to use formatnum around the formula. Apparently the number 70 wasn't stored as a number -- I suppose. Go figure. But this worked \o/

{{#vardefine: mass_baby | {{#if: {{{mass_baby|}}} | {{{mass_baby}}} | 
    {{#expr: {{formatnum: {{{mass_adult}}}|R}}/5}} }} }} {{#var:mass_baby}}
Reply to "Defs"