SRL Archive - Test corner

XP Process


BraK

2006-03-20 13:19:10

This is just some i was working on. put it in your scripts in the reports and test it out. i'm have trouble getting it to integrate with my scripts. yes i do now that i need to remove the few things to get it to work. this is just the stand alone version for you to get a feel for how it works.


program XPProcess;

var

xpstart,xp,xpgain,xptotal,lvl,done,startlvl,lvlgain : integer;


procedure setup;
begin
xp := 100;
xpstart := 420;
startlvl:=5
end;

procedure calcxp;
begin
xpgain:=xp*done;
xptotal:=xpgain+xpstart;
end;

procedure calclvl;
begin
if (xptotal>0) and (xptotal<83) then lvl:=1;
if (xptotal>83) and (xptotal<174) then lvl:=2;
if (xptotal>174) and (xptotal<276) then lvl:=3;
if (xptotal>276) and (xptotal<388) then lvl:=4;
if (xptotal>388) and (xptotal<512) then lvl:=5;
if (xptotal>512) and (xptotal<650) then lvl:=6;
if (xptotal>650) and (xptotal<801) then lvl:=7;
if (xptotal>801) and (xptotal<969) then lvl:=8;
if (xptotal>969) and (xptotal<1154) then lvl:=9;
if (xptotal>1154) and (xptotal<1358) then lvl:=10;
if (xptotal>1358) and (xptotal<1584) then lvl:=11;
if (xptotal>1584) and (xptotal<1833) then lvl:=12;
if (xptotal>1833) and (xptotal<2107) then lvl:=13;
if (xptotal>2107) and (xptotal<2411) then lvl:=14;
if (xptotal>2411) and (xptotal<2746) then lvl:=15;
if (xptotal>2746) and (xptotal<3115) then lvl:=16;
if (xptotal>3115) and (xptotal<3523) then lvl:=17;
if (xptotal>3523) and (xptotal<3973) then lvl:=18;
if (xptotal>3973) and (xptotal<4470) then lvl:=19;
if (xptotal>4470) and (xptotal<5018) then lvl:=20;
if (xptotal>5018) and (xptotal<5624) then lvl:=21;
if (xptotal>5624) and (xptotal<6291) then lvl:=22;
if (xptotal>6291) and (xptotal<7028) then lvl:=23;
if (xptotal>7028) and (xptotal<7842) then lvl:=24;
if (xptotal>7842) and (xptotal<8740) then lvl:=25;
if (xptotal>8740) and (xptotal<9730) then lvl:=26;
if (xptotal>9730) and (xptotal<10824) then lvl:=27;
if (xptotal>10824) and (xptotal<12031) then lvl:=28;
if (xptotal>12031) and (xptotal<13363) then lvl:=29;
if (xptotal>13363) and (xptotal<14833) then lvl:=30;
if (xptotal>14833) and (xptotal<16456) then lvl:=31;
if (xptotal>16456) and (xptotal<18247) then lvl:=32;
if (xptotal>18247) and (xptotal<20224) then lvl:=33;
if (xptotal>20224) and (xptotal<22406) then lvl:=34;
if (xptotal>22406) and (xptotal<24815) then lvl:=35;
if (xptotal>24815) and (xptotal<27473) then lvl:=36;
if (xptotal>27473) and (xptotal<30408) then lvl:=37;
if (xptotal>30408) and (xptotal<33648) then lvl:=38;
if (xptotal>33648) and (xptotal<37224) then lvl:=39;
if (xptotal>37224) and (xptotal<41171) then lvl:=40;
if (xptotal>41171) and (xptotal<45529) then lvl:=41;
if (xptotal>45529) and (xptotal<50339) then lvl:=42;
if (xptotal>50339) and (xptotal<55649) then lvl:=43;
if (xptotal>55649) and (xptotal<61512) then lvl:=44;
if (xptotal>61512) and (xptotal<67983) then lvl:=45;
if (xptotal>67983) and (xptotal<75127) then lvl:=46;
if (xptotal>75127) and (xptotal<83014) then lvl:=47;
if (xptotal>83014) and (xptotal<91721) then lvl:=48;
if (xptotal>91721) and (xptotal<101333) then lvl:=49;
if (xptotal>101333) and (xptotal<111945) then lvl:=50;
if (xptotal>111945) and (xptotal<123660) then lvl:=51;
if (xptotal>123660) and (xptotal<136594) then lvl:=52;
if (xptotal>136594) and (xptotal<150872) then lvl:=53;
if (xptotal>150872) and (xptotal<166636) then lvl:=54;
if (xptotal>166636) and (xptotal<184040) then lvl:=55;
if (xptotal>184040) and (xptotal<203254) then lvl:=56;
if (xptotal>203254) and (xptotal<224466) then lvl:=57;
if (xptotal>224466) and (xptotal<247886) then lvl:=58;
if (xptotal>247886) and (xptotal<273742) then lvl:=59;
if (xptotal>273742) and (xptotal<302288) then lvl:=60;
if (xptotal>302288) and (xptotal<333804) then lvl:=61;
if (xptotal>333804) and (xptotal<368599) then lvl:=62;
if (xptotal>368599) and (xptotal<407015) then lvl:=63;
if (xptotal>407015) and (xptotal<449428) then lvl:=64;
if (xptotal>449428) and (xptotal<496254) then lvl:=65;
if (xptotal>496254) and (xptotal<547953) then lvl:=66;
if (xptotal>547953) and (xptotal<605032) then lvl:=67;
if (xptotal>605032) and (xptotal<668051) then lvl:=68;
if (xptotal>668051) and (xptotal<737627) then lvl:=69;
if (xptotal>737627) and (xptotal<814445) then lvl:=70;
if (xptotal>814445) and (xptotal<899257) then lvl:=71;
if (xptotal>899257) and (xptotal<992895) then lvl:=72;
if (xptotal>992895) and (xptotal<1096278) then lvl:=73;
if (xptotal>1096278) and (xptotal<1210421) then lvl:=74;
if (xptotal>1210421) and (xptotal<1336443) then lvl:=75;
if (xptotal>1336443) and (xptotal<1475581) then lvl:=76;
if (xptotal>1475581) and (xptotal<1629200) then lvl:=77;
if (xptotal>1629200) and (xptotal<1798808) then lvl:=78;
if (xptotal>1798808) and (xptotal<1986068) then lvl:=79;
if (xptotal>1986068) and (xptotal<2192818) then lvl:=80;
if (xptotal>2192818) and (xptotal<2421087) then lvl:=81;
if (xptotal>2421087) and (xptotal<2673114) then lvl:=82;
if (xptotal>2673114) and (xptotal<2951373) then lvl:=83;
if (xptotal>2951373) and (xptotal<3258594) then lvl:=84;
if (xptotal>3258594) and (xptotal<3597792) then lvl:=85;
if (xptotal>3597792) and (xptotal<3972294) then lvl:=86;
if (xptotal>3972294) and (xptotal<4385776) then lvl:=87;
if (xptotal>4385776) and (xptotal<4842295) then lvl:=88;
if (xptotal>4842295) and (xptotal<5346332) then lvl:=89;
if (xptotal>5346332) and (xptotal<5902831) then lvl:=90;
if (xptotal>5902831) and (xptotal<6517253) then lvl:=91;
if (xptotal>6517253) and (xptotal<7195629) then lvl:=92;
if (xptotal>7195629) and (xptotal<7955614) then lvl:=93;
if (xptotal>7955614) and (xptotal<8771558) then lvl:=94;
if (xptotal>8771558) and (xptotal<9684577) then lvl:=95;
if (xptotal>9684577) and (xptotal<10692629) then lvl:=96;
if (xptotal>10692629) and (xptotal<11805606) then lvl:=97;
if (xptotal>11805606) and (xptotal<13034431) then lvl:=98;
if (xptotal>13034431) then lvl:=99;

lvlgain:=(lvl-startlvl)
end;


begin
repeat
setup;
done:=done+5;
calcxp;
calclvl;
writeln('you have reached lvl '+inttostr(lvl)+' with '+inttostr(xptotal)+' Total XP.');
WriteLn('You have gained '+inttostr(lvlgain)+ ' levels.');
wait(200);
until (lvl=99);
end.

Edit: The whole last process is just for the testing not for the actual include.

program XPProcess;

var

xpstart,xp,xpgain,xptotal,lvl,done,startlvl,lvlgain : integer;


procedure setup;
begin
xp := 100;
xpstart := 420;
startlvl:=5
end;

procedure calcxp;
begin
xpgain:=xp*done;
xptotal:=xpgain+xpstart;
end;

procedure calclvl;
begin
if (xptotal>0) then lvl:=1;
if (xptotal>83) then lvl:=2;
if (xptotal>174) then lvl:=3;
if (xptotal>276) then lvl:=4;
if (xptotal>388) then lvl:=5;
if (xptotal>512) then lvl:=6;
if (xptotal>650) then lvl:=7;
if (xptotal>801) then lvl:=8;
if (xptotal>969) then lvl:=9;
if (xptotal>1154) then lvl:=10;
if (xptotal>1358) then lvl:=11;
if (xptotal>1584) then lvl:=12;
if (xptotal>1833) then lvl:=13;
if (xptotal>2107) then lvl:=14;
if (xptotal>2411) then lvl:=15;
if (xptotal>2746) then lvl:=16;
if (xptotal>3115) then lvl:=17;
if (xptotal>3523) then lvl:=18;
if (xptotal>3973) then lvl:=19;
if (xptotal>4470) then lvl:=20;
if (xptotal>5018) then lvl:=21;
if (xptotal>5624) then lvl:=22;
if (xptotal>6291) then lvl:=23;
if (xptotal>7028) then lvl:=24;
if (xptotal>7842) then lvl:=25;
if (xptotal>8740) then lvl:=26;
if (xptotal>9730) then lvl:=27;
if (xptotal>10824) then lvl:=28;
if (xptotal>12031) then lvl:=29;
if (xptotal>13363) then lvl:=30;
if (xptotal>14833) then lvl:=31;
if (xptotal>16456) then lvl:=32;
if (xptotal>18247) then lvl:=33;
if (xptotal>20224) then lvl:=34;
if (xptotal>22406) then lvl:=35;
if (xptotal>24815) then lvl:=36;
if (xptotal>27473) then lvl:=37;
if (xptotal>30408) then lvl:=38;
if (xptotal>33648) then lvl:=39;
if (xptotal>37224) then lvl:=40;
if (xptotal>41171) then lvl:=41;
if (xptotal>45529) then lvl:=42;
if (xptotal>50339) then lvl:=43;
if (xptotal>55649) then lvl:=44;
if (xptotal>61512) then lvl:=45;
if (xptotal>67983) then lvl:=46;
if (xptotal>75127) then lvl:=47;
if (xptotal>83014) then lvl:=48;
if (xptotal>91721) then lvl:=49;
if (xptotal>101333) then lvl:=50;
if (xptotal>111945) then lvl:=51;
if (xptotal>123660) then lvl:=52;
if (xptotal>136594) then lvl:=53;
if (xptotal>150872) then lvl:=54;
if (xptotal>166636) then lvl:=55;
if (xptotal>184040) then lvl:=56;
if (xptotal>203254) then lvl:=57;
if (xptotal>224466) then lvl:=58;
if (xptotal>247886) then lvl:=59;
if (xptotal>273742) then lvl:=60;
if (xptotal>302288) then lvl:=61;
if (xptotal>333804) then lvl:=62;
if (xptotal>368599) then lvl:=63;
if (xptotal>407015) then lvl:=64;
if (xptotal>449428) then lvl:=65;
if (xptotal>496254) then lvl:=66;
if (xptotal>547953) then lvl:=67;
if (xptotal>605032) then lvl:=68;
if (xptotal>668051) then lvl:=69;
if (xptotal>737627) then lvl:=70;
if (xptotal>814445) then lvl:=71;
if (xptotal>899257) then lvl:=72;
if (xptotal>992895) then lvl:=73;
if (xptotal>1096278) then lvl:=74;
if (xptotal>1210421) then lvl:=75;
if (xptotal>1336443) then lvl:=76;
if (xptotal>1475581) then lvl:=77;
if (xptotal>1629200) then lvl:=78;
if (xptotal>1798808) then lvl:=79;
if (xptotal>1986068) then lvl:=80;
if (xptotal>2192818) then lvl:=81;
if (xptotal>2421087) then lvl:=82;
if (xptotal>2673114) then lvl:=83;
if (xptotal>2951373) then lvl:=84;
if (xptotal>3258594) then lvl:=85;
if (xptotal>3597792) then lvl:=86;
if (xptotal>3972294) then lvl:=87;
if (xptotal>4385776) then lvl:=88;
if (xptotal>4842295) then lvl:=89;
if (xptotal>5346332) then lvl:=90;
if (xptotal>5902831) then lvl:=91;
if (xptotal>6517253) then lvl:=92;
if (xptotal>7195629) then lvl:=93;
if (xptotal>7955614) then lvl:=94;
if (xptotal>8771558) then lvl:=95;
if (xptotal>9684577) then lvl:=96;
if (xptotal>10692629) then lvl:=97;
if (xptotal>11805606) then lvl:=98;
if (xptotal>13034431) then lvl:=99;

lvlgain:=(lvl-startlvl)
end;


begin
repeat
setup;
done:=done+5;
calcxp;
calclvl;
writeln('you have reached lvl '+inttostr(lvl)+' with '+inttostr(xptotal)+' Total XP.');
WriteLn('You have gained '+inttostr(lvlgain)+ ' levels.');
wait(200);
until (lvl=99);
end.

EDIT2: Yep sure does work without the less than.

EDIT3: Alright ppl the release of my usable xpprocess include is ready and here it is. So have fun testing it. Feel free to play around with it and give a lil credit for the hard work;)

Krazy_Meerkat

2006-03-20 15:25:13

Wow that must have taken you a long time :0
We already have a much simpler way to check levels, we just read the text in the stat tab. But I have a feeling this could be very useful for keeping track of levels. Instead of checking the stat tab every 10 mins for the whole script, we could use an exp value to know how many levels we have gained :)
It would be a shame to see all that work go to waste

XxKanexX

2006-03-20 15:56:12

From: Krazy_Meerkat
Wow that must have taken you a long time :0
We already have a much simpler way to check levels, we just read the text in the stat tab. But I have a feeling this could be very useful for keeping track of levels. Instead of checking the stat tab every 10 mins for the whole script, we could use an exp value to know how many levels we have gained :)
It would be a shame to see all that work go to waste

True, thank you Brak for your hard work.

As for saving levels Krazy, there could be a global variable that on the first check of a stat saves its level. And normaly people check there current xp when fishing, woodcutting, etc.

I don't know a good use for this, Brak. But, i will try and think of something. It would have taken a while. :)

BraK

2006-03-20 16:01:28

well thanks for the appreciation for my hard work:D and yea it did take quite a while. I updated with a simple lvl gain feature. this came about do to my lack of SRL knowledge and wanting to make it easier for me to read my reports.

Flyboy

2006-03-20 20:31:03

Well done.

when I was looking at it a thought struck me, you can elliminate the <less than> part and it will still work perfectly.

if (xptotal>0) then lvl:=1;
if (xptotal>83) then lvl:=2;
.
. etc.

masquerader

2006-03-20 21:13:15

program xp;
var
level,diff,xp:integer;
begin
for level:=1 to 99 do
begin
diff:=trunc(level+300*pow(2,level/7));
xp:=xp+diff;
writeln('level '+inttostr(level)+': '+inttostr(xp/4)+' xp');
end;
end.
i dunno, i found the formula on google somewhere :p

BraK

2006-03-21 00:09:59

thats one crazy formula you got there. Whoever came up with that really had nothing to do.

Edit: Might have to try it minus the less than part>

Krazy_Meerkat

2006-03-21 06:41:03

Wow that formula is a pretty good find (I don't know what to call you for short, masquerader..)

BraK

2006-03-21 11:25:03

i believe i have the bugs worked out of using it as an include.

Worked for 6 Minutes and 7 Seconds
———————-BraK's Fletcher v2.1—————————-
##########################################
You have gained 4428 xp and 0 Levels.
You currently have 1018086 XP and reached Level 73.
You have fletched 108 total logs.
Ran 4 time

"And our sticky note of the week goes to"
"Drum roll "
"………."
"………."
"………."
"………."
"………."
"Flyboy"
"Here ya go Flyboy"

+——————–+
|—–Thanks——-|
|——for-all——–|
|—-the–help—–|
|———————|
|——BraK–:D—|
|———————|
+——————–+

Flyboy

2006-03-21 12:40:43

From: BraK

"And our sticky note of the week goes to"
"Drum roll "
"………."
"………."
"………."
"………."
"………."
"Flyboy"
"Here ya go Flyboy"

+——————–+
|—–Thanks——-|
|——for-all——–|
|—-the–help—–|
|———————|
|——BraK–:D—|
|———————|
+——————–+

<:o walks up to podium to accept award :o>
Thank you for this honor, I would like to thank a few people who shaped my life to make winning this great award possible.

My mom, who without her I would still just be an urge in my daddy.
My brother, who taught me the value of community and sharing.
and lastly my teddy bear, who kept me sane through many sleepless night before I got a computer

thanks again <Starts to sniffle as tears well up in eyes>

BraK

2006-03-21 12:51:52

From: Flyboy
<:o walks up to podium to accept award :o>
Thank you for this honor, I would like to thank a few people who shaped my life to make winning this great award possible.

My mom, who without her I would still just be an urge in my daddy.
My brother, who taught me the value of community and sharing.
and lastly my teddy bear, who kept me sane through many sleepless night before I got a computer

thanks again <Starts to sniffle as tears well up in eyes>


LMAO thats a new reaction

Brown

2006-03-21 17:49:51

That must have taken for ever to make.

Flyboy

2006-03-22 18:10:41

If this is for SRL it will need a few things changed:

1. be more generic in nature.
2. No global variables
3. Self Explanitory names
4. Follow formating standards
5. 100% accurate (if your xp is 0 you should be at lvl 1)

I suggest you start with this as the function name:

{*******************************************************************************
function ConvertXpToLvl(Xp: Integer):Integer;
By:
Description: Returns your skill level based on your xp level
*******************************************************************************}
function ConvertXpToLvl(Xp: Integer):Integer;
//rest of code here
great start, just these few odds and ends and it rocks.

Krazy_Meerkat

2006-03-23 00:11:19

If you have an accurate formula then you should use it. It will save you quite a lot of time and effort, not to mention making the script shorter.

BraK

2006-03-23 06:03:50

you guys are right sry bout that

masquerader

2006-03-23 15:59:40

From: BraK
yea but i always believe there is nothing more accurate than the actual facts. that formula might work might not might be off by a bit but the numbers here won't mess up.

function convertxptolvl(xp:integer):integer;
var
level,diff,exp:integer;
begin
for level:=1 to 99 do
begin
diff:=trunc(level+300*pow(2,level/7));
exp:=exp+diff;
if((exp/4)>xp)then
begin
result:=level;
exit;
end;
end;
result:=99;
end;
it doesnt mess up…
please test that before committing a 200 line include
thank you

Krazy_Meerkat

2006-03-23 16:58:45

^^ Ditto.
You have to test things before you discredit them >.>

Flyboy

2006-03-23 18:56:53

Personaly I think Brak has a great idea for SRL. Since the spirit of SRL Development is to put the best method in and avoid stuff getting put in just because it's someones sacrid cow (unless your name is Fakawi then we hummor him ;)).

When the SRL Development team can't choose which is better we test them…

Here is a tester that took a lot more work to make then either method. It will deside which code is most efficent. People please run and post the report box msg as all scripts run differently on different platforms…


**Deleted and posted on new post**

masquerader

2006-03-23 19:19:28

From: Flyboy
Personaly I think Brak has a great idea for SRL. Since the spirit of SRL Development is to put the best method in and avoid stuff getting put in just because it's someones sacrid cow (unless your name is Fakawi then we hummor him ;)).

When the SRL Development team can't choose which is better we test them…

Here is a tester that took a lot more work to make then either method. It will deside which code is most efficent. People please run and post the report box msg as all scripts run differently on different platforms…

lol, that test confuses me, it doesnt even use convertxptolvl2 or display atime :confused:
braks is probably faster anyway, but longer :p
you decide what "efficient" is

BraK

2006-03-24 00:18:51

according to this test mine is faster but it doesn't matter to me. choose whichever you decide i'll support it either way.

BraK

2006-03-24 00:41:24

From: Flyboy
what is confusing… just run it.


another reason to go with mine its simple and ppl can understand it.:p

masquerader

2006-03-24 00:41:41

From: Flyboy
what is confusing… just run it.

procedure WriteReport(bTime, aTime: Integer);
begin
ClearReport;
AddToReport('Average time to process in MilliSeconds');
AddToReport('Brak''s Method Avg Time: ' + inttostr(bTime));
AddToReport('Alternate Method Avg Time: ' + inttostr(bTime));
end;
and
  // Test Brak's method
wait(1);
StartTime := GetSystemTime;
for i := 1 to Loops do
lvl := ConvertXpToLvl(xp);
BElapsedTime := GetSystemTime - StartTime;
wait(1);

// Test Alernate Formula Based Method
wait(1);
StartTime := GetSystemTime;
for i := 1 to Loops do
lvl := ConvertXpToLvl(xp);
AElapsedTime := GetSystemTime - StartTime;
wait(1);
lol, if you fix those parts, on my computer anyway, the alternate method is faster until about level 50, but it gets slower after that :p
brak's is always consistant, but the alternate one increases in time because it has to compute the numbers

Flyboy

2006-03-24 01:25:57

Here download and run this little test. It will determine which of the two methods is fastest.

Cheers,
Flyboy

p.s.
masquerader what didn't you like about the report? Works ok for me… the report is just entertainment till the script ends and writes it's conclusion.