Calculators/Form calculators

From the RuneScape Wiki, the wiki for all things RuneScape
Jump to: navigation, search
For tests, see RuneScape:Calculators/Form calculators/Tests.

Form calculators use a script that enables dynamic loading of templates into parts of a page. A configurable form is used to input parameters into the template.

Configuration[edit | edit source]

The JS calculator's configuration section uses name = value pairs, each separated by a newline. The possible names are:

  • template - The name of the template to use on form submittal. If no namespace is provided, then the template namespace will be searched by default. If the template is in the main namespace, you must prepend a colon to the article name. This follows the same convention that's used when transcluding templates into a page.
  • form - The unique HTML ID of the element that will contain the form. Each configuration block should specify a different form ID.
  • result - The unique HTML ID of the element that will contain the parsed template.
  • suggestns - A comma-separated list of namespace IDs to use for autocomplete. This field applies for all article parameter types used in the form. By default, namespace 0 (main) is searched. See the table to the bottom for the valid namespace IDs.
  • param - Defines a parameter to be sent to the template, in the format shown in the next section.

Parameter format[edit | edit source]

A param line should be in the following format:

param = Param name|Label name|Default value|Param type|Param range
  • Param name - The name of the parameter as used by the template. Parameter names are case sensitive, and there can be no spaces.
  • Label name - The label used for the parameter in the form. If blank, Param name is used. Label name supports using HTML to format the labels - including simple formats like <em>, <span> and even <img />.
    • However, normal wikiscript can only be used if the config is contained within a div tag instead of a pre tag
  • Default value - The default value used to prefill the form initially.
  • Param type - The type of the parameter, used for form validation and to control the appearance of the form field. Valid values for Param type are:
    • string (default) - The input box can contain any value.
    • article - The input box should contain an article name. Currently, this means that autocomplete will be enabled for the text box. To set the namespaces searched by autocomplete, use the suggestns field (see above).
    • number - The input box must contain a number. A valid range can be specified in Param range in the format min-max. If either min or max is omitted or a range is not given, then infinity is assumed.
    • int - The input box must contain an integer. A valid range can be specified (see above).
    • select - The input is selected from a comma-separated list of values given in Param range.
    • check - A checkbox, with values sent to the template defined by the Param range.
      • The Param range has format value if true,value if false, which defines what the form will pass to the template when ticked or not ticked. The default for this is true,false.
      • The checkbox will be checked by default if the Default value is set to true or the same as the value if true given in the Param range.
    • hs - A special field which attempts to lookup a player's hiscores for values to be passed into other parameters.
      • Currently, Default value is ignored. The form will automatically try to prefill the form with the last name entered in a hs< type box.
      • Param range has a format of otherparam,skill,value where otherparam is the Param name of any other parameter in the form, skill is the integer of the skill to lookup (as defined by the table to the bottom), and value is 0 for rank, 1 for level and 2 for experience (0 for rank and 1 for score in minigames). Multiple parameters can be changed by using ; - i.e. otherparam,skill,value;thirdparam,skill2,value2.
    • fixed - The value specified by Default value will be shown but cannot be changed in the form.
    • hidden - The value specified by Default value will be hidden in the form and cannot be changed. No row is generated for the form at all.
    • semihidden - A combination of fixed and hidden: The value specified by Default value will be hidden in the form and cannot be changed, but unlike hidden, a row is added to the form, which is hidden with CSS. This is primarily for inter-script usage (i.e. some other script sets the semihidden value to something so that it is passed to the template when submitted).
  • Param range - The allowed range of the parameter. The format of this field depends on the Param type chosen.

The configuration section should be contained within a <div> or <pre> tag with the class jcConfig, e.g.:

<pre class="jcConfig">
  ... configuration ...
</pre>

IDs[edit | edit source]

Namespaces[edit | edit source]

Namespace IDs
Namespace Article ID Talk ID
Media -2 N/A
Special -1 N/A
(main) 0 1
User 2 3
RuneScape 4 5
File 6 7
MediaWiki 8 9
Template 10 11
Help 12 13
Category 14 15
Update 100 101
Forum 110 111
Exchange 112 113
Charm 114 115
Calculator 116 117
Map 118 119
Module 828 829

Hiscores[edit | edit source]

Hiscore IDs
Skills
Skill ID Skill ID
Total Level.png: RS3 Inventory image of Total LevelOverall 0 Attack.png: RS3 Inventory image of AttackAttack 1
Defence.png: RS3 Inventory image of DefenceDefence 2 Strength.png: RS3 Inventory image of StrengthStrength 3
Constitution.png: RS3 Inventory image of ConstitutionConstitution 4 Ranged.png: RS3 Inventory image of RangedRanged 5
Prayer.png: RS3 Inventory image of PrayerPrayer 6 Magic.png: RS3 Inventory image of MagicMagic 7
Cooking.png: RS3 Inventory image of CookingCooking 8 Woodcutting.png: RS3 Inventory image of WoodcuttingWoodcutting 9
Fletching.png: RS3 Inventory image of FletchingFletching 10 Fishing.png: RS3 Inventory image of FishingFishing 11
Firemaking.png: RS3 Inventory image of FiremakingFiremaking 12 Crafting.png: RS3 Inventory image of CraftingCrafting 13
Smithing.png: RS3 Inventory image of SmithingSmithing 14 Mining.png: RS3 Inventory image of MiningMining 15
Herblore.png: RS3 Inventory image of HerbloreHerblore 16 Agility.png: RS3 Inventory image of AgilityAgility 17
Thieving.png: RS3 Inventory image of ThievingThieving 18 Slayer.png: RS3 Inventory image of SlayerSlayer 19
Farming.png: RS3 Inventory image of FarmingFarming 20 Runecrafting.png: RS3 Inventory image of RunecraftingRunecrafting 21
Hunter.png: RS3 Inventory image of HunterHunter 22 Construction.png: RS3 Inventory image of ConstructionConstruction 23
Summoning.png: RS3 Inventory image of SummoningSummoning 24 Dungeoneering.png: RS3 Inventory image of DungeoneeringDungeoneering 25
Divination.png: RS3 Inventory image of DivinationDivination 26 Invention Invention 27
Minigames
Minigame ID Minigame ID
Bounty Hunter.png: RS3 Inventory image of Bounty HunterBounty Hunter 28 Bounty Hunter.png: RS3 Inventory image of Bounty HunterBounty Hunter Rogue 29
Dominion Tower.png: RS3 Inventory image of Dominion TowerDominion Tower 30 Crucible.png: RS3 Inventory image of CrucibleCrucible 31
Castle Wars.png: RS3 Inventory image of Castle WarsCastle Wars 32 Barbarian Assault.png: RS3 Inventory image of Barbarian AssaultBarbarian Assault Attacker 33
Barbarian Assault.png: RS3 Inventory image of Barbarian AssaultBarbarian Assault Defender 34 Barbarian Assault.png: RS3 Inventory image of Barbarian AssaultBarbarian Assault Collector 35
Barbarian Assault.png: RS3 Inventory image of Barbarian AssaultBarbarian Assault Healer 36 Duel Arena#Tournaments.png: RS3 Inventory image of Duel Arena#TournamentsDuel Tournaments 37
Mobilising Armies.png: RS3 Inventory image of Mobilising ArmiesMobilising Armies 38 Conquest.png: RS3 Inventory image of ConquestConquest 39
Fist of Guthix.png: RS3 Inventory image of Fist of GuthixFist of Guthix 40 Gielinor Games.png: RS3 Inventory image of Gielinor GamesGG: Athletics 41
Gielinor Games/Resource Race.png: RS3 Inventory image of Gielinor Games/Resource RaceGG: Resource Race 42 The Bird and the Beast.png: RS3 Inventory image of The Bird and the BeastWE2: Armadyl contribution 43
The Bird and the Beast.png: RS3 Inventory image of The Bird and the BeastWE2: Bandos contribution 44 The Bird and the Beast.png: RS3 Inventory image of The Bird and the BeastWE2: Armadyl PvP kills 45
The Bird and the Beast.png: RS3 Inventory image of The Bird and the BeastWE2: Bandos PvP kills 46 Heist.png: RS3 Inventory image of HeistHeist: Guard Level 47
Heist.png: RS3 Inventory image of HeistHeist: Robber Level 48 Cabbage Facepunch Bonanza.png: RS3 Inventory image of Cabbage Facepunch BonanzaCFB: 5 games average 49
2015 April Fools.png: RS3 Inventory image of 2015 April FoolsAF2015: Cow Tipping 50 2015 April Fools.png: RS3 Inventory image of 2015 April FoolsAF2015: Post-miniquest rat kills 51

License[edit | edit source]

This script is released under the GNU General Public License. The source code is available at [[MediaWiki:Common.js/calc.js]].