SRL Archive - First Scripts

help me with this script so i dont get banned again


RSPS Scripter

2019-03-12 11:21:47

Dear Villavu Members,


So the thing when i use this script for 3 hours with anitban + breaks i still get banned.

my goal is not getting banned while using this script.

What does this script, this script will pick Wheat near the Grand Echange and will bank it at Varrock West bank.

it collected 3k wheat in almost 4 hours and the day after it unfortunaly got banned. :fiery:

Edit: Fergoth to say the script did got stuck after drawing a rectangle on the gate it also draws a litle rectangle on the top left corner and the mouse move's always to the top left corner

but when i re-start the script evrything goes back to normal that problem is very rare that it will happen maybe that cuased the ban?




now in pice's after logging in and starting the script.

Step - 1 = it opens the inventory tab.

Step - 2 = if the inventory is empty then it will walk to the Wheat Field.

Step - 3 = after walking to the wheat field it will Checks the Gate if it is open or closed.

Step - 5 = if the Gate is Closed it will open it then Starts picking up the wheat until the inventory is full

Step - 6 = if the Gate is already open it will then start picking up the wheat until the inventory is full

Step - 7 = if the inventory is full it will walk outside the wheat field then checks for the Gate if its open or not.

Step - 8 = if the gate is already open then it will go bank and repeat the procces.

Step - 9 = if the gate is closed it will open it and then it will go bank and repeat the procces.

anyways you can find the latest script in this Attechment [ATTACH]28631[/ATTACH]

and alos here

Edit 2: Edited the script for better Format.

program Wheat_Farm_V2;
{$DEFINE SMART}
{$I SRL/OSR.simba}
{$I RSWalker/Walker.simba}
{$H-}{$R+}{$X+}
{==============================================================================]
| Wheat Farm V2
|
| Steps to use:
| 1. For longer runs you need to declare login details bellow
| 2. Start the script at the entrance Grand Echange, and run setup.
[==============================================================================}
const
LOGIN_NAME = ''; //Username/Email
LOGIN_PASS = ''; //Password
RS_WORLD = -1; //Desired World (-1 = Random)
IS_MEMBER = false; //True if your player is a Member

var
Walker: TRSWalker; // Used for RSWalker (to walk paths)
Antiban: TAntiban; // Used for Antiban procedures
Outside_Gate_path, Supplies_Path, Bank_Path: TPointArray; // Paths from field to bank, and bank to field

procedure declarePlayers();
begin
with Players.New()^ do
begin
LoginName := LOGIN_NAME;
Password := LOGIN_PASS;
IsActive := True;
IsMember := IS_MEMBER;
World := RS_WORLD;
end;
Players.SetCurrent(0);
end;

procedure Progress();
begin
ClearDebug();
WriteLn('+----------------------------------------------------');
WriteLn('+- -');
WriteLn('+- -');
WriteLn('|- Script Runtime : ', SRL.MsToTime(GetTimeRunning, Time_Short));
WriteLn('+- -');
WriteLn('+- -');
WriteLn('+----------------------------------------------------');
end;

procedure setupAntiban();
begin
Antiban.Init(SKILL_TOTAL, 4);

Antiban.Init(SKILL_MINING);
Antiban.AddTask([@Antiban.LoseFocus, ONE_MINUTE*7, 0.15]);
Antiban.AddTask([@Antiban.HoverPlayers, ONE_MINUTE*9, 0.15]);
Antiban.AddTask([@Antiban.CheckSkill, ONE_MINUTE*13, 0.15]);
Antiban.AddTask([@Antiban.CheckStats, ONE_MINUTE*18, 0.15]);
Antiban.AddTask([@Antiban.OpenRandomTab, ONE_MINUTE*20, 0.15]);
Antiban.AddTask([@Antiban.RandomCompass, ONE_MINUTE*40, 0.15]);
Antiban.AddTask([@Antiban.DoMiscStuff, ONE_MINUTE*45, 0.15]);
Antiban.AddTask([@Antiban.VeryShortBreak,ONE_MINUTE*50, 0.15]);

Antiban.AddBreak([1.0 * ONE_HOUR, 05 * ONE_MINUTE, 0.33, 0.25]);
Antiban.AddBreak([3.5 * ONE_HOUR, 40 * ONE_MINUTE, 0.85, 0.15]);
Antiban.AddBreak([17 * ONE_HOUR, 07 * ONE_HOUR, 0.95, 0.10]);
end;

Procedure myAntiban;
begin
if not SRL.isLoggedIn() then
Exit;

SRL.DismissRandom(); //Dismiss random events if any are found
Antiban.DoAntiban(); //Do the antiban
end;

procedure walkTo(path: TPointArray);
begin
myAntiban(); //Do Antiban
Walker.WalkPath(path); //Walk our path passed to the procedure
end;

type
TMSObject = record
WorldLoc: TPointArray; //loctions on the world map
Color: TCTS2Color; //must have color
MinCount: Int32; //size of TPA
SplitDist: Int32;
end;

function TMSObject.Find(DoSort: Boolean=True; Expand:Int32=0): TRectArray;
var
loc, me: TPoint;
rect: TRectangle;
locations, TPA: TPointArray;
ATPA: T2DPointArray;
begin
me := Walker.GetMyPos();
locations := Copy(Self.WorldLoc);
if DoSort then Locations.Sorted(me);

for loc in Locations do
begin
rect := Walker.GetTileMSEx(me, loc, 1).Expand(Expand);
if MainScreen.GetBounds.Contains(rect.Bounds) then
begin
if (srl.FindColors(TPA, Color, rect.Bounds) < Self.MinCount) then
Continue;

if (Self.SplitDist > 0) then
begin
TPA := rect.Filter(TPA);
ATPA := TPA.Cluster(Self.SplitDist);
ATPA.SortByMiddle(rect.Mean);
Result += ATPA[0].MinAreaRect;
end else
Result += rect.Expand(-Expand);
end;
end;
end;

procedure waitLoop();
var
InvCount: Integer;
T: TTimeMarker;
begin
if not SRL.isLoggedIn() then
Exit;

InvCount := Inventory.Count(); //Gets the count in our inventory
T.Start; //Start our timer
repeat
myAntiban(); //Do Antiban
wait(randomRange(75, 250)); //Wait a random amount of time
until((Inventory.Count() > InvCount) or (T.GetTime > 7000)); //Stop repeating once inv count changes or we time out
end;

function Deposite_Supplies(): boolean;
begin
myAntiban(); //Do antiban
BankScreen.Open(blVarrockWest); //Open bank using SRL's built in banker function
if BankScreen.IsOpen(5000) then //If bank screen is open sometime within the 5 sec wait
begin
wait(randomRange(150, 500)); //Have a realistic wait time before we actually do anything
BankScreen.DepositAll(); //Deposit all cabbages
Result := True; //We want to return true when the function finishes, so we set Result to True
end;
end;

function Walk_to_Bank(): Boolean;
begin
myAntiban();
smart.Image.Clear();
walkTo(Bank_Path); // Walks to the Bank
wait(randomRange(2125, 3355)); // Have a realistic wait time before we actually do anything
Deposite_Supplies(); // Banks the Wheat
Result := True;
end;

function Check_Gate(): boolean;
var
i : Int32;
obj : TMSObject;
rectangles: array of TRectangle;
tpa : TPointArray;
atpa : T2DPointArray;
Pnts : TPointArray;
Pnt : Tpoint;
begin
myAntiban();
// Gate Location open and closed
// Tile 1 Tile 2 Tile 3 Tile 4 Tile 5 Tile 6 color of Gate, min points, splitDist.
obj := [[[4373, 2619],[4373, 2616],[4378, 2613],[4373, 2619],[4373, 2616],[4378, 2613]], CTS2(4945285, 7, 0.07, 0.10), 200, 8];
rectangles := obj.Find(True, 50);
if Length(Rectangles) = 0 then
begin
wait(RandomRange(75, 250));
walkTo(Outside_Gate_path);
Minimap.SetCompassAngle(RandomRange(150, 0), False);
Check_Gate();
end;
for i:=0 to High(rectangles) do
smart.Image.DrawTPA(rectangles[i].ToTPA.Connect, $00FFFF);
wait(RandomRange(75, 250));
begin
wait(RandomRange(75, 250));
if Length(Rectangles) = 0 then Exit;
mouse.Move(rectangles[0].Bounds);
wait(RandomRange(75, 250));
end;
if MainScreen.IsUpText(['Op', 'en']) then
begin
mouse.Click(mouse_Left);
wait(RandomRange(75, 250));
smart.Image.Clear();
wait(RandomRange(75, 250));
smart.Image.Clear();
Walk_to_Bank();
end;
if MainScreen.IsUpText(['Clo', 'se']) then
begin
wait(RandomRange(75, 250));
Walk_to_Bank();
smart.Image.Clear();
end;
end;

function Open_Gate_2(): boolean;
var
i : Int32;
obj : TMSObject;
rectangles: array of TRectangle;
tpa : TPointArray;
atpa : T2DPointArray;
Pnts : TPointArray;
Pnt : Tpoint;
begin // Gate Location open and closed
// Tile 1 Tile 2 Tile 3 Tile 4 Tile 5 Tile 6 color of Gate, min points, splitDist.
obj := [[[4373, 2619],[4373, 2616],[4378, 2613],[4373, 2619],[4373, 2616],[4378, 2613]], CTS2(4945285, 7, 0.07, 0.10), 100, 8];
wait(RandomRange(75, 250));
rectangles := obj.Find(True, 50);
if Length(Rectangles) = 0 then
begin
walkTo(Outside_Gate_path);
Minimap.SetCompassAngle(RandomRange(150, 0), False);
Open_Gate_2();
end;
for i:=0 to High(rectangles) do
smart.Image.DrawTPA(rectangles[i].ToTPA.Connect, $00FFFF);
begin
wait(RandomRange(75, 250));
if Length(Rectangles) = 0 then Exit;
mouse.Move(rectangles[0].Bounds);
wait(RandomRange(75, 250));
end;
if MainScreen.IsUpText(['Op', 'en']) then
begin
mouse.Click(mouse_Left);
wait(RandomRange(75, 250));
smart.Image.Clear();
wait(RandomRange(75, 250));
smart.Image.Clear();
end;
end;

procedure Fill_inventory_with_supplies();
var
TPA, Wheat: TPointArray;
ATPA: T2DPointArray;
begin
if not SRL.isLoggedIn() then //If not logged in, then terminate script

TerminateScript;

if chatBox.findTextOnLines(['reach'], [1..2]) then

open_Gate_2();

if (SRL.FindColors(TPA, CTS2(6798010, 7, 0.04, 1.52), MainScreen.GetBounds) > 0) then //If we find colours at all then...

begin
myAntiban();
ATPA := TPA.Cluster(2); //Group them within a max pixel distance of 2
//ATPA.FilterSize(100, 500); //Remove and ATPA of size < 100, or > 500.
ATPA.SortByIndex(MainScreen.GetMiddle); //Sort by closest to Middle of the screen
{$IFDEF SMART}
Smart.Image.DrawATPA(ATPA); //Draws the ATPA's on the screen.
{$ENDIF} //smart.Image.DebugATPA(ATPA) works as well
//End SMART IF
for Wheat in ATPA do //For every possible Wheat in our ATPA
begin
Mouse.Move(Wheat[Random(Length(Wheat))]); //Move the mouse to the Wheat
if MainScreen.IsUpText('Wheat') then //If the uptext is 'Wheat', try to click it
begin
if Mouse.Click(ctRed) then //Clicks the mouse and looks to see if red 'x' appeard when cicked
begin
waitLoop(); //Call to our waitLoop because we want to wait while picking.
smart.Image.Clear();
myAntiban();
Repeat
while (not Inventory.IsFull) do // Keeps filling the Inventory until its full
Fill_inventory_with_supplies();
until(true);
Break; //If found red 'x', then break because we clicked it
end;
end;
end;
end;
{$IFDEF SMART}
Smart.Image.Clear; //Clears the ATPA's from screen
{$ENDIF} //If we are using SMART, then...
end;

function Open_Gate(): boolean;
var
i : Int32;
obj : TMSObject;
rectangles: array of TRectangle;
tpa : TPointArray;
atpa : T2DPointArray;
Pnts : TPointArray;
Pnt : Tpoint;

begin // Gate Location open and closed
// Tile 1 Tile 2 Tile 3 Tile 4 Tile 5 Tile 6 color of Gate, min points, splitDist.
obj := [[[4373, 2619],[4373, 2616],[4378, 2613],[4373, 2619],[4373, 2616],[4378, 2613]], CTS2(4945285, 7, 0.07, 0.10), 100, 8];
rectangles := obj.Find(True, 50);
if Length(Rectangles) = 0 then
begin
walkTo(Outside_Gate_path); //Make new path to go inside field
Minimap.SetCompassAngle(RandomRange(150, 0), False);
Open_Gate();
end;
wait(RandomRange(75, 250));
for i:=0 to High(rectangles) do
smart.Image.DrawTPA(rectangles[i].ToTPA.Connect, $00FFFF);
begin
wait(RandomRange(75, 250));
if Length(Rectangles) = 0 then Exit;
mouse.Move(rectangles[0].Bounds);
wait(RandomRange(75, 250));
end;
if MainScreen.IsUpText(['Op', 'en']) then
begin
mouse.Click(mouse_Left);
wait(RandomRange(75, 250));
smart.Image.Clear();
wait(RandomRange(75, 250));
Fill_inventory_with_supplies();
smart.Image.Clear();
end;
if MainScreen.IsUpText(['Clo', 'Se']) then
begin
smart.Image.Clear();
wait(RandomRange(75, 250));
Fill_inventory_with_supplies();
end;
end;

function Walk_to_supplies(): Boolean;
begin
myAntiban(); //Do Antiban
walkTo(Supplies_Path); // Walks to the Supplies
Open_Gate(); // Opens the Gate
Result := True;
end;

function Check_Inventory(): Boolean;
begin
Result := Gametabs.Open(tabInventory); // Opens the Inventory Tab
while (not Inventory.IsFull) do // If the Inventory is not full then....
begin
myAntiban();
Walk_to_supplies();
end else
myAntiban();
wait(RandomRange(75, 250));
walkTo(Outside_Gate_path);
Check_Gate();
end;

function setUp(): boolean
begin
{$IFDEF SMART} // If we are using SMART, then...
Smart.EnableDrawing := True; // let us draw on SMART
{$ENDIF} // end SMART IF
SRL.Setup([]); // Setup SRL to allow us to acces it's functions.
setupAntiban(); //Setup our antiban
declarePlayers(); // Declare the player we are using
Walker.Init('World.png'); // Setup RSWalker by initializing the map we want to use.
Supplies_path := [[4541, 2687], [4537, 2648], [4509, 2625], [4476, 2614], [4437, 2607], [4408, 2612], [4379, 2614]];// The path that we plan to walk (Supplies_path = Grain field)
Bank_path := [[4373, 2624], [4430, 2625], [4471, 2638], [4509, 2643], [4537, 2688]]; // The path that we plan to walk (Bank_path = Varrock West Bank)
Outside_Gate_path := [[4373, 2626], [4374, 2623]];
AddOnTerminate(@Walker.Free); // automatic free once script shuts down
Walker.skipClose := 30; // how close to the target point before we try to click the next point.
if (not SRL.isLoggedIn) then // If not logged in then..
begin
Players.LoginCurrent(); // Log player in
MainScreen.setAngle(True); // Sets the camera angle to the highest point
end;
Result := True;
end;

begin //Main
if setUp then //Calls the setup of the script
writeln('We are set up and ready to go!');
repeat
myAntiban();
Progress();
Check_Inventory();
smart.Image.Clear();
until(false);
end.


Kind Regards

RSPS Scripter

daileyj93

2019-03-12 12:20:37

I just glanced over it quick, but one thing I noticed is a lot of your wait times are from 1.3 to 1.4 seconds ->(RandomRange(1320, 1460)), which isn't very random if you think about it realistically.

On another note, your script is kinda hard to follow, partly because of the way its formatted but also because the way you have one function flow right into another. For example your main loop only calls Check_Inventory, then Check_Inventory calls the next function and so on. Notice how in the Cabbage Tut script, how the main loop controls the overall flow of the program, instead of just calling one function that strings to all the others. This kind of structure makes it easier to follow and easier for other people to review your script.
Cabbage tut script main loop:
begin //Main
if setUp then //Calls the setup of the script
writeln('We are set up and ready to go!');
repeat
walkTo(pPatch); //Walk to Patch
while (not Inventory.IsFull) do
findCabbages(); //Collect Cabbages until inv is full
walkTo(pBank); //Walk to Bank
while (not doBank) do //Deposit all Cabbages
wait(randomRange(75, 250));
until(false); //Repeats forever
end.

As far as the formatting, check out this tutorial: SRL/Simba Standards (with examples). Pay attention to how he tabs nested elements. The code block under "Use Semicolons" is a good example of how your formatting should look.

I know you asked about your script being banned, but these things will help people review your code and understand how your script works so they can help you easier.

RSPS Scripter

2019-03-12 15:21:19

Dear daileyj93,

Thank you for helping me.

I changed the Script format and the random waits.

for the main loop i could do the same as the Cabbage TUT but there is a Gate thats need to be opened idk how to add it in the main loop.

daileyj93

2019-03-12 15:42:11

Honestly at this point, I wouldn't worry about it cuz you would have to restructure most of the script, which probably isnt worth it to you for just picking wheat, but in the future something like below might be a little more organized. Each function/procedure should be modular, meaning it only performs one specific task. (This will also allow you to use your code again and again in other scripts)And your main loop should control the overall flow.

begin //Main
if setUp then //Calls the setup of the script
writeln('We are set up and ready to go!');
repeat
walkTo(pWheatField); //Walk to field
if(not GateOpen()) then OpenGate;
while (not Inventory.IsFull) do
pickWheat(); //Collect wheat until inv is full
walkTo(pGate); //Walk to gate
if(not GateOpen()) then OpenGate;//GateOpen returns true if gate is open
//if its not open then you call a procedure to open the gate
walkTo(pBank);
while (not doBank) do //Deposit all wheat
wait(randomRange(75, 250));
until(false); //Repeats forever
end.

Imagine if SRL includes were structured like your script, for example, OpenInventory called InventoryCount which called DropInventory all in a big string. You wouldnt be able to use OpenInventory at all unless you were planing to drop everything as well.

I mean its your script and you can write it however you feel.. but its just something to consider.

Citrus

2019-03-12 21:54:55

IME, certain low-level activities are heavily bot-watched and will result in a ban 99% of the time regardless of script.

RSPS Scripter

2019-03-13 07:57:55

Dear Citrus,

Thank you for helping me.


I just wanted to make a simple script to learn opening a door in this case a Gate, i didnt know that low-level activities where heavily bot-watched thank you for telling me.

The thing is picking wheat is not worth att all but i gotta start somewhere right?

anyways im gonna take a big step back atm i am going trough Coh3n's Beginner's Tutorial this is the link btw —> https://villavu.com/forum/showthread.php?t=58935

my goal is now the breaking system idk if you can help me with it.

this is a code from Flight's script how he did the breaking i just want the same but its in Aerolibs anyway to convert or similar code for SRL-OSRS?

The Code:

// Break settings
cBREAK_IN = 135; // How long before we take a break? (minutes)
cBREAK_FOR = 35; // How long will we break for? (minutes)
cR_BREAK_IN = 25; // Random minutes to add/subtract from how long until we break
cR_BREAK_FOR = 13; // Random minutes to add/subjtract from break duraction
HOPAFTERBREAK = False; // Change worlds after a break?

Citrus

2019-03-13 09:06:30

I think the best approach for breaking is to mimic what you'd do as a human. Back when I played RS, I'd usually have something else open and would only check the game periodically. That's the 'micro' level. The 'macro' level is based on how long you're able to sit in a chair and play the most boring game ever :p.If you can replicate this with your code, you'll have better odds not getting banned.

You can basically accomplish all of this with Wait() and GetTimeRunning() or GetSystemTime()