Difference between revisions of "User:Pangaea/Notes on infoboxes"

From RimWorld Wiki
Jump to navigation Jump to search
Line 74: Line 74:
 
Lives in data: In Biome table
 
Lives in data: In Biome table
 
</pre>
 
</pre>
 +
 +
== Infobox problems ==
 +
Hi, 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:
 +
<pre><nowiki>| mass_baby          = {{#vardefine: mass_baby | {{#if: {{{mass_baby|}}} | {{{mass_baby}}} |
 +
    {{#if: {{{mass_adult|}}} | {{#expr:{{{massadult}}}/5}} }} }} }} {{#var:mass_baby}}</nowiki></pre>
 +
 +
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:
 +
<pre><nowiki>{{#if: {{#var:mass_baby}} | {{!}} <div>Mass baby test</div> {{!!}} {{#var:mass_baby}} kg }}</nowiki></pre>

Revision as of 21:47, 26 July 2019

Template:Tocright

Pawn/Race/Animal

  <!-- Intro -->
| name               = String
| image              = File
| description        = Text    <!-- Plain, from XML files -->
| description_markup = Wikitext   <!-- With markup, for use in the article intro -->
| type               = Page    <!-- Animal? Mech? -->
| subtype            = Page    <!-- Domesticated? -->
<!--   General   -->
| basebodysize       = Float
| basehealthscale    = Float
| basehungerrate     = Float
| comfytemp_max      = Integer
| comfytemp_min      = Integer
| foodtype/diet      = Page
| flammability       = Float
| has_gender         = Boolean
| marketvalue        = Integer
| movespeed          = Float
<!--   Combat   -->
| armorrating_blunt  = Float
| armorrating_heat   = Float
| armorrating_sharp  = Float
| combatpower        = Integer
<!-- Life phases -->
| life_expectancy    = Integer
| mass_adult         = Float
| mass_baby          = Float
| mass_juvenile      = Float
| maturity_age       = Float
| minage_adult       = Float
| minage_baby        = Float
| minage_juvenile    = Float
| gestation_period   = Integer
| offspring_low      = Integer
| offspring_high     = Integer
<!--   Taming/hunting   -->
| handleskill        = Integer
| manhunter_damage   = Float
| manhunter_tamefail = Float
| nameontamechance   = Float
| nuzzlehours        = Integer
| petness            = Float
| predator           = Boolean
| maxpreybodysize    = Float
| trainability       = String     <!-- or Page? -->
| train_haul         = Boolean
| train_obedience    = Boolean
| train_release      = Boolean
| train_rescue       = Boolean
| wildness           = Float
<!--   Product   -->
| egg_amountlow      = Integer
| egg_amounthigh     = Integer
| egg_type           = Integer
| egg_time           = Integer
| leather_amount     = Integer
| leather_type       = Page     <!-- or Page? -->
| meat_amount        = Integer
| meat_type          = Page
| milk_amount        = Integer
| milk_time          = Integer
| shear_time         = Integer
| wool_amount        = Integer
| wool_type          = Page     <!-- or Page? -->
<!--   Other      -->
| ecosystemweight    = Float
| recipes_operation  = List (,) of String
| tradetags          = List (,) of String
<!--| butcherproducts?? (mechs) = Integer-->

Attack data: In Attack table
Lives in data: In Biome table

Infobox problems

Hi, 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 }}