SRL Archive - Research & Development Lounge

CalcCBlvl


Markus

2008-11-18 12:52:07

100% accurate, uses Jagex' own formula.


function CalcCBlvl(atk, str, def, hp, range, mage, pray, sum : integer) : extended;
begin
result := (maxe(maxe(0.25*(1.3*(atk+str)+def+hp+floor(pray div 2)+floor(sum div 2)), 0.25*(1.95*range+def+hp+floor(pray div 2)+floor(sum div 2))), (0.25*(1.95*mage+def+hp+floor(pray div 2)+floor(sum div 2)))));
end;

Script version:

program CBCalc;
const
atk = 40;
str = 52;
def = 1;
hp = 43;
pray = 1;
sum = 1;
range = 1;
mage = 15;

function CalcCBlvl(atk, str, def, hp, range, mage, pray, sum : integer) : extended;
begin
result := (maxe(maxe(0.25*(1.3*(atk+str)+def+hp+floor(pray div 2)+floor(sum div 2)), 0.25*(1.95*range+def+hp+floor(pray div 2)+floor(sum div 2))), (0.25*(1.95*mage+def+hp+floor(pray div 2)+floor(sum div 2)))));
end;

begin
writeln('Internal CB level: '+floattostr(CalcCBlvl(atk, str, def, hp, range, mage, pray, sum)));
writeln('Real CB level: '+inttostr(floor((CalcCBlvl(atk, str, def, hp, range, mage, pray, sum)))));
end.

Have fun :p

SirPa

2008-11-18 13:00:04

Internal CB level: 78,625
Real CB level: 78

Very nice! Works like a charm :)

Love it how you implented summoning! When i use a stat signature, it always says im CB 77, because they can't see my summoning level.
Even though my summoning is only lvl 8, it does make a difference ;)

~Sir

sjlou

2008-11-18 13:00:46

nice

how did you get your hands on the formula XD ?

Harry

2008-11-18 14:57:31

Markus is winnar. Maybe make a function to be able to know only a few levels, plus their combat level, then calculate the possibilities of the other levels?
Internal CB level: 103.375
Real CB level: 103

nielsie95

2008-11-18 14:57:52

From: dushii
nice

how did you get your hands on the formula XD ?


There's a thread on the RS forums about the formula.

Gu3st...

2008-11-18 15:38:17

Whats up with the standars?

Markus

2008-11-18 15:39:35

From: dushii
how did you get your hands on the formula XD ?

http://www.runescape.com/img/main/kbase/downloads_and_wallpapers/wallpaper_combattriangle/CombatT_1920x1200.jpg top right
From: Zytex!
Whats up with the standars?

Who needs standards for a one-line function ;)

From: Hy71194
Markus is winnar. Maybe make a function to be able to know only a few levels, plus their combat level, then calculate the possibilities of the other levels?

Well, that's exactly at my Todo list :p

[S]paz

2008-11-18 16:06:55

404 markus :) but still nice work :D:D:D

~Spaz

Heavenzeyez1

2008-11-18 16:19:42

That is amazing?
You little genius. :rolleyes:
Awesome job,
~Eerik~

botsrs

2008-11-25 18:11:37

This is sweet. Your too smart for us here. Well, at least me. :) Oh, and the link is a 404 Err.

Method

2008-11-25 18:18:55

It's a 404 error, but it's still valid. When you see the error, go to the page again (from the same tab) and you'll see it fine.

botsrs

2008-11-25 18:21:53

Thanks, that fixes it.

Illkillutill

2008-11-26 02:22:19

Very cool, though it's off by a couple of numbers. It gave me 112 when it should be 110. If you type in 99 everything and check it, it gives you 140.25.

Markus

2008-11-26 05:28:38

Try changing the 2*range/mage to 1.95*range or 1.95*mage and see if it makes a difference :)

Markus

2008-11-26 11:17:09

Fixed a bug which caused it to be off a bit sometimes, now gives cb 138 for everything 99 <3

Illkillutill

2008-12-06 21:45:10

Awesome, it worked great! This is pretty handy. Thanks for fixing it :).