SRL Archive - OSR Help

Antiban


Wire

2014-06-19 22:17:48

How do i call upon a procedure within another procedure? For example i want the antiban case procedure to be called upon while running R_Walkpath.

 
begin
WriteLn('Found planks returning to Bank');
R_WalkPath([Point(3302, 3483), Point(3297, 3475), Point(3294, 3466), Point(3287, 3456), Point(3286, 3446), Point(3284, 3434), Point(3278, 3429), Point(3268, 3428), Point(3255, 3428), Point(3254, 3422), Point(3254, 3420)]);

end else


And the AntiBan, is this sufficient, decent, or simply bad?


procedure AntiBan;
begin
case random(2000) of
1..180: PickUpMouse;
200..380: BoredHuman;
400..680: MMouseOffClient('bottom');
700..980: MMouseOffClient('right');
1000..1049: MMouseOffClient('top');
1050..1099: MMouseOffClient('left');
1100..1300: RandomMovement;
1350..1500: SmallRandomMouse;
1501..1600: HoverSkill(skill_strength, false);
1601..1700: RandomAngle(1);
1701..1800: HoverOnlineFriend;
1801..1900: Wait(RandomRange(400, 1000));
1901..1949: RandomFKeys;
1950..2000: SmallRandomMouse;
end;
end;

Foundry

2014-06-19 22:51:20

You would have to edit the walkPath procedure to have it call your antiban procedure. I recommend not messing with an include if you dont know what you're doing.

As for the antiban procedure itself, it looks good. Just remember that it will always do something when it is executed, so don't call it too often.

Wire

2014-06-19 23:34:55

From: Foundry
You would have to edit the walkPath procedure to have it call your antiban procedure. I recommend not messing with an include if you dont know what you're doing.

As for the antiban procedure itself, it looks good. Just remember that it will always do something when it is executed, so don't call it too often.


Could you provide an example of how to call the procedure because this is what i am currently struggling with, also i don't know if this is how it works but i left randoms "blank areas" in the case numbering which i thought gives the chance of doing nothing.

Thanks, Wire.

KeepBotting

2014-06-19 23:53:19

Simba isn't multi-threaded, which means it can only execute one task at a time. To accomplish what you want, you'd have to create your own R_WalkPath (just cut/copy/pasting it and changing the name would be sufficient) and edit it to run your antiban procedure every time it clicks on a point (or what have you).

Also that's a good antiban procedure.

Wire

2014-06-20 09:28:58

From: KeepBotting
Simba isn't multi-threaded, which means it can only execute one task at a time. To accomplish what you want, you'd have to create your own R_WalkPath (just cut/copy/pasting it and changing the name would be sufficient) and edit it to run your antiban procedure every time it clicks on a point (or what have you).

Also that's a good antiban procedure.


I'm not positive i understand quite yet, do you means something like this? I believe the random command should randomize the antiban enough for it not to become anti-antiban. Plus I'm not totally confident that this will run like what i'm thinking with all the if..then..else commands. Thanks for the help, Wire.

Simba Code:
begin
WriteLn('Found planks returning to Bank');
R_WalkPath([Point(3302, 3483), Point(3297, 3475)]);
if (Random(1) < 4) then
begin
case random(2000) of
1..180: PickUpMouse;
200..380: BoredHuman;
400..680: MMouseOffClient('bottom');
700..980: MMouseOffClient('right');
1000..1049: MMouseOffClient('top');
1050..1099: MMouseOffClient('left');
1100..1300: RandomMovement;
1350..1500: SmallRandomMouse;
1501..1600: HoverSkill(skill_strength, false);
1601..1700: RandomAngle(1);
1701..1800: HoverOnlineFriend;
1801..1900: Wait(RandomRange(400, 1000));
1901..1949: RandomFKeys;
1950..2000: SmallRandomMouse;
end;
end else
R_WalkPath([Point(3294, 3466), Point(3287, 3456), Point(3286, 3446)]);
if (Random(1) < 4) then
begin
case random(2000) of
1..180: PickUpMouse;
200..380: BoredHuman;
400..680: MMouseOffClient('bottom');
700..980: MMouseOffClient('right');
1000..1049: MMouseOffClient('top');
1050..1099: MMouseOffClient('left');
1100..1300: RandomMovement;
1350..1500: SmallRandomMouse;
1501..1600: HoverSkill(skill_strength, false);
1601..1700: RandomAngle(1);
1701..1800: HoverOnlineFriend;
1801..1900: Wait(RandomRange(400, 1000));
1901..1949: RandomFKeys;
1950..2000: SmallRandomMouse;
end;
end else
R_WalkPath[(Point(3284, 3434), Point(3278, 3429), Point(3268, 3428)]);
if (Random(1) < 4) then
begin
case random(2000) of
1..180: PickUpMouse;
200..380: BoredHuman;
400..680: MMouseOffClient('bottom');
700..980: MMouseOffClient('right');
1000..1049: MMouseOffClient('top');
1050..1099: MMouseOffClient('left');
1100..1300: RandomMovement;
1350..1500: SmallRandomMouse;
1501..1600: HoverSkill(skill_strength, false);
1601..1700: RandomAngle(1);
1701..1800: HoverOnlineFriend;
1801..1900: Wait(RandomRange(400, 1000));
1901..1949: RandomFKeys;
1950..2000: SmallRandomMouse;
end;
end else
R_WalkPath([Point(3255, 3428), Point(3254, 3422), Point(3254, 3420)]);
end;


Foundry

2014-06-20 09:52:07

Didn't look closely enough at the antiban procedure, my bad. Disregard my previous warning.

E: In answer to your question, what you wrote could be simplified to this:

begin
WriteLn('Found planks returning to Bank');
R_WalkPath([Point(3302, 3483), Point(3297, 3475)]);

if (Random(1) < 4) then
begin
antiban; // the beauty of procedures.
end else // are all of these different paths to the same place?
R_WalkPath([Point(3294, 3466), Point(3287, 3456), Point(3286, 3446)]);

if (Random(1) < 4) then
begin
antiban;
end else
R_WalkPath[(Point(3284, 3434), Point(3278, 3429), Point(3268, 3428)]);

if (Random(1) < 4) then
begin
antiban;
end else
R_WalkPath([Point(3255, 3428), Point(3254, 3422), Point(3254, 3420)]);
end;

Turpinator

2014-06-20 10:31:27

From: Wire
(Random(1) < 4)                                                      

Random(1) = 0.

procedure WalkAntiBan;
begin
case random(100000) of
1..180: PickUpMouse;
200..380: BoredHuman;
400..680: MMouseOffClient('bottom');
700..980: MMouseOffClient('right');
1000..1049: MMouseOffClient('top');
1050..1099: MMouseOffClient('left');
1100..1300: RandomMovement;
1350..1500: SmallRandomMouse;
1501..1600: HoverSkill(skill_strength, false);
1601..1700: RandomAngle(1);
1701..1800: HoverOnlineFriend;
1801..1900: Wait(RandomRange(400, 1000));
1901..1949: RandomFKeys;
1950..2000: SmallRandomMouse;
end;
end;

(*
R_WalkPathEx
~~~~~~~~~~~

.. code-block:: pascal

function R_WalkPathMMEx(Path: TPointArray; Reverse: boolean; DistToMsWalk: integer): boolean;

Walks the path specified on the minimap and then mainscreen in a human like manner. Reverse walks
path in oppsite direction. DistToMsWalk is how far away from final tile to start using mainscreen.

.. note::

by AwkwardSaw & elfyyy

*)
function R_WalkPathEx2(Path: TPointArray; Reverse: boolean; DistToMsWalk: integer): boolean;
var
I, K, H, T, Fails, lP: integer;
P, MM, MMF: TPoint;
Temp: TPointArray;
begin
Temp := CopyTPA(Path);
ColorToleranceSpeed(1);
T := GetSystemTime + 10000 + Random(2000);
Fails := 0;
lP := 0;
if Reverse then
InvertTpa(Temp);
H := High(Path);
while (not Result) and (GetSystemTime < T) and (Fails < 5) and (R_DistanceFromTile(Temp[H]) >= DistToMsWalk) do
begin
if (not LoggedIn()) then
Exit;
P := R_GetTileGlobal;
for I := H downto 0 do
begin
if ((I - lP) > 3) then
Continue
else
lP := I;
MM := R_TileToMM(Temp[I]);
if MM = MMF then
Inc(Fails);
if R_TileOnMM(Temp[i]) then
begin
WalkAntiBan; ////////////THIS IS WHERE YOUR ANTIBAN FUNC IS CALLED
R_WalkToTileMM(Temp[i]);
MarkTime(K);
repeat
if not R_IsWalking then
break;
until((TimeFromMark(K) > 2000) or FFlag(30));
MMF := MM;
if (I = H) then
FFlag(5)
else
FFlag(25);
T := getSystemTime + 7000 + Random(1000);
Break;
end;
end;
Result := (I = H);
end;
if DistToMsWalk > 0 then
Result := R_BlindWalkMS(Temp[H]);
end;

(*
R_WalkPath
~~~~~~~~~~~

.. code-block:: pascal

function R_WalkPathMMEx(Path: TPointArray): boolean;

Walks the path specified on the minimap in a human like manner. Reverse walks
path in oppsite direction.

.. note::

elfyyy

*)
function R_WalkPath2(Path: TPointArray): boolean;
begin
Result := R_WalkPathEx2(Path, False, 0);
end;

so you would call R_WalkPath2() when ever you wanted to walk then.
currently WalkAntiBan has a 1/50 chance of performing something. which is meh. (the func is called every time you walk to a point).
so if you walked a path with 50 points, odds are it would have performed your antiban at least once.

KeepBotting

2014-06-20 10:45:44

From: Turpinator
Random(1) = 0.

procedure WalkAntiBan;
begin
case random(100000) of
1..180: PickUpMouse;
200..380: BoredHuman;
400..680: MMouseOffClient('bottom');
700..980: MMouseOffClient('right');
1000..1049: MMouseOffClient('top');
1050..1099: MMouseOffClient('left');
1100..1300: RandomMovement;
1350..1500: SmallRandomMouse;
1501..1600: HoverSkill(skill_strength, false);
1601..1700: RandomAngle(1);
1701..1800: HoverOnlineFriend;
1801..1900: Wait(RandomRange(400, 1000));
1901..1949: RandomFKeys;
1950..2000: SmallRandomMouse;
end;
end;

(*
R_WalkPathEx
~~~~~~~~~~~

.. code-block:: pascal

function R_WalkPathMMEx(Path: TPointArray; Reverse: boolean; DistToMsWalk: integer): boolean;

Walks the path specified on the minimap and then mainscreen in a human like manner. Reverse walks
path in oppsite direction. DistToMsWalk is how far away from final tile to start using mainscreen.

.. note::

by AwkwardSaw & elfyyy

*)
function R_WalkPathEx2(Path: TPointArray; Reverse: boolean; DistToMsWalk: integer): boolean;
var
I, K, H, T, Fails, lP: integer;
P, MM, MMF: TPoint;
Temp: TPointArray;
begin
Temp := CopyTPA(Path);
ColorToleranceSpeed(1);
T := GetSystemTime + 10000 + Random(2000);
Fails := 0;
lP := 0;
if Reverse then
InvertTpa(Temp);
H := High(Path);
while (not Result) and (GetSystemTime < T) and (Fails < 5) and (R_DistanceFromTile(Temp[H]) >= DistToMsWalk) do
begin
if (not LoggedIn()) then
Exit;
P := R_GetTileGlobal;
for I := H downto 0 do
begin
if ((I - lP) > 3) then
Continue
else
lP := I;
MM := R_TileToMM(Temp[I]);
if MM = MMF then
Inc(Fails);
if R_TileOnMM(Temp[i]) then
begin
WalkAntiBan; ////////////THIS IS WHERE YOUR ANTIBAN FUNC IS CALLED
R_WalkToTileMM(Temp[i]);
MarkTime(K);
repeat
if not R_IsWalking then
break;
until((TimeFromMark(K) > 2000) or FFlag(30));
MMF := MM;
if (I = H) then
FFlag(5)
else
FFlag(25);
T := getSystemTime + 7000 + Random(1000);
Break;
end;
end;
Result := (I = H);
end;
if DistToMsWalk > 0 then
Result := R_BlindWalkMS(Temp[H]);
end;

(*
R_WalkPath
~~~~~~~~~~~

.. code-block:: pascal

function R_WalkPathMMEx(Path: TPointArray): boolean;

Walks the path specified on the minimap in a human like manner. Reverse walks
path in oppsite direction.

.. note::

elfyyy

*)
function R_WalkPath2(Path: TPointArray): boolean;
begin
Result := R_WalkPathEx2(Path, False, 0);
end;

so you would call R_WalkPath2() when ever you wanted to walk then.
currently WalkAntiBan has a 1/50 chance of performing something. which is meh. (the func is called every time you walk to a point).
so if you walked a path with 50 points, odds are it would have performed your antiban at least once.
This is what I was talking about ^^

Wire

2014-06-23 13:24:12

I am almost certain i have not implemented this correctly. Honestly I'm finding it hard to understand what exactly is occurring in the WalkPath(R_WalkPathEx2) function. I believe customized the ThePath function to have reverse and variant in the tile selection(?). Another issue i am experiencing is the calling the function ThePath in the mainloop, any help would be greatly appreciated, Wire.



procedure AntiBan;
begin
case random(100000) of
1..180: PickUpMouse;
200..380: BoredHuman;
400..680: MMouseOffClient('bottom');
700..980: MMouseOffClient('right');
1000..1049: MMouseOffClient('top');
1050..1099: MMouseOffClient('left');
1100..1300: RandomMovement;
1350..1500: SmallRandomMouse;
1501..1600: HoverSkill(skill_strength, false);
1601..1700: RandomMovement;
1701..1800: HoverOnlineFriend;
1801..1900: Wait(RandomRange(400, 1000));
1901..1949: RandomFKeys(false);
1950..2000: SmallRandomMouse;
end;
Wait(500+random(1000));
end;



function WalkPath(Path: TPointArray; Reverse: boolean; DistToMsWalk: integer): boolean;
var
I, K, H, T, Fails, lP: integer;
P, MM, MMF: TPoint;
Temp: TPointArray;
begin
Temp := CopyTPA([Point(3254, 3424), Point(3263, 3428), Point(3277, 3430), Point(3283, 3438), Point(3286, 3450), Point(3294, 3460), Point(3296, 3473), Point(3303, 3483), Point(3302, 3490)]);
ColorToleranceSpeed(1);
T := GetSystemTime + 10000 + Random(2000);
Fails := 0;
lP := 0;
if Reverse then
InvertTpa(Temp);
H := High(Path);
while (not Result) and (GetSystemTime < T) and (Fails < 5) and (R_DistanceFromTile(Temp[H]) >= DistToMsWalk) do
begin
if (not LoggedIn()) then
Exit;
P := R_GetTileGlobal;
for I := H downto 0 do
begin
if ((I - lP) > 3) then
Continue
else
lP := I;
MM := R_TileToMM(Temp[I]);
if MM = MMF then
Inc(Fails);
if R_TileOnMM(Temp[i]) then
begin
AntiBan; ////////////THIS IS WHERE YOUR ANTIBAN FUNC IS CALLED
R_WalkToTileMM(Temp[i]);
MarkTime(K);
repeat
if not R_IsWalking then
break;
until((TimeFromMark(K) > 2000) or FFlag(30));
MMF := MM;
if (I = H) then
FFlag(5)
else
FFlag(25);
T := getSystemTime + 7000 + Random(1000);
Break;
end;
end;
Result := (I = H);
end;
if DistToMsWalk > 0 then
Result := R_BlindWalkMS(Temp[H]);
end;


procedure ThePath(Path: TPointArray) boolean;
begin
Result := WalkPath(Path, True, 2);
end;
MainLoop as is

begin
SetUpSRL;
SetupReflection;
ActivateClient;
DeclarePlayers;
BlankSlate;
LoginPlayer;
repeat
//PlankToBank;
//OakLogsWithdraw;
//TurnRunOn;
//BankToSawMill;
//MillTalk;
//AntiBan;
//TurnRunOn;
SawMillToBank;
ThePath;
until false
end.

KeepBotting

2014-06-23 17:01:05

From: Wire
I am almost certain i have not implemented this correctly. Honestly I'm finding it hard to understand what exactly is occurring in the WalkPath(R_WalkPathEx2) function. I believe customized the ThePath function to have reverse and variant in the tile selection(?). Another issue i am experiencing is the calling the function ThePath in the mainloop, any help would be greatly appreciated, Wire.



procedure AntiBan;
begin
case random(100000) of
1..180: PickUpMouse;
200..380: BoredHuman;
400..680: MMouseOffClient('bottom');
700..980: MMouseOffClient('right');
1000..1049: MMouseOffClient('top');
1050..1099: MMouseOffClient('left');
1100..1300: RandomMovement;
1350..1500: SmallRandomMouse;
1501..1600: HoverSkill(skill_strength, false);
1601..1700: RandomMovement;
1701..1800: HoverOnlineFriend;
1801..1900: Wait(RandomRange(400, 1000));
1901..1949: RandomFKeys(false);
1950..2000: SmallRandomMouse;
end;
Wait(500+random(1000));
end;



function WalkPath(Path: TPointArray; Reverse: boolean; DistToMsWalk: integer): boolean;
var
I, K, H, T, Fails, lP: integer;
P, MM, MMF: TPoint;
Temp: TPointArray;
begin
Temp := CopyTPA([Point(3254, 3424), Point(3263, 3428), Point(3277, 3430), Point(3283, 3438), Point(3286, 3450), Point(3294, 3460), Point(3296, 3473), Point(3303, 3483), Point(3302, 3490)]);
ColorToleranceSpeed(1);
T := GetSystemTime + 10000 + Random(2000);
Fails := 0;
lP := 0;
if Reverse then
InvertTpa(Temp);
H := High(Path);
while (not Result) and (GetSystemTime < T) and (Fails < 5) and (R_DistanceFromTile(Temp[H]) >= DistToMsWalk) do
begin
if (not LoggedIn()) then
Exit;
P := R_GetTileGlobal;
for I := H downto 0 do
begin
if ((I - lP) > 3) then
Continue
else
lP := I;
MM := R_TileToMM(Temp[I]);
if MM = MMF then
Inc(Fails);
if R_TileOnMM(Temp[i]) then
begin
AntiBan; ////////////THIS IS WHERE YOUR ANTIBAN FUNC IS CALLED
R_WalkToTileMM(Temp[i]);
MarkTime(K);
repeat
if not R_IsWalking then
break;
until((TimeFromMark(K) > 2000) or FFlag(30));
MMF := MM;
if (I = H) then
FFlag(5)
else
FFlag(25);
T := getSystemTime + 7000 + Random(1000);
Break;
end;
end;
Result := (I = H);
end;
if DistToMsWalk > 0 then
Result := R_BlindWalkMS(Temp[H]);
end;


procedure ThePath(Path: TPointArray) boolean;
begin
Result := WalkPath(Path, True, 2);
end;
MainLoop as is

begin
SetUpSRL;
SetupReflection;
ActivateClient;
DeclarePlayers;
BlankSlate;
LoginPlayer;
repeat
//PlankToBank;
//OakLogsWithdraw;
//TurnRunOn;
//BankToSawMill;
//MillTalk;
//AntiBan;
//TurnRunOn;
SawMillToBank;
ThePath;
until false
end.

What's the problem, then? What's it doing or not doing? What's the debug output? Are there any compiling/runtime errors?

Wire

2014-06-23 19:25:21

Compiling error, says invalid number of parameters.



procedure ThePath(Path: TPointArray): boolean;
begin //[Error] C:\Simba\Scripts\WirePlanksV1.0.2.simba(234:38): Semicolon (';') expected at line 234 Compiling failed.
Result := WalkPath(Path, True, 2);
end;




or without the above procedure in the code at all,

begin
SetUpSRL;
SetupReflection;
ActivateClient;
DeclarePlayers;
BlankSlate;
LoginPlayer;
repeat
//PlankToBank;
//OakLogsWithdraw;
//TurnRunOn;
//BankToSawMill;
//MillTalk;
//AntiBan;
//TurnRunOn;
//SawMillToBank;
WalkPath;
until false //[Error] C:\Simba\Scripts\WirePlanksV1.0.2.simba(264:13): Invalid number of parameters at line 264 Compiling failed.

end.
I think what i need is this possibly dumb down so that i can understand each section(?) and actually use it versus just copy pasting it. If this is just a standard (form?) of the code of R_WalkPath, then the areas i would fill in would be filled in with what exactly? Thanks, Wire.

KeepBotting

2014-06-23 20:26:29

From: Wire
*snip*


I think you just need a semicolon after
until false;
like that

Dervish

2014-06-23 20:30:24

No, invalid number of parameters the line above, you need to fill in the info for

WalkPath();

Also :

Until(false);

Wire

2014-06-23 23:16:39

From: Dervish
No, invalid number of parameters the line above, you need to fill in the info for

WalkPath();

Also :



Until(false);




Say for example i want to place ThePath into my main loop, how do i fill that out?
function ThePath(Path: TPointArray) boolean;
begin
Result := WalkPath(Path, True, 2);


Would it be somthing like this?

begin
SetUpSRL;
SetupReflection;
ActivateClient;
DeclarePlayers;
BlankSlate;
LoginPlayer;
repeat
//PlankToBank;
//OakLogsWithdraw;
//TurnRunOn;
//BankToSawMill;
//MillTalk;
//AntiBan;
//TurnRunOn;
//SawMillToBank;
ThePath(True);
until (false);

end.


And finally, do i have it correctly in place for it to run anti ban while walking or no? What information do i need to fill it, because i've tried placing the TPA into the (Something like([Point(2222),(2222)}) to no avail. What have i messed up upon? Thanks, Wire.

Dervish

2014-06-25 10:09:03

From: Wire
Say for example i want to place ThePath into my main loop, how do i fill that out?
function ThePath(Path: TPointArray) boolean;
begin
Result := WalkPath(Path, True, 2);


Would it be somthing like this?

begin
SetUpSRL;
SetupReflection;
ActivateClient;
DeclarePlayers;
BlankSlate;
LoginPlayer;
repeat
//PlankToBank;
//OakLogsWithdraw;
//TurnRunOn;
//BankToSawMill;
//MillTalk;
//AntiBan;
//TurnRunOn;
//SawMillToBank;
ThePath(True);
until (false);

end.


And finally, do i have it correctly in place for it to run anti ban while walking or no? What information do i need to fill it, because i've tried placing the TPA into the (Something like([Point(2222),(2222)}) to no avail. What have i messed up upon? Thanks, Wire.


function ThePath(Path: TPointArray) boolean;
begin
Result := WalkPath(Path, True, 2);

As you can see here the function ThePath asks for a TPointArray to be fed to the function : (Path: TPointArray).
A TPointArray is an array of TPoints.
A TPoint is a.. Point which holds two coordinates for example : [2352,1228], that's a TPoint.
Since a TPA is an array of TPoints, it's something like a list of TPoints. You should create this TPA using a path creator or something like that and then use it in your script.

If it successfully walks the path it will return true.
But honestly, why not just have WalkPath instead ? :). As far as I see ThePath doesn't really contribute anything new to the script ?