Ask Tutorial
Jump to navigation
Jump to search
This section is a stub. You can help RimWorld Wiki by expanding it. Reason: Orphan - Needs links, and (more) to BE linked!. |
How-To: Properties & Queries
Property Syntax
Adding properties to pages
- Basic syntax: [[Example property::value]]
- How this looks on the page depends on the property's type. The default type is Page, which will display this the same as [[value]], i.e. the text 'value' which links to the wikipage 'value'.
- Properties with the Number type - very common on this wiki - will not add a link. They will just display as 'value'.
- Alternate display text: [[Example property::value|alt-text]]
- Displays as either [[value|alt-text]], for page links; or 'alt-text', for numbers.
- Set property without displaying anything: [[Example property::value| ]]
- The space is required.
If you add a property to a page, check that it's defined! If it isn't, the wiki will use the defaults, which are terrible. In this case you should create the property page yourself.
Defining Properties
Property is defined by special pages with the Property: prefix. For example, the "Beauty Base" property is defined by Property:Beauty_Base. At minimum a property page needs to define its type.
- Basic syntax: [[has property::type| ]]
- On this wiki the type should probably be either 'number' or 'page'.
- This is the exact same syntax as adding a property to a normal page. That's because has_type is also a property; it's a special built-in property.
- Helper template: {{Property with Page | page = Beauty | type = Number }}
- This sets the type and also displays See Beauty to link to the page that describes what this property is.
A property's page is also a wiki page, so you can add content to it as normal. It's fine to leave it blank.
Query Syntax
A query allows you to insert content, usually tables, which dynamically update based on data from other pages.
Example
Wiki code for the query:
{{#ask: [[Skill Base Factor::>0.4]] [[Skill Bonus Factor::+]] | ?Skill Base Factor# = Base | ?Skill Bonus Factor# = Factor | format = table | limit = 100 | mainlabel = Stat | sort = Skill Base Factor,Skill Bonus Factor | order = desc,desc }}
Wiki code on Mechanoid Disassembly Efficiency:
[[Skill Base Factor::0.75|75%]] plus [[Skill Bonus Factor::0.025|2.5%]] per skill level.
(Similar wiki code is on the other pages.)
Query output:
Stat | Base | Factor |
---|---|---|
Reading Speed | 1 | 0.02 |
Pruning Speed | 0.92 | 0.01 |
Social Impact | 0.82 | 0.0275 |
Mech Repair Speed | 0.8 | 0.1 |
Subcore Encoding Speed | 0.75 | 0.1 |
Butchery Efficiency | 0.75 | 0.025 |
Mechanoid Shredding Efficiency | 0.75 | 0.025 |
Hacking Speed | 0.75 | 0.025 |
Mech Gestation Speed | 0.75 | 0.025 |
Arrest Success Chance | 0.6 | 0.075 |
Negotiation Ability | 0.4 | 0.075 |
Medical Tend Speed | 0.4 | 0.06 |
Medical Operation Speed | 0.4 | 0.06 |
Mechanoid Shredding Speed | 0.4 | 0.06 |
Butchery Speed | 0.4 | 0.06 |
Drug Cooking Speed | 0.4 | 0.06 |
Comments:
{{#ask: // Begin a query. // Everything up to the next | is the query term. This particular example returns pages which: [[Skill Base Factor::>0.4]] // have the Skill_Base_Factor property, value is >0.4 [[Skill Bonus Factor::+]] // AND have the Skill_Bonus_Factor property, with any value // Define columns to show. The first column is the page name. | ?Skill Base Factor# = Base // The second column is the page's Skill_Base_Factor value, with heading 'Base'. | ?Skill Bonus Factor# = Factor // The third column is Skill_Bonus_Factor, with heading 'Factor' | mainlabel = Stat // The heading for the first column. // Optional settings. | format = table // This makes a fitted table. 'format = broadtable' makes a table as wide as the screen. | limit = 100 // Maximum number of pages to return. | sort = Skill Base Factor,Skill Bonus Factor // Sort by base factor, then bonus factor. | order = desc,desc }}