I don't understand how adding some math functions is going to save you from how many lines you have to check to get a result. In a 1 in 4 chance you have to do at least 3 checks followed by an else no matter what math you use. Seems having the math function at all adds unneeded processing to the script; when below you are going to have to check for each result anyway.
Maybe you can post an example, where it saves you some checks, to help me understand this.
It always depends on the application. A live example from my WIP: A wardrobe with a secret drawer.
To find it, the player needs 6 perception, but the check is modified by a random bonus or penalty from high or low luck:
set check to (player.getav luck - 5) * GetRandomPercent / 100 + ( player.getav perception ) if ( check >= 6 ) showmessage 001CheckSecretDrawer set found to 1 set msgup to 1 else
So while Luck 4-6 has no effect, with 7 Luck, there is a 50% chance to find it with just PER 5, and with 3 Luck there is a 50% chance to miss it with 6 PER. 10 Luck increases the chance to find it with PER 5 to 80%, it's still 60% with PER 4 and so on.
Of course it would have been possible to make with an if-construct, but it would have been much larger and harder to read.
A less esoteric variant would be rewarding the player with a random amount of caps that still is a round sum.
(e.g. 1100, 1200 ... 1900, 2000)
short capsset caps to Getrandompercent / 10 ;// make it 0-9set caps to caps * 100 + 1100 ;// second line required to truncate decimal placesplayer.additem Caps001 caps
vs.
short capsset caps to Getrandompercentif caps < 10 set caps to 1100elseif caps < 20 set caps to 1200elseif caps < 30 set caps to 1300elseif caps < 40 set caps to 1400elseif caps < 50 set caps to 1500elseif caps < 60 set caps to 1600elseif caps < 70 set caps to 1700elseif caps < 80 set caps to 1800elseif caps < 90 set caps to 1900else set caps to 2000endifplayer.additem Caps001 caps