Template:LinearInterp

From Old School RuneScape Wiki
Jump to: navigation, search
Template documentation
This documentation is transcluded from Template:LinearInterp/doc. [edit] [purge]

Usage

To call this template:

{{LinearInterp|<Skill Level>|<Low Chance Value>|<High Chance Value>|<Minimum Level>(optional)|<Maximum Level>(optional)}}

Where Skill level is the level at which you want to determine the Linear Interpolation Value, Low Chance is the Value at Minimum Level and High Chance is the value at Maximum Level. If Minimum and Maximum level are not entered, these will default to 1 and 99.

Takes into account flooring as per RuneScript, but Users must keep in mind that any changes to this value from other buffs/augmentation should also floor their result. Users should also keep in mind that due to the nature of how RAND() works in RuneScript, this value will be off-by-1. What this means is that, for example, RAND(256) will result in a value from 0 to 255, with 0 being classified as a valid roll and the resultant Linear Interpolation value compared against. To account for this the Linear Interpolation value should be incremented by 1 and if determining percentage chance, the denominator must be the RAND() value, not the maximum valid roll; i.e. must be 256, not the largest possible roll of 255.