Difference between revisions of "Ask Tutorial"

From RimWorld Wiki
Jump to navigation Jump to search
(It was mentioned this was needed... done.)
 
m
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
* Note: Copy/pasted from [[User:Khaim]]'s page; rename/rework as needed.
+
{{Stub|section=1|reason= Orphan - Needs links, and (more) to BE linked!}}
 +
<!--- Editors: This page was literally Copy/pasted from [[User:Khaim]]'s page, pure expedience, ZERO planning/linking/polishing; rename/rework as needed. -->
  
 
==How-To: Properties & Queries==
 
==How-To: Properties & Queries==
Line 87: Line 88:
 
* [https://www.semantic-mediawiki.org/wiki/Help:Result_formats Result formats]
 
* [https://www.semantic-mediawiki.org/wiki/Help:Result_formats Result formats]
 
* [https://www.semantic-mediawiki.org/wiki/Help:Special_properties Special properties]
 
* [https://www.semantic-mediawiki.org/wiki/Help:Special_properties Special properties]
 +
 +
[[Category:Help]]

Latest revision as of 20:09, 28 March 2022

How-To: Properties & Queries[edit]

Property Syntax[edit]

Adding properties to pages[edit]

  • 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[edit]

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[edit]

A query allows you to insert content, usually tables, which dynamically update based on data from other pages.

Example[edit]

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:

StatBaseFactor
Reading Speed10.02
Pruning Speed0.920.01
Social Impact0.820.0275
Mech Repair Speed0.80.1
Subcore Encoding Speed0.750.1
Butchery Efficiency0.750.025
Mechanoid Shredding Efficiency0.750.025
Hacking Speed0.750.025
Mech Gestation Speed0.750.025
Arrest Success Chance0.60.075
Negotiation Ability0.40.075
Medical Tend Speed0.40.06
Medical Operation Speed0.40.06
Mechanoid Shredding Speed0.40.06
Butchery Speed0.40.06
Drug Cooking Speed0.40.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
}}

MediaWiki references[edit]