Log in

View Full Version : GetSkill Functions



TOB
11-28-2006, 01:44 AM
When will these be updated? Are they being worked on? If so, what problems are there?

Boreas
11-28-2006, 01:51 AM
What needs to be updated? Just hunting?

TOB
11-28-2006, 02:04 AM
Oh hmm doesn't seem to want to work for me.

Boreas
11-28-2006, 02:20 AM
Did you call setupsrl; ? Show me what isn't working.

TOB
11-28-2006, 02:40 AM
OMFG I feel like such an idiot...

I had been testing it on a separate script and forgot to add that...

Boreas
11-28-2006, 02:44 AM
Yea anything that uses text needs it.

TOB
11-28-2006, 03:17 AM
function CurrentSkillXp(Skill: String): Integer;

This isn't being able to retrieve the current xp for me.

Boreas
11-28-2006, 03:22 AM
It's monday, and today a so far flawless script has been dangerously buggy. Maybe an unannounced update. I'll take a look.

TOB
11-28-2006, 03:25 AM
I thought as much but I don't know enough of SRL and Delphi/SCAR to be able to fix some functions I was using.

Boreas
11-28-2006, 03:35 AM
Yea it doesn't work for me either. I think the coords of something has changed. I'll try to see what.

CamHart
11-28-2006, 03:41 AM
Since they added hunting the boxes with the skills have all changed in size. Atleast it looks different? So i figure thats it.

Boreas
11-28-2006, 03:46 AM
Edit: Ok I'm working on a temporary fix.

Edit2: Ok I think I got a temporary patch until SRL3.6.

TOB
11-29-2006, 01:31 AM
In your version I get returns of 0 for most of them and then other errors similar to,

[Runtime Error] : Exception: '48 00' is not a valid integer value in line 59 in script

Boreas
11-29-2006, 03:02 AM
Yea I'm still working on it.

Edit:
This works better for me. Gets everything except woodcutting. I don't know why. Please test as I have a hunch that my method may get screwed up when a skill has a long name, but shot exp, or something like that. Please tell me what skill screws up, the result, and the expected result.

CamHart
11-29-2006, 04:27 AM
Do HighScore Charts run exactly off what your level is in the game? Like has it changed from how it was in RSC, where it was only updated every month or so?

TOB
11-29-2006, 04:33 AM
begin
ActivateClient;
SetupSRL;
ClearDebug;
skillz[0] := 'attack';
skillz[1] := 'hitpoints';
skillz[2] := 'mining';
skillz[3] := 'strength';
skillz[4] := 'agility';
skillz[5] := 'smithing';
skillz[6] := 'defence';
skillz[7] := 'herblore';
skillz[8] := 'fishing';
skillz[9] := 'ranged';
skillz[10] := 'thieving';
skillz[11] := 'cooking';
skillz[12] := 'prayer';
skillz[13] := 'crafting';
skillz[14] := 'firemaking';
skillz[15] := 'magic';
skillz[16] := 'fletching';
skillz[17] := 'woodcutting';
skillz[18] := 'runecrafting';
skillz[19] := 'slayer';
skillz[20] := 'farming';

for i:= 0 to 20 do
begin
writeln(skillz[i] + ' Experience: ' + IntToStr(CurrentSkillXp2(skillz[i])));
end;
end.

Returns:


attack Experience: 48
hitpoints Experience: 992
mining Experience: 0
strength Experience: 616
agility Experience: 0
smithing Experience: 10192
defence Experience: 0
herblore Experience: 0
fishing Experience: 180
ranged Experience: 20
thieving Experience: 20
cooking Experience: 80
prayer Experience: 54
crafting Experience: 0
firemaking Experience: 200
magic Experience: 21009
fletching Experience: 0
woodcutting Experience: 0
runecrafting Experience: 0
slayer Experience: 0
farming Experience: 0

My actual experiences are:


attack Experience: 48
hitpoints Experience: 5992
mining Experience: 22630
strength Experience: 616
agility Experience: 0
smithing Experience: 10192
defence Experience: 3083
herblore Experience: 0
fishing Experience: 180
ranged Experience: 20
thieving Experience: 0
cooking Experience: 180
prayer Experience: 54
crafting Experience: 0
firemaking Experience: 200
magic Experience: 21009
fletching Experience: 14041
woodcutting Experience: 37632
runecrafting Experience: 0
slayer Experience: 0
farming Experience: 0


I suspect in the case of mining and such it reads to far over. Maybe to get the correct distance to the start of the experience you could have it call up the bitmaps of the text for skills and have it count the width of each letter in the skill name plus the string ' XP: '.

Maybe have a separate function have a case statement for letters or something that has the width, or hell find a function that counts the bmp but I think the first would be better and easier.

Boreas
11-29-2006, 04:34 AM
It's not up to the minute. Doesn't matter tho because it only works if you are on the high score list.

TOB
11-29-2006, 04:40 AM
Ya the high scores are updated every time you log out and you have high enough experience to be on them.

Boreas
11-29-2006, 04:49 AM
begin
ActivateClient;
SetupSRL;
ClearDebug;
skillz[0] := 'attack';
skillz[1] := 'hitpoints';
skillz[2] := 'mining';
skillz[3] := 'strength';
skillz[4] := 'agility';
skillz[5] := 'smithing';
skillz[6] := 'defence';
skillz[7] := 'herblore';
skillz[8] := 'fishing';
skillz[9] := 'ranged';
skillz[10] := 'thieving';
skillz[11] := 'cooking';
skillz[12] := 'prayer';
skillz[13] := 'crafting';
skillz[14] := 'firemaking';
skillz[15] := 'magic';
skillz[16] := 'fletching';
skillz[17] := 'woodcutting';
skillz[18] := 'runecrafting';
skillz[19] := 'slayer';
skillz[20] := 'farming';

for i:= 0 to 20 do
begin
writeln(skillz[i] + ' Experience: ' + IntToStr(CurrentSkillXp2(skillz[i])));
end;
end.

Returns:



My actual experiences are:



I suspect in the case of mining and such it reads to far over. Maybe to get the correct distance to the start of the experience you could have it call up the bitmaps of the text for skills and have it count the width of each letter in the skill name plus the string ' XP: '.

Maybe have a separate function have a case statement for letters or something that has the width, or hell find a function that counts the bmp but I think the first would be better and easier.

Right now it finds dtms of P: and the right edge of the box, subtracts and divides to get the length, and uses the dtm of P: for where to start. Maybe this isn't working. I think the characters are all the same, I'll check though.

Everything is fine for me except woodcutting, I'll tackle that later. I will post another version to try to take of the ones that are missing the first digit. That may fix the ones that are giving 0 when they shouldn't, but I think that will be another problem. Thanks for posting your results. I need more people to do that because it works for me lol.


Edit: the bitmaps for the chars aren't the same width! I will try making a modified charset with uniform widths.

Edit: havent done the char thing yet, but changed the starting point in this attachment

Boreas
11-29-2006, 06:29 AM
K I didn't do anything with the charset. I adjusted the starting and ending points, and that fixed most of it except woodcutting. It turns out the dtm I used for P: was not as unique as I thought, and it got it somewhere in the middle of the 2 lines. So I made a new dtm, and now everything works perfectly (for me). Please test people.

I think I got it, so I'm going to bed. I'll check in the morning.

TOB
11-29-2006, 06:51 AM
Arg, not everything is working for me still. I know you're using a DTM but I was thinking maybe it messes up due to level of skill

This time I get:


attack Experience: 48
hitpoints Experience: 48
mining Experience: 2630
strength Experience: 616
agility Experience: 0
smithing Experience: 10192
defence Experience: 3083
herblore Experience: 0
fishing Experience: 0
ranged Experience: 20
thieving Experience: 0
cooking Experience: 180
prayer Experience: 54
crafting Experience: 0
firemaking Experience: 200
magic Experience: 21009
fletching Experience: 14041
woodcutting Experience: 37632
runecrafting Experience: 0
slayer Experience: 0
farming Experience: 0

Look at other post for the ones they should be.

Looks like only fishing, mining, and hitpoints are messed up still.

Boreas
11-29-2006, 06:57 AM
Gah. I just tried it on another acct with slayer, and it got 5000 0 as the string, and then runtime error with string to int. I'm working on that now. I'll take another crack at it tomorrow, but I'm about to give up.

Edit: ok now this works for me. It takes removes the ' 0' off the end in the slayer. I'm not sure what is giving us different results, but I'll take another shot tomorrow.

TOB
11-29-2006, 07:27 AM
Only one I seem to be having a problem with now is mining where it cuts off the first number of experience, but keep in mind I've only tested this out on one account.

Boreas
11-29-2006, 10:11 PM
I think I got the concept figured out. It just needs tweaking so that it works for everyone. I'm stumped on how to do that. I wonder how the devs are fixing it for 3.6.

TOB
11-29-2006, 11:24 PM
What if JageX went and made it randomly change a few pixels for every account...

Now thinking about it that would be easiest to ruin scripts, by doing small changes to different accounts...

Boreas
11-30-2006, 06:33 AM
Shhhhh!

TOB
11-30-2006, 07:51 AM
lol I knew that reaction was coming...

WT-Fakawi
11-30-2006, 10:46 PM
Wow. How could I have missed this thread. I have been thinking about this too, and Stupid3ooo's ChooseOption comes close to the ideal solution. It narrows down the search box. And allthough they look like popup's, they are actually fixed bitmaps at fixed position. Much unlike the uptext that randomly floats +-2 pixels.

Have you tried contacting masquerader? He's the FontMaster :)



THIS IS OLD STUPID's CHOOSEOPTION:



{************************************************* ******************************
function ChooseOption(x, y: Integer; txt: String): Boolean;
By: Stupid3ooo
Description: Finds Popup menu, then clicks on it.
************************************************** *****************************}

function ChooseOption(x, y: Integer; txt: string): Boolean;
var
x1, y1, x2, y2, LeftCorner, RightCorner: Integer;
begin
LeftCorner := BitmapFromString(4, 4, 'z78DA33753135313137C5' +
'411A600064715CEA914500CACE13F0');
RightCorner := BitmapFromString(4, 4, 'z78DA33753135313137' +
'C5200D30002E35F8C501C9C013F0');
if (FindBitmap(LeftCorner, x1, y1)) and (FindBitmap(RightCorner, x2, y2)) then
begin
if (FindText(x, y, txt, upchars, x1, y1, x2, 502)) then
begin
Result := True;
Mouse(x + Length(txt) * 3, y + 3, 2, 2, True);
end
else if (FindText(x, y, 'Cancel', upchars, x1, y1, x2, 502)) then
Mouse(x + 9, y + 3, 2, 2, True);
end;
FreeBitmap(LeftCorner);
FreeBitmap(RightCorner);
end;



Where do you retrieve your baseline from?
http://82.92.130.193/Pictures/XP.png

Maybe you should grab this semicolon bitmap:

http://82.92.130.193/Pictures/XP2.png

I think it is unique, but it is a hypothesis. Well, that is what I had in mind of doing but-what-I-havent-been-able-to-do-since-I-am-sooo pre-occupied, pfew.

Good work.


TOB? Why are you not a member around here? Please apply...or did you already?

Boreas
11-30-2006, 11:22 PM
I'll PM masquerader now, hopefully he can take this off my hands (I'm working on a lot of scripts atm lol).

I think the width's of '<Skill> XP' and 'Next Level at' and the widths of the numbers is messing up the way it finds the width between the dtms and divides. And I don't know how to go about solving that so that it works for every account.

I'll look into the chooseoption thing if a dev (or anyone with more time than me) doesn't fix it.

Baseline is above the P. I was using a dtm of the P and the semi colon, because dtm of semicolon obviously doesn't work (and a dtm of the right edge of the box). I didn't want to use bitmaps, but if masq doesn't have time to do it, I guess I'll try it.

TOB
11-30-2006, 11:38 PM
TOB? Why are you not a member around here? Please apply...or did you already?

Well, when SRL first came out I wasn't interested in SCAR and I just recently got back into forums. I haven't applied because I haven't made any scripts really with SRL, or in general. I didn't think I would be accepted so I chose not to apply until [if] I make a script using SRL.

masquerader
12-01-2006, 12:49 AM
haha, ok, i'll take a look at it

ps:
fawki, can you add FontMaster to my title?
lol

[edit]
here:

function skillxp(skill:string; current:boolean):integer;
//masquerader w/ others
var
textx,texty,x1, y1, x2, y2, LeftCorner, RightCorner: Integer;
text,xp:string;
t:tpoint;
begin
LeftCorner:= DTMFromString('78DA63346164603006622C0026CA684A841 A9' +
'03926449883A6E6FFFF0598E60411614E100173406A828970 3301' +
'3500C6560919');
RightCorner:= DTMFromString('78DA635CC2C8C0100CC458004C947131916 A8' +
'250D5FCFFBF0055CD124C3558CD3121600E488D3101739610 A9C6' +
'04BF1A00F7DF0C91');
result:=-1;
GameTab(2);
case lowercase(skill) of
'attack': t := SkillCoords(1, 1);
'hitpoints': t := SkillCoords(1, 2);
'mining': t := SkillCoords(1, 3);
'strength': t := SkillCoords(2, 1);
'agility': t := SkillCoords(2, 2);
'smithing': t := SkillCoords(2, 3);
'defence': t := SkillCoords(3, 1);
'herblore': t := SkillCoords(3, 2);
'fishing': t := SkillCoords(3, 3);
'ranged': t := SkillCoords(4, 1);
'thieving': t := SkillCoords(4, 2);
'cooking': t := SkillCoords(4, 3);
'prayer': t := SkillCoords(5, 1);
'crafting': t := SkillCoords(5, 2);
'firemaking': t := SkillCoords(5, 3);
'magic': t := SkillCoords(6, 1);
'fletching': t := SkillCoords(6, 2);
'woodcutting': t := SkillCoords(6, 3);
'runecrafting': t := SkillCoords(7, 1);
'slayer': t := SkillCoords(7, 2);
'farming': t := SkillCoords(7, 3);
else writeln('invalid skill');
end;
MMouse(t.x, t.y + 12, 5, 5);
repeat
wait(10);
until findcolor(x,y,10551295,554, 205, 743, 465);
if((FindDtm(LeftCorner,x1,y1,554, 205, 743, 465))and(FindDtm(RightCorner,x2,y2,554, 205, 743, 465))) then
begin
if(current)then
begin
text:=skill;
text[1]:=UpperCase(text[1])[1];
end else
text:='at'
if(istextinareaex(x1,y1,x2,y2,textx,texty,text, 0, smallchars,false,true, 0,2,0))then
begin
if(istextinareaex(textx,texty,textx+100,texty,text x,texty,':',0,smallchars,false,true,0,2,0))then
begin
xp:=trim(gettextatex(textx+6,texty,0,smallchars,fa lse,true,0,2,0,9,false,tr_digits))
result:=strtoint(xp);
end;
end;
end;
freedtm(leftcorner);
freedtm(rightcorner);
end;

m0u53m4t
12-01-2006, 06:21 PM
Works really well, but it seems to always trim off the last number, so 2595 appears as 259. Any idea why?

Boreas
12-01-2006, 06:38 PM
Yea same here. No title until you fix that lol.

I think its because the left side of the number changes with the length of the name of the skill, the right side changes with the number of digits in the number,and the distance to edge of the box changes with the length of Next level at and the number compared to the top line. All these together make it hard.