SRL Archive - SRL Suggestions

Taking function requests!


lordsaturn

2008-10-21 11:51:23

Anyone have any?

Naum

2008-10-21 11:54:17

Well okay, now I need something that will find a high concentration of rocks in an area 50*50 in the minimap, whilst it also can see if the players in that square exceed a certain number also it can check if its not in that area already. Should be easy with TPA's see how it goes ;)

lordsaturn

2008-10-29 22:11:20

From: NaumanAkhlaQ
Well okay, now I need something that will find a high concentration of rocks in an area 50*50 in the minimap, whilst it also can see if the players in that square exceed a certain number also it can check if its not in that area already. Should be easy with TPA's see how it goes ;)


This should work pretty well.

function getRocks(Rocks, Players: integer): TPointArray;
var
Col, CTS, i, Hi, L: integer;
P: TPointArray;
aP: T2DPointArray;
B: TBox;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(1);
Col := FindStoneColor;
if Col = 0 then Exit;
FindColorsTolerance(P, Col, MMX1, MMY1, MMX2, MMY2, 10);
aP := SplitTPA(P, 5);
Hi := High(aP);
for i := 0 to Hi do
begin
B := GetTPABounds(aP[i]);
if Distance(B.x1, B.y1, B.x2, B.y2)/5 >= Rocks then
begin
if (PlayersOnMap(B.x1-5, B.y1-5, B.x2+5, B.y2+5) >= Players) or
(PointInBox(Point(MMCX, MMCY), PointToBox(Point(B.x1-5, B.y1-5), Point(B.x2+5, B.y2+5)))) then Continue;
L := Length(Result);
SetLength(Result, L+1);
Result[L] := MiddleTPA(aP[i]);
end;
end;
ColorToleranceSpeed(CTS);
end;;
Rocks being the number of rocks required to be added into the result tpa, and Players being the number of players in the area required to filter the point out.

If it doesn't exactly fit your needs you could easily edit it a tiny bit, or if it doesn't work exactly right just increase the sensitivity (box size, formula, etc).



Anyone else?

TheChineseMan

2008-10-29 22:46:44

when im fishing and then the fishing spot moves i need something to find if i am actually still fishing or not could do it now but lazy :) so yea thx

lordsaturn

2008-10-29 22:58:48

From: thechineseman
when im fishing and then the fishing spot moves i need something to find if i am actually still fishing or not could do it now but lazy :) so yea thx



function Fishing(Equip: string): Boolean;
var
x, y, Col, CTS: integer;
P: TPointArray;
begin
FindFishingSpot(x, y);
case Lowercase(Equip) of
'net': Col := 1780531;
'rod': Col := 7208;
'harpoon': Col := 872813;
'cage': Col := 7365986;
end;
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsSpiralTolerance(x, y, P, Col, x-20, y-20, x+20, y+20, 20);
ColorToleranceSpeed(CTS);
Result := Length(P) > 15;
end;

Once again, edit to fit your needs. If you were to use this in a script it would probably be best to make the colors global, so not declare them repeatedly.


Anyone else?

Naum

2008-10-30 07:02:20

Make it get the amount of damage it is inflicting per turn on a moster.
Hint : Try a FindText then check it isn't that player by checking the uptext.

NiCbaZ

2008-10-31 02:25:25

Make a function , in the mining guild counts how many rocks there are, how many players there are, and cheak to see if no players are near the rocks , if theres a play near one rock it finds move onto the next rock point in the Array and so until it finds a rock with no one near it, Sound kinda hard but if you trhink about it its easy.

lordsaturn

2008-11-01 00:12:19

From: NiCbaZ
Make a function , in the mining guild counts how many rocks there are, how many players there are, and cheak to see if no players are near the rocks , if theres a play near one rock it finds move onto the next rock point in the Array and so until it finds a rock with no one near it, Sound kinda hard but if you trhink about it its easy.



function FindLoneRock: TPointArray;
var
Col, i, Hi, L: integer;
P, Ps: TPointArray;
aP: T2DPointArray;
M: TPoint;
begin
Col := FindRockColor;
if Col = 0 then Exit;
FindColorsTolerance(P, Col, MMX1, MMY1, MMX2, MMY2, 20);
aP := SplitTPA(P, 1);
Hi := High(aP);
for i := 0 to Hi do
begin
M := MiddleTPA(aP[i]);
FindColorsTolerance(Ps, 16711422, M.x-6, M.y-4, M.x+4, M.y+8, 19);
if Length(Ps)>3 then Continue;
L := Length(Result);
SetLength(Result, L+1);
Result[L] := M;
end;
end;

Will result a TPointArray containing one point for every rock in the guild with no one next to it.


From: NaumanAkhlaQ
Make it get the amount of damage it is inflicting per turn on a moster.
Hint : Try a FindText then check it isn't that player by checking the uptext.


This function could be iffy, because you can have more than one character on a tile taking damage. The only way to almost have a 100% success rate is to use reflection, is that alright with you?

mormonman

2008-11-01 01:41:01

[offtopic]… you should update ur tut runner so it works for island…[/offtopic]
can you make one that finds an npc with tpa(so all i have to insert is colors) and then trades with it…

Naum

2008-11-01 06:51:57

Nop not reflection.. Now that would be too easy :p. Its only 10 pixel in a square where the damage is displayed.

Sandstorm

2008-11-01 11:50:48

A monster finder, TPA preferably, doesn't need tolerance on uptext. I can provide colors.

n3ss3s

2008-11-01 13:08:29

God fuck, monster finder isn't any different from an object finder, just use FindObjTPA because in most cases it's anyway better than a custom finder…

lordsaturn

2008-11-02 11:24:38

From: NaumanAkhlaQ
Nop not reflection.. Now that would be too easy :p. Its only 10 pixel in a square where the damage is displayed.


I understand that, but what I'm saying is that you can have another player taking damage on the same tile as you, and that could cause a lot of problems.


From: mormonman
[offtopic]… you should update ur tut runner so it works for island…[/offtopic]
can you make one that finds an npc with tpa(so all i have to insert is colors) and then trades with it…


You could do that with something like..

begin
FindObjTPA(whatever);
Mouse(x, y, 0, 0, False);
ChooseOption('rade');
end;




From: Sand Storm
A monster finder, TPA preferably, doesn't need tolerance on uptext. I can provide colors.


:p What n3s said.

mormonman

2008-11-02 22:28:10

umm ok i am fixing a tut runner and i need a custom logon function… cuz when you first log on on a new character it does not display the little "Click Here to Play" screen (that tells ip address of last place you logged on). so i need it to just jump from login to the script…( i tried it on my own and i failed…)

Rich

2008-11-09 12:56:02

How about a PvP Login command? I've noticed that PvP worlds would be great for autoing, but for scripts that start logged out/rest, it doesn't work because of the PvP screen.

Bebe

2008-11-09 14:16:55

Make me a function that will kill Wizzup? For he likes men.

Heysus

2008-11-12 05:39:21

A FindOption function would be nice :p

for example you could use it like

if FindOption(Amount) then
begin
ChooseOption(Amount);
end else
begin
ChooseOption('X');
TypeSend(Amount);
end;

Sandstorm

2008-11-12 08:54:29

Can't you just do this Heysus?

f Not ChooseOption(Amount) Then
Begin
ChooseOption('X');
TypeSend(Amount)
End;

Heysus

2008-11-16 13:38:36

From: Sand Storm
Can't you just do this Heysus?

f Not ChooseOption(Amount) Then
Begin
ChooseOption('X');
TypeSend(Amount)
End;


That won't work. If ChooseOption doesn't find the text then it moves the mouse to make the menu disappear.

lordsaturn

2008-11-17 00:03:48

From: mormonman
umm ok i am fixing a tut runner and i need a custom logon function… cuz when you first log on on a new character it does not display the little "Click Here to Play" screen (that tells ip address of last place you logged on). so i need it to just jump from login to the script…( i tried it on my own and i failed…)

From: R1ch4
How about a PvP Login command? I've noticed that PvP worlds would be great for autoing, but for scripts that start logged out/rest, it doesn't work because of the PvP screen.


This will work in all situations. (tut, pvp, regular)

procedure LoginPlayer;
var
Mark, Attempts: Integer;
Actions: TVariantArray;
RetryLogin: Boolean;
label
ProcStart;
begin
ActivateClient;
Wait(100);

if (GetColor(212, 327) = 238301) then //At Click To Play screen
begin
Wait(1000 + Random(3000));
MouseBox(227, 337, 555, 364, 1);
MarkTime(Mark);
while (TimeFromMark(Mark) < 30000) and (not(LoggedIn)) do
Wait(1000 + Random(1000));
end;
if (not(RSReady)) then
begin
MarkTime(Mark);
while (not(RSReady)) do
begin
Wait(100);
if (TimeFromMark(Mark) > 180000) then
begin
WriteLn('It has been 3 minutes and Runescape is not yet ready... Terminating.');
TerminateScript;
end;
end;
WriteLn('Welcome to Runescape.');
end;

LoginScreenMusic(True);
if (not(GraphicsSet)) then
begin
SetAutoingDefaults;
GraphicsSet := True;
end;
ProcStart:

if (not(LoggedIn)) then
begin
if (not(Players[CurrentPlayer].Active)) then
begin
WriteLn('Player is not Active...');
NextPlayer(False);
Exit;
end;
Wait(900 + random(60));

//Click 'Log In' on main menu
while (GetColor(343, 174) <> 7750) do
begin
MouseBox(360, 180, 400, 185, 1);
Wait(100 + Random(100));
end;

//Type Username
Mouse(315, 272, 10, 5, True);
while (CountColor(7750, 311, 269, 452, 284) > 13) do
begin
KeyDown(vk_Back);
Wait(10 + Random(10));
KeyUp(vk_Back);
Wait(50 + Random(50));
end;
for Mark := 0 to 3 do
begin
KeyDown(vk_Back);
Wait(10 + Random(10));
KeyUp(vk_Back);
Wait(50 + Random(50));
end;
Wait(100 + Random(200));
WriteLn(Capitalize(Players[CurrentPlayer].Name));
TypeSend(Players[CurrentPlayer].Name);
Wait(100+random(50));

//Type Password
Mouse(315, 334, 10, 5, True);
while (CountColor(7750, 311, 337, 452, 352) > 13) do
begin
KeyDown(vk_Back);
Wait(10 + Random(10));
KeyUp(vk_Back);
Wait(50 + Random(50));
end;
for Mark := 0 to 3 do
begin
KeyDown(vk_Back);
Wait(10 + Random(10));
KeyUp(vk_Back);
Wait(50 + Random(50));
end;
Wait(100 + Random(200));
TypeSend(Players[CurrentPlayer].Pass);
Wait(500 + Random(300));

if (not(FindTextTPA(12509695, 0, 288, 205, 475, 247, 'login', StatChars, Nothing))) then //If 'enter' from typesend didn't log us in
begin
if GetColor(312, 231) = 197552 then
MouseBox(382, 414, 533, 425, 1)
else
MouseBox(355, 359, 403, 372, 1); //Click 'login' login screen
Wait(250 + random(100));
end;

MarkTime(Mark);
repeat
SetLength(Actions, 0);

if (TimeFromMark(Mark) > 60000) then
Actions := ['One minute has passed...', 0, 2, 'NextPlayer', 'Login Failed']
else
case (CountColor(12509695, 288, 205, 475, 247)) of //Number of text colour points
// Actions := ['WriteLn Text', TimeToWait, NumberOfRetries, 'FinalAction', 'PlayerStatus'];
760: Actions := ['Too many incorrect logins.', 5 * 60000, 2, 'NextPlayer', ''];
536: Actions := ['Login limit exceeded. Please wait 1 minute and try again.', 60000, 2, 'NextPlayer', ''];
711: Actions := ['Your account has been disabled', 0, 0, 'NextPlayer', 'Acc Disabled'];
598: Actions := ['Invalid Username \ Password', 0, 2, 'NextPlayer', 'Wrong User/Pass'];
917: Actions := ['Not a Members Account', 0, 0, 'NextPlayer', 'Non-member'];
408: Actions := ['World is full.', 5000, 20, 'Terminate', ''];
623: Actions := ['Your account is already logged in', 5000, 0, 'RandomNextPlayer', ''];
555: Actions := ['The Server is being updated.', 60000, 4, 'Terminate', 'Server Updating'];
218: Actions := ['Error Connecting.', 20000, 9, 'Terminate', 'Error Connecting'];
335: Actions := ['Unable to connect Login Server offline.',(20000) + Random(6000), 4, 'Terminate', 'Login Server Offline'];
512: Actions := ['RuneScape has been updated. Script Terminated.', 0, 0, 'Terminate', 'RS Updated'];
489: Actions := ['Connection timed out.', 0, 4, 'Terminate', 'Connection Timed Out'];
737: Actions := ['You are standing in a members-only area.', 0, 0, 'NextPlayer', 'In Mems-Only Area'];
//10: Actions := ['Error loading your profile.', 5000, 10, 'NextPlayer', 'Profile Loading Failed']; // Error loading your profile. Will attempt to re-login 5 more times.)
//11: Actions := ['Login server rejected session.', 1000, 10, 'NextPlayer', 'Login Serv. Rejected']; // Login server rejected session.
end;

if (Length(Actions) > 0) then
begin
WriteLn(Actions[0]);
Wait(Actions[1] + Random(100));
if (Actions[2] <> 0) then
if (Attempts < Actions[2]) or (Actions[2] = -1) then
begin
RetryLogin := True;
Break;
end;
if (Actions[4] <> '') then
Players[CurrentPlayer].Loc := Actions[4];
case Actions[3] of
'NextPlayer': NextPlayer(False);
'RandomNextPlayer': RandomNextPlayer(True);
'Terminate': TerminateScript;
end;
Exit;
end;
Wait(100);
until(GetColor(212, 327) = 238301) or LoggedIn;

if (RetryLogin) then
begin
RetryLogin := False;
Inc(Attempts);
goto ProcStart;
end;

if (GetColor(212, 327) = 238301) then
begin
Wait(1000 + Random(2000));
MouseBox(227, 337, 555, 364, 1);
end;
MarkTime(Mark);
while (TimeFromMark(Mark) < 30000) and (not(LoggedIn)) do
Wait(1000 + Random(1000));
end;

if (LoggedIn) then
begin
PlayerStartTime := (GetSystemTime div 1000); // PlayerStartTime
if Length(Players[CurrentPlayer].NickTPA) < 2 then
begin;
Writeln('Creating the NickTPA.');
if Players[CurrentPlayer].Nick <> '' then
Players[CurrentPlayer].NickTPA := CreateTPAFromText(Players[CurrentPlayer].Nick, UpChars)
else
begin;
Writeln('Nickname isn''t set, taking the username instead..');
Players[CurrentPlayer].NickTPA := CreateTPAFromText(Players[CurrentPlayer].Name, UpChars);
end;
end;
AddToSRLLog('Current player: ' + Capitalize(Players[CurrentPlayer].Name));
end;
end;

All i did was add an or LoggedIn in the 'Click Here to Play' check and added a check for the red pvp text after the line

if (not(FindTextTPA(12509695, 0, 288, 205, 475, 247, 'login', StatChars, Nothing))) then

From: Bebe
Make me a function that will kill Wizzup? For he likes men.



begin
OpenWebPage('http://www.4chan.org/');
end.

:p

From: Heysus
A FindOption function would be nice :p

for example you could use it like

if FindOption(Amount) then
begin
ChooseOption(Amount);
end else
begin
ChooseOption('X');
TypeSend(Amount);
end;



function FindOption(var x, y: integer; Option: string): Boolean;
var
B: TBox;
TPA: TPointArray;
fx, fy, I, C: Integer;
P: TPoint;

begin
Result := False;
GetClientDimensions(B.X2, B.Y2);
B.X1 := 0;
B.Y1 := 0;
FindColorsTolerance(TPA, 4674653, B.X1, B.Y1, B.X2, B.Y2, 0);
If Length(TPA) < 10 Then
Exit;
B.X2 := 0;
B.Y2 := 0;

P := TPA[0];
For I := 0 To High(TPA) - 1 Do
If TPA[i].X = TPA[I+1].X - 1 Then
Begin
If C > 5 Then
Begin
B.X1 := P.X;
B.Y1 := P.Y;
Break;
End Else
C := C + 1;
End
Else
Begin
P := TPA[I + 1];
C := 0;
End;
If I = Length(TPA) Then
Begin
WriteLn('Choose Option Menu Getting Failed');
Exit;
End;
InvertTPA(TPA);
C := 0;
P := TPA[0];
For I := 0 To High(TPA) - 1 Do
If TPA[i].X = TPA[I+1].X + 1 Then
Begin
If C > 5 Then
Begin
B.X2 := P.X;
B.Y2 := P.Y;
Break;
End Else
C := C + 1;
End Else
Begin
P := TPA[I + 1];
C := 0;
End;
If I = Length(TPA) Then
Begin
WriteLn('Choose Option Menu Getting Failed');
Exit;
End;

If FindText(fx, fy, Option, upchars, B.X1, B.Y1, B.X2, B.Y2) Then
Begin
Result := True;
x := B.X1 + 5;
y := fy + 1;
End;
end;
This was easy…all i did was change the last bit.

Heysus

2008-11-17 02:47:57

From: lordsaturn


function FindOption(var x, y: integer; Option: string): Boolean;
var
B: TBox;
TPA: TPointArray;
fx, fy, I, C: Integer;
P: TPoint;

begin
Result := False;
GetClientDimensions(B.X2, B.Y2);
B.X1 := 0;
B.Y1 := 0;
FindColorsTolerance(TPA, 4674653, B.X1, B.Y1, B.X2, B.Y2, 0);
If Length(TPA) < 10 Then
Exit;
B.X2 := 0;
B.Y2 := 0;

P := TPA[0];
For I := 0 To High(TPA) - 1 Do
If TPA[i].X = TPA[I+1].X - 1 Then
Begin
If C > 5 Then
Begin
B.X1 := P.X;
B.Y1 := P.Y;
Break;
End Else
C := C + 1;
End
Else
Begin
P := TPA[I + 1];
C := 0;
End;
If I = Length(TPA) Then
Begin
WriteLn('Choose Option Menu Getting Failed');
Exit;
End;
InvertTPA(TPA);
C := 0;
P := TPA[0];
For I := 0 To High(TPA) - 1 Do
If TPA[i].X = TPA[I+1].X + 1 Then
Begin
If C > 5 Then
Begin
B.X2 := P.X;
B.Y2 := P.Y;
Break;
End Else
C := C + 1;
End Else
Begin
P := TPA[I + 1];
C := 0;
End;
If I = Length(TPA) Then
Begin
WriteLn('Choose Option Menu Getting Failed');
Exit;
End;

If FindText(fx, fy, Text[i], upchars, B.X1, B.Y1, B.X2, B.Y2) Then
Begin
Result := True;
x := B.X1 + 5;
y := fy + 1;
End;
end;
This was easy…all i did was change the last bit.


Thanks :D

Rich

2008-11-17 12:45:13

Woo! Thanks Saturn…You're churning functions out!

lordsaturn

2008-11-20 15:46:43

From: Heysus
Thanks :D


Er, that one's messed up a tiny bit.
Just change Text to Option.

And i've edited my last post, if you'd like to just recopy the function.

Kasi

2008-11-20 16:14:17

can you make me a reflection monster finder and item finder i cant seem to make them work…

lordsaturn

2008-11-22 23:25:40

From: pur3b100d
can you make me a reflection monster finder and item finder i cant seem to make them work…


That's a little bit too simple..
Try reading this tutorial:
http://www.villavu.com/forum/showthread.php?t=36454

It should explain everything you need to know.

marpis

2008-11-26 06:07:11

Repair ArrowCount, it doesnt work. I had 1336 arrows and it returned 336

lordsaturn

2008-11-28 23:01:10

From: marpis
Repair ArrowCount, it doesnt work. I had 1336 arrows and it returned 336


Are you talking about the ArrowAmount function in Ranging.scar?

006786

2008-11-29 22:34:57

setInterval

Make a procedure be called every X seconds.

lordsaturn

2008-11-29 22:38:21

From: 006786
setInterval

Make a procedure be called every X seconds.


That already exists :p


procedure HelloWorld(Seconds: integer);
begin
Writeln('Hello World');
SetTimeout(Seconds, 'HelloWorld');
end;

begin
HelloWorld(3);
repeat
wait(1);
until false;
end.

marpis

2008-11-30 13:45:52

From: lordsaturn
Are you talking about the ArrowAmount function in Ranging.scar?


indeed

lordsaturn

2008-11-30 23:09:13

From: marpis
indeed

All you need to do is change the x pixel a tiny bit.

function ArrowAmount: Integer;
begin
GameTab(5);
Result := GetAmount(666, 249);
end;

chitin

2008-12-25 16:39:06

WOW someones a genius…no request i came to clarify/ask:

so functions are like scar commands such as movemouse (perse) but its like a lot of stuff inside?…so its like a procedure thingy (but its called a function) and it goes in a procedure as a single commnad?

also came to look how you did them cuz i need to know for personal use..

lordsaturn

2008-12-26 00:59:55

From: chitin
WOW someones a genius…no request i came to clarify/ask:

so functions are like scar commands such as movemouse (perse) but its like a lot of stuff inside?…so its like a procedure thingy (but its called a function) and it goes in a procedure as a single commnad?

also came to look how you did them cuz i need to know for personal use..


Functions and procedures are used to execute a series of commands. The only difference between the two is that functions will return a value, and procedures will not.

chitin

2008-12-26 01:45:19

From: lordsaturn
Functions and procedures are used to execute a series of commands. The only difference between the two is that functions will return a value, and procedures will not.


..riiiiight…..example?

marpis

2008-12-26 06:44:10

From: chitin
..riiiiight…..example?

This is a procedure. It just moves the mouse around. nothing else.

procedure Movemouserandomly;
begin
repeat
MMouse(0, 0, MSX2, MSY2);
until(false);
end;

This is a function. It returns a value, boolean (true or false) in this case. It could be integer or extended or string or…

function IamGenius : boolean;
begin
if (IQ > 120) then
begin
result := true;
end;
end;


//functions can be used like this

procedure TellTheWorld;
begin
if IamGenius then
begin
writeln('I AM A GENIUS!!!');
end;
end;

lordsaturn

2009-02-01 00:44:25

Still doing this, if anyone has any.