View Full Version : First (Useless) Script - Just for feedback/help
Gishemon
11-03-2012, 11:02 PM
Hey all, Hope me posting this here isn't a problem.
Basically I started learning to script this morning and decided to have a go at an "easy" and useless script just to see if I could do it.
What it does(As I doubt people will want to run it):
Stands behind the axe shop in Lumbridge, puts the camera angle to highest, points the compass north, walks to a set position, picks up the knife when it spawns then returns to the set position. It repeats this until the inventory is full and then logs out.
Now it does do this however there is some issues:
- Sometimes walks to the wrong position(only by 1 square)
- Sometimes doesn't walk at all(when within 1 square of the correct position)
- Moves the mouse around constantly picking up on colors similar to that of the knife (making it a while before eventually picking up the knife)
On top of these if you could offer any general feedback it would be much appreciated.
Thanks for reading the wall of text :P
[XoL]
11-03-2012, 11:06 PM
Hey no problem posting here but next time use Simba Tags ""
I have to go right now but when I come back I will try to help!
[simba]
program new;
{$DEFINE SMART}
{$I SRL/SRL.simba}
{$I SPS/SPS.simba}
Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Active := True;
end;
Procedure AntiBan;
begin
if(not(LoggedIn))then
Exit;
case Random(8) of
0: begin
PickUpMouse;
end;
1: begin
KeyDown(40);
Wait(RandomRange(500, 1100));
KeyUp(40);
Wait(RandomRange(310, 865));
SetAngle(SRL_Angle_High);
end;
2..8: begin
Wait(RandomRange(500, 2000));
Exit;
end;
end;
end;
Procedure PickUp;
var x,y:Integer; myPath:TPoint;
begin
if (InvFull) then
begin
Logout;
Exit;
end
else
SetUpSRL;
SPS_Setup(RUNESCAPE_SURFACE,['11_9']);
myPath := Point(4734, 3852);
SPS_WalkToPos(myPath);
repeat
if FindObjCustom(x, y,['nife'],[7434614,7040368],2) then
begin
Mouse(x, y, 0, 0, false);
ChooseOption('ake');
wait(5000+Random(2000));
SPS_WalkToPos(myPath);
wait(39000+Random(2000));
AntiBan;
end;
until(InvFull);
end;
begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
MakeCompass('N');
SetAngle(SRL_Angle_High);
PickUp;
end.
It is his script^
Swifte
11-03-2012, 11:13 PM
Good luck with the future of your scripting life! May you get SRL Membership in the course of the time you spend on this forum :)
Rezozo
11-03-2012, 11:16 PM
if FindObjCustom(x, y,'nife',7434614,7040368,2) then // just looks so much better
begin
Case Random(2) of
0:Begin
Mouse(x, y, 1, 2, false); //best to keep some randomization, don't want to click the same pixel 5k times :)
ChooseOption('ake');
End;
1: Begin
Mouse(x, y, 1, 2, true);
End;
End;
wait(5000+Random(2000));
SPS_WalkToPos(myPath);
wait(39000+Random(2000));
AntiBan;
end;
until(InvFull);
end;
Sorry, all I could do on my crappy mobile :P
Gishemon
11-04-2012, 08:43 AM
;1122526']Hey no problem posting here but next time use Simba Tags "[simba]"
Will do from now on, cheers :)
Sorry, all I could do on my crappy mobile :P
Thanks man, I'll update my script with the extra mouse click :)
Just woke up so going to take a look at some more tutorials, looking forward to more feedback :)
Roflme
11-04-2012, 07:29 PM
Enjoy the wall of text.
- Sometimes walks to the wrong position(only by 1 square)
- Sometimes doesn't walk at all(when within 1 square of the correct position)
- Moves the mouse around constantly picking up on colors similar to that of the knife (making it a while before eventually picking up the knife)
First two are due to SPS. It'll click on the position with some randomization to prevent the same exact spot from being clicked (that'd look bot-like). So if it's within a close enough range it won't move, and if it's not it'll move to a spot within a range of that spot.
As for the third one, check out the tutorial section for some TPA functions :p
Look at AutoColor Aid to find the colors of the knife. Read up on it. I love AutoColor Aid :p
It'll basically find the best color on the screen to use. Instead of resulting in a true or false, the function results an integer of the color to use. So instead of inputting a color like:
FindObjCustom(x, y,'nife',[7434614,7040368],2)
You'd use:
FindObjCustom(x, y,'nife', KnifeColor,2)
And have a KnifeColor function that'd look like this:
function OreColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.01, 2.27);
FindColorsSpiralTolerance(MSCX, MSCY, arP, 6730204, MSX1, MSY1, MSX2, MSY2, 11);
if (Length(arP) = 0) then
begin
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
Result := arC[i];
Break;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
Exit;
end;
With some changes of course!! This is what I use to find the color of a clay ore :p
And with that color, you can input it in the following function:
function GoFindObj(Color, Tol: Integer; ObjText: string): Boolean;
var
CTS, I, N: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.7, 0.2);
For N := 0 to 1 do
if not FindColorsSpiralTolerance(MSCX, MSCY, TPA, Color, MSX1, MSY1, MSX2, MSY2, Tol) then
Exit;
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(TPA, 2, 5);
SortATPASize(ATPA, false); // IMPORTANT
For I := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 0, 0);
Wait(50+random(10));
If IsUpText(ObjText) then
begin
Result := True
Writeln('Found Object');
Break;
end;
end;
end;
This function takes groups of colors (at various points) and separate them into different areas of 2 width and 5 height. Then SortATPASize will sort the colors from smallest to biggest (because BigFirst is false). From the smallest to the biggest it'll move to the color, and if it finds the text it'll pick it up.
GoFindObj(KnifeColor, 3, 'nife');
Read up on tutorials for TPAs and AutoColor Aid! :D
Gishemon
11-04-2012, 11:47 PM
Roflme you're a superstar, amazing help thanks :)
Edit: I think I gave you +rep, not sure if it worked :P
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.