Forums › English Language Forums › General › Wiki Editors

Search

Inserting calculations?

3 replies [Last post]
Sat, 05/27/2017 - 08:03
Jenovasforumchar's picture
Jenovasforumchar

Hello editors,

I would like to use some raw numbers at base and have a more convinient number displayed to the viewer.

How can I add calculations into the wiki when I add only a number.

For starters: I want to enter 3 and have the result multiplicated by 2 and then have 1 subtracted, so it shows a 5 in the end.

Background:
I want to enter the raw testing data from shield damage and get finally a % number of how much damage an attack deals to a specific shield that people can work with and compare even shields across different star levels.
http://wiki.spiralknights.com/User:JenovaSPIRIT/Shield_Damage_Chart

Sat, 05/27/2017 - 10:17
#1
Skepticraven's picture
Skepticraven
↑↑↓↓←→←→ba

Check out this page: link.
I used a template to create a function with parameters. (Function template here.)

Sun, 05/28/2017 - 07:43
#2
Jenovasforumchar's picture
Jenovasforumchar
Thanx

Thanx, I think I got it now. Your template was very helpful and finally I know what a template actually is and how it works. By using your template I created my own here (don't worry, I will clean it up once it is fully completed):
http://wiki.spiralknights.com/User:JenovaSPIRIT/ShieldDMGPercent

Exspecially helpful proved that wiki help page with these operators
https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions

The only thing left now is a command that forces one decimale bayond the comma, even if it is zero.

aka:
it shall show a
80.0
instead of a
80

Mon, 05/29/2017 - 05:05
#3
Skepticraven's picture
Skepticraven
↑↑↓↓←→←→ba

Yah, the parser functions are very unforgiving. Type one thing wrong, and it'll spit out complete nonsense on the page.

As for the decimal item, you can likely force it with remainder/modulo operators.

80.0 = 80 + 0.0 = int(800/10) + 800%10

Powered by Drupal, an open source content management system