SRL Archive - RS3 Help

is there a built-in function to press space?


victordono

2014-11-01 20:49:17

Yeah, as subject says, need it for the production screens with like " smelt" or that herblore production screen, or is pressing space all the time not human-like

Ian

2014-11-01 20:52:13


productionScreen.clickStart()

KeepBotting

2014-11-01 20:54:27

From: BMWxi

productionScreen.clickStart()

That'll do the trick if you want to click the button. To press the spacebar, you can do
typeByte(VK_SPACE);

Ian

2014-11-01 20:57:19

From: KeepBotting
That'll do the trick if you want to click the button. To press the spacebar, you can do
typeByte(VK_SPACE);


Unless you use

productionScreen.clickStart(false);

It will default to using the spacebar.

The whole function:

(*
TRSProductionScreen.clickStart
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. code-block:: pascal

function TRSProductionScreen.clickStart(): boolean;

Attempts to click the blue "start" button, returns if succesfull or not.

.. note::

- by Olly
- Last Updated: 06 November 2013 by Olly

Example:

.. code-block:: pascal

if (productionScreen.clickStart()) then
writeln('We started making something!');
*)
function TRSProductionScreen.clickStart(space: boolean = true): boolean;
var
b: TBox;
timeOut: LongWord;
begin
result := false;

b := [self.x1 +252, self.y2 -30, self.x2 -29, self.y2 -3];

// try Space key first
if space then
begin
timeOut := (getSystemTime() + randomRange(1500, 1900));
repeat
multiType(VK_SPACE, randomRange(30, 50), 3);
wait(100 + random(50));
result := (not self.isOpen());
until((getSystemTime() > timeOut) or result);

if (result) then
exit();
end;

// click the button as a failsafe
mouseBox([self.x1 +252, self.y2 -30, self.x2 -29, self.y2 -3], MOUSE_MOVE);

// this is a failsafe in case the productionscreen closes (from the space key) while moving the mouse
if (self.isOpen()) then
begin
fastClick(MOUSE_LEFT);
wait(50 + random(50));
end else
exit(true);

// wait for the productionscreen to close
timeOut := (getSystemTime() + randomRange(5000, 6000));
while (timeOut > getSystemTime()) do
begin
if (not self.isOpen()) then
begin
result := true;
break;
end;

wait(50 + random(50));
end;

print('TRSProductionScreen.clickStart(): result = '+boolToStr(result), TDebug.SUB);
end;

KeepBotting

2014-11-01 20:58:44

From: BMWxi
Unless you use

productionScreen.clickStart(false);

It will default to using the spacebar.


Touché :)

victordono

2014-11-01 21:17:40

Thanks ! , i dont really want to want to make a new thread but if anyones dropping into this one still,
ive copied and pasted and rewrote mediocrely together a script ( cause im not that well versed yet in simba )
And im just trying to implement anti-ban

Oh and ill just thank ashaman,arclight,and spartan for there scripts that i tweaked around

program CorruptOre;
{$DEFINE SMART}
{$I SRL-6/SRL.Simba}
{$i srl-6/lib/misc/srlplayerform.simba}

var
Timer : TTimeMarker;
x : Boolean;



function clickFurnace(): Boolean;
var
x, y: integer;
point: TPoint;
begin
Result := false;
case random(100) of
0..70 :
begin
if(mainscreen.findObject(x, y,8436223, 14, ['Furnace'], MOUSE_LEFT)) then
Result := true;
end;
71..95 :
begin
if(mainscreen.findObject(x, y, 8436223, 14, ['Furnace'], MOUSE_RIGHT)) then begin
Wait(GaussRangeInt(100,500));
chooseOption.select(['Smelt']);
Result := true;
end;
end;
96..100 :
begin
if(mainscreen.findObject(x, y, 8436223, 14, ['Furnace'], MOUSE_NONE)) then
begin
point.create(x, y);
if(gaussRangeInt(-10,10) <= mouseSpeed - 20) then
begin
missMouse(point, false);
fastClick(mouse_Left);
end
else
begin
missMouse(point, true);
fastClick(mouse_Left);
result := true;
end;
end;
end;
end;
Wait(gaussRangeInt(100,2000));
end;
procedure AntiBan();
begin
case random(20000) of
0..25 :
begin
hoverSkill(Skill_Mining);
Wait(GaussRangeInt(500,1000));
end;
101..105 :
begin
boredHuman(true);
end;
150..160 :
begin
randomGameTab(true);
end;
300..320 :
begin
randomRClickItem();
end;
400..700 :
begin
mouseMovingObject;
end;
900..1200 :
begin
Minimap.setAngle(180 - gaussRangeInt(0,360));
end;
1300..1400 :
begin
//add a bit of AFK
Wait(GaussRangeInt(1000,5000));
end;
1500..1800 :
begin
randomCameraAngle(MS_ANGLE_HIGH);
end;
1900..2200 :
begin
randomCameraAngle(MS_ANGLE_LOW);
end;
2250..2255 :
begin
Wait(gaussRangeInt(10000,120000));
if not Players[currentPlayer].login then
exit;
end;
end;
end;


begin
clearDebug();
setupSRL();
repeat
clickFurnace();
productionScreen.clickStart();
Wait(randomrange(144000, 155000))
Until(x);
Writeln('All players inactive,bye!');
End.

end.

So yeah if anyone can give me advice on how to implement antiban… i just tried copying arclights to be specific antiban since it seemed to make most since with the tons of mouse off screen but im not sure how to do it

uh oh i dont wanna make a new thread to ask this next question right after making this one already @.@

Ian

2014-11-01 22:19:17

From: victordono
Thanks ! , i dont really want to want to make a new thread but if anyones dropping into this one still,
ive copied and pasted and rewrote mediocrely together a script ( cause im not that well versed yet in simba )
And im just trying to implement anti-ban

Oh and ill just thank ashaman,arclight,and spartan for there scripts that i tweaked around
-snip-

So yeah if anyone can give me advice on how to implement antiban… i just tried copying arclights to be specific antiban since it seemed to make most since with the tons of mouse off screen but im not sure how to do it

uh oh i dont wanna make a new thread to ask this next question right after making this one already @.@

Now that you have an antiban procedure you need to put it into the mainloop somewhere where it will be called regulary. You could put it between the clicking start and the waiting.

victordono

2014-11-01 22:20:17

From: BMWxi
Now that you have an antiban procedure you need to put it into the mainloop somewhere where it will be called regulary. You could put it between the clicking start and the waiting.


Mhm agreed i thought of that, but i was hoping to somehow use the antiban during the waiting as its more human like, to like mouse off the screen while we're waiting for the ore to be burnt but i cant figure that out

Ian

2014-11-01 22:27:47

From: victordono
Mhm agreed i thought of that, but i was hoping to somehow use the antiban during the waiting as its more human like, to like mouse off the screen while we're waiting for the ore to be burnt but i cant figure that out


This procedure will run antiban at a random time between 0 and 144000, then wait the remainder of the time +random(11000) like you have in the original.


procedure waitForSmeltingToFinish;
var
TimeWaited: TTimeMarker;
begin
TimeWaited.start();
wait(random(144000));
antiban();
wait(144000 - TimeWaited.getTime() + random(11000));
end;

victordono

2014-11-01 22:31:37

Ohh, i see, is there anywhere i can read up on how that TimeWaited works ?
Also what if i wanted the antiban to be performed earlier like the human act of hitting smelt then alt tabbing so i wud want the anti ban abit earlier on

Incurable

2014-11-01 22:40:10

From: victordono
Ohh, i see, is there anywhere i can read up on how that TimeWaited works ?
Also what if i wanted the antiban to be performed earlier like the human act of hitting smelt then alt tabbing so i wud want the anti ban abit earlier on


You can call your antiban any time you want. As for TimeWaited, that's just a TTimeMarker, you can read more about them in the bank section of Mayor's AIO tutorial.

Ian

2014-11-01 22:42:01

From: victordono
Ohh, i see, is there anywhere i can read up on how that TimeWaited works ?
Also what if i wanted the antiban to be performed earlier like the human act of hitting smelt then alt tabbing so i wud want the anti ban abit earlier on


TimeWaited is a variable that I made. You can name it anything you want as long as you're consistent. The type of variable that it is is called a TTimeMarker. If you want more functions relating to TTimeMarkers you can find them in the time.simba file. You can find time.simba file here: C:\Simba\Includes\srl-6\lib\utilities\time.simba

To make the antiban trigger earlier on change

wait(random(144000));
to a lower value.

If you change it to

wait(random(5000));
The script will begin antiban sometime within the first 5 seconds.

victordono

2014-11-01 22:44:33

Thank you ! , ill read that up in a bit,
This is the code thats working atm with idk some form of antiban
Once again all of these antibans are copied from others and most of the code is just modified , so credits again to the people i mentioned earlier,
i just wanted your opinions on whether or not i wrote the loop or used the antiban in a decent human-like fashion

program CorruptOre;
{$DEFINE SMART}
{$I SRL-6/SRL.Simba}
{$i srl-6/lib/misc/srlplayerform.simba}

var
Timer : TTimeMarker;
x : Boolean;



function clickFurnace(): Boolean;
var
x, y: integer;
point: TPoint;
begin
Result := false;
case random(100) of
0..70 :
begin
if(mainscreen.findObject(x, y,8436223, 14, ['Furnace'], MOUSE_LEFT)) then
Result := true;
end;
71..95 :
begin
if(mainscreen.findObject(x, y, 8436223, 14, ['Furnace'], MOUSE_RIGHT)) then begin
Wait(GaussRangeInt(100,500));
chooseOption.select(['Smelt']);
Result := true;
end;
end;
96..100 :
begin
if(mainscreen.findObject(x, y, 8436223, 14, ['Furnace'], MOUSE_NONE)) then
begin
point.create(x, y);
if(gaussRangeInt(-10,10) <= mouseSpeed - 20) then
begin
missMouse(point, false);
fastClick(mouse_Left);
end
else
begin
missMouse(point, true);
fastClick(mouse_Left);
result := true;
end;
end;
end;
end;
Wait(gaussRangeInt(100,2000));
end;
procedure AntiBan();
begin
case random(20000) of
0..25 :
begin
hoverSkill(Skill_Mining);
Wait(GaussRangeInt(500,1000));
end;
101..105 :
begin
boredHuman(true);
end;
150..160 :
begin
randomGameTab(true);
end;
300..320 :
begin
randomRClickItem();
end;
400..700 :
begin
mouseMovingObject;
end;
900..1200 :
begin
Minimap.setAngle(180 - gaussRangeInt(0,360));
end;
1300..1400 :
begin
//add a bit of AFK
Wait(GaussRangeInt(1000,5000));
end;
1500..1800 :
begin
randomCameraAngle(MS_ANGLE_HIGH);
end;
1900..2200 :
begin
randomCameraAngle(MS_ANGLE_LOW);
end;
2250..2255 :
begin
Wait(gaussRangeInt(10000,120000));
if not Players[currentPlayer].login then
exit;
end;
end;
end;

procedure waitForSmeltingToFinish;
var
TimeWaited: TTimeMarker;
begin
TimeWaited.start();
mouseOffClient(OFF_CLIENT_RANDOM);
wait(random(144000));
antiban();
mouseOffClient(OFF_CLIENT_RANDOM);
wait(144000 - TimeWaited.getTime() + random(11000));
end;


begin
clearDebug();
setupSRL();
repeat
clickFurnace();
typeByte(VK_SPACE);
waitForSmeltingToFinish();
Until(x);
Writeln('All players inactive,bye!');
End.

end.
Thank you all :)

Also how exactly does mouseOffClient(OFF_CLIENT_RANDOM);
since i see "random" does this trigger randomly at a set time or ?

Ian

2014-11-01 22:52:53

Yeah it looks fine. Just a tip to save space/typing time though: You don't need to use a begin and end for only 1 line. So things like

400..700 :
begin
mouseMovingObject;
end;
could be shortened to

400..700 : mouseMovingObject;

victordono

2014-11-01 23:04:40

From: BMWxi
Yeah it looks fine. Just a tip to save space/typing time though: You don't need to use a begin and end for only 1 line. So things like

400..700 :
begin
mouseMovingObject;
end;
could be shortened to

400..700 : mouseMovingObject;


Thank you ! and just liek that i've managed to scrape together a corruptore bot :D
idk if you noticed the edit about the mouse off client so ill just ask again and thats a wrap :)

"Also how exactly does mouseOffClient(OFF_CLIENT_RANDOM);
since i see "random" does this trigger randomly at a set time or ?"

Ian

2014-11-01 23:28:27

From: victordono
Thank you ! and just liek that i've managed to scrape together a corruptore bot :D
idk if you noticed the edit about the mouse off client so ill just ask again and thats a wrap :)

"Also how exactly does mouseOffClient(OFF_CLIENT_RANDOM);
since i see "random" does this trigger randomly at a set time or ?"


OFF_CLIENT_RANDOM is a parameter that you give it. You can give it OFF_CLIENT_LEFT, OFF_CLIENT_RIGHT, OFF_CLIENT_TOP, or OFF_CLIENT_BOTTOM instead if you want to make it go in a specific direction, random will randomly choose one.