ID:1843282
 
(See the best response by Mr_Goober.)
Im not exactly sure how to do it in the way im seeking but I'm trying to have my code take a result and minus a % from that result but I can't figure out how to make it just - the % like blah+blah=4-5% is there a way to just have it be %? or do I have to figure out a equation to do so like 2/100 to get 2% but when i do this it just minuses the 0.02 instead of the actual %
Best response
In order to get the percentage of that value, you need to calculate it using multiplication.
var/a = 10
var/b = a * (60/100) // 60% of 10, being 6
var/c = a - b // result is 4


Should you need a handy proc:
proc/percentage(A,B)
return A * (B/100)


an example:
thing = 100 - percentage(100,20) // 20% of 100 is 20


The symbol % means modulo, which calculates the remainder of a division equation (such as 100 % 7 = 2, where 7 goes into 100 14 times with 2 remaining)
take a result and minus a % from that result

pretty much directly translates to

new_result = result - percent * result
// 100% == 1 of course

// simpler, factor out result
new_result = result * (1 - percent)

// e.g.
result *= 1 - 0.02

// or you could use the actual scalar
result *= 0.98
problem im having is the code is basically

rank+25*level/mod then whatever the result is it would - a % from it before giving the end result

var/a = 10
var/b = a * (60/100) // 60% of 10, being 6
var/c = a - b // result is 4


problem is how do i put in the equation in for A and how do I put in the the % var so its A*(var/100) below is what im trying to get it to look like or work like

var/a = rank+25*level/mod
var/b = a * (reduction/100) // 60% of 10, being 6
var/c = a - b // result is 4


reduction being w/e the number is for the %
In response to Mastergamerx
var/a = rank + 25 * level / mod
var/b = a * (reduction/100)
var/c = a - b


Why does this not work? Also, please don't use variable names like a,b,c. It's not easy for us to understand what those variables are supposed to be.
well when i tried it the compiler said that the level/mod was a unassigned var even though it was a var and reduction was same thing
nvm i got it to work as i wanted