SRL Archive - Senior Scripts and Snippets

To Do List


Boreas

2007-09-14 23:49:29

Name Grabber:
First checks that mouse is above an item, either through cords of looking for uptext withdraw etc. Then gets uptext, and removes the "Withdraw 1" and "/ 5 options" etc, and returns just the name.

Special Ed

2007-09-15 00:42:35

Well I use something that I developed called GetTextAtEx In which you just specify the colors and it will get the uptext with those colors. I could probably whip something up pretty quick though.

function IsUpTextEx(Text: array of string; Color, Tolerance: Integer): Boolean;
var
ax, ay, i: Integer;
begin
for i:= 0 to GetArrayLength(Text) - 1 do
if(IsTextInAreaEx(7, 7, 334, 20, ax, ay, Text[i], Tolerance, Upchars, False, True, 0, 2, Color))then
begin
Result:= True;
Exit;
end;
end;

IsUpTextEx(ArrayofText, 3967970, 50)

This will look for the ArrayofText with the Orange Color of item names in uptext.

procedure GetItemName: string;
begin
Result:= GetTextAtEx(7, 7, 50, UpChars, False, True, 0, 2, 3967970, 50, False, tr_AllChars);
end.

This "should" return the Orange UpText of an Item, haven't tested it but it has the same parameters as IsUpTextEx, just returns the Text rather thank looking for specific text.

As for mousing and checking to see if the item is correct I'm sure a blind half retarded Dwarven midget with Dyslexia could do it.

nielsie95

2007-09-15 03:09:31


program New;
{.Include SRL/SRL.SCAR}

var
i, c, l, l1: Integer;
s: String;
AnswerArray: TStringArray;
UpTextArr: TStringArray;
begin
SetupSRL;
// Inventory
if (not LoggedIn) then Exit;
if (not BankScreen) then
GameTab(4);
UpTextArr := ['Use', 'Eat', 'Read', 'Store 1'];
l1 := Length(UpTextArr);
for i := 1 to 28 do
if ExistsItem(i) then
begin
MMouseItem(i);
Wait(100 + Random(100));
s := rs_GetUpText;
for c := 0 to l1 -1 do
if (Pos(UpTextArr[c], s) <> 0) and (Pos('/', s) <> 0) then
if (not InStrArr(Trim(Between(UpTextArr[c], '/', s)), AnswerArray, False)) then
begin
SetLength(AnswerArray, l +1);
AnswerArray[l] := Trim(Between(UpTextArr[c], '/', s));
Inc(l);
Break;
end;
end;
// Bank
if not BankScreen then Exit;
FixBank;
UpTextArr := ['Withdraw 1'];
l1 := Length(UpTextArr);
for i := 0 to 47 do
begin
MMouse(35 + (((i mod 8) +1) * 49), 27 + (((i div 8) +1) * 41), 1, 1);
Wait(100 +Random(100));
s := rs_GetUpText;
for c := 0 to l1 -1 do
if (Pos(UpTextArr[c], s) <> 0) and (Pos('/', s) <> 0) then
if (not InStrArr(Trim(Between(UpTextArr[c], '/', s)), AnswerArray, False)) then
begin
SetLength(AnswerArray, l +1);
AnswerArray[l] := Trim(Between(UpTextArr[c], '/', s));
Inc(l);
Break;
end;
end;
for i := 0 to l -1 do
WriteLn(AnswerArray[i]);
end.

Gets inv and bank names, no doubles. :)

Special Ed

2007-09-15 13:10:47

What do you mean by no doubles, or are you saying it just looks to see what items are in your inventory and if you have (for example) 5 Iron Ores, it would just say "Iron Ore" instead of "Iron Ore Iron Ore Iron Ore, ect"? Because that would make more sense. Also another thing you could do is find the DTM use CountDTM and then use your procedure so it would return something like

"Iron Ore - 5" or "Rune Longsword - 1"

That way you won't get doubled of the "names" of the item, but you will get it to return how many you have. Which could be used with Depositing functions like if you have 10 it would use Deposit 10, if you have 24 it would use deposit "X" 24, ect. Which makes it look for human.

P.S. This is what your trying to do is it not?

nielsie95

2007-09-15 13:13:53

I'm sorry, I ment No double names ;)
But I guess this is for b4 and not for depositing? So you don't need the amount of items..

Special Ed

2007-09-15 14:22:55

Ohh… ok I wasn't quite sure on what was going on, sorry.