SRL Archive - SRL Bugs

GetAllLevels is broken


Markus

2012-10-15 14:14:56

As title says, it is broken. Doesn't fill the array in.

litoris

2012-10-15 14:16:40

Check the code?

riwu

2012-10-15 21:19:04

You probably didn't call your DeclarePlayers procedure or has CurrentPlayer set to undeclared Players[].

Markus

2012-10-16 02:18:29

I did.

riwu

2012-10-16 02:29:05

From: Markus
I did.

Well that's strange, works fine for me.
program new;
{$DEFINE SMART}
{$I SRL/SRL.simba}

begin
SetupSRL;
NumberOfPlayers(1);
GetAllLevels;
writeln(Players[CurrentPlayer].Level);
end.

Returns:
[7, 7, 1 1, 1, 3, 4, 1, 3, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1] (changed some numbers for security)
The order stated in the description is wrong though, refer to the 'GameTab 2 Related Functions' for the actual one.

What did your debug write?

Markus

2012-10-16 02:46:12

Well I use it solely for the mining level, where it seems to return -1.

Procedure InitPlayer;
Begin
GetAllLevels; //Doesnt seem to work?
SetChat('on',1);
SetChat('friends',2);
SetChat('on',3);
SetAngle(SRL_ANGLE_HIGH);
FindNormalRandoms;
End;
It sets the angle correctly and switchtes to the right tab so I think we can assume the function gets called correctly.
The level gets writeln'd in the progress report:

WriteLn((IntToStr(I)) + ' : ' + Players[I].Nick + ' = ' +
Active + '; ' + Players[I].Loc + rand + '; B: ' + IntToStr(Players[I].Integers[0])
+ ' Essence;'+ ' M : ' + IntToStr(Players[I].Level[15])); //mining level doesnt seem accurate

Script: http://villavu.com/forum/showthread.php?t=73746

riwu

2012-10-16 02:56:35

If you are just getting one skill level call GetSkillLevel(SKILL_MINING) directly.
Like i said in previous post the description for GetAllLevels is wrong, SKILL_MINING = 14 (not 15), because the array starts from 0. Although it would return the skill level of herblore instead, not sure why it returns -1?

Le Jingle

2012-10-16 03:01:08

From: riwu
If you are just getting one skill level call GetSkillLevel(SKILL_MINING) directly.
Like i said in previous post the description for GetAllLevels is wrong, SKILL_MINING = 14 (not 15), because the array starts from 0. Although it would return the skill level of herblore instead, not sure why it returns -1?


Default result in;

function GetSkillInfo(Skill: Variant; Amount : Boolean): Integer;

riwu

2012-10-16 03:15:23

From: Le Jingle
Default result in;

function GetSkillInfo(Skill: Variant; Amount : Boolean): Integer;

Yeah but how did it fail grabbing the herblore level?

Le Jingle

2012-10-16 03:21:59

From: riwu
Yeah but how did it fail grabbing the herblore level?


I think in the result that's supposed to return a level may be to blame, however I'm in no position to fully fledged my accusation towards that (late night).

^ I was thinking of, within the function I mentioned before;

Result := StrToIntDef(GetNumbers(GetTextAtEx(Box.x1 - 2, Box.y1 -1, 100,
StatChars, False, True, 0, 3, 36095, 3, True, tr_Digits)), -1);
but I could indeed be very wrong. :/ Good to see, thought, you figured out how to get the array of skills back correctly :)

Cheers,
Lj