SRL Archive - Help and Support

Faux Multithreading


Goobs

2014-12-04 12:27:29

Hey there,

Last night I was asking some questions on the IRC channel, mostly to do with creating a more human-like antiban procedure. In specific, I want this new antiban to be able to mess with the compass concurrently with mouse movement.

As we are well aware, the keyboard is almost never used outside of antiban (or other small tasks during which an antiban would not be called), but the mouse is almost always doing something. So, that being said, I wanted to know if SMART can handle multiple Simba pairings (One Simba runs the main script, the other one runs antiban). The second simba would be told to do the antiban using internal variables, and would just wait until that time happens.

I want to use this mostly for the sections of a script that do not involve mapwalking, typing, or TPA finding. It would be created for boring tasks like herb identifying and other inventory procedures. Essentially the mouse would keep doing what it's doing, while the keyboard is concurrently screwing with the compass. I've watched several people play RS and they all screw with the compass at some point when they're legit playing and doing repetitive inventory stuff.

TL;DR
Can I pair two Simba's to the same SMART, and make it so they can input concurrently?

Kevin

2014-12-04 13:13:17

I know I've done this on accident, so I'm going to say it probably can be done on purpose - although writing 2 separate scripts to run simultaneously on the same smart (and knowing which smart to connect to if you run multiple smarts at once) seems overly difficult for that, when all you need to do is key_down the arrow keys and key_up the arrows after you finish with the mouse.

Goobs

2014-12-04 13:34:26

Yup, I did that now :) If you want it, here it is:

program ConcurrentAntiban;

{$DEFINE SMART8}
{$I SRL-OSR/SRL.Simba}
var
KeyTimer, RandTime: Integer;

procedure doInventoryThings;
var
i: Integer;
begin
//Whatever the hell you want here
for i := 1 to 28 do
MouseItem(i, Mouse_Left);
//wait(randomrange(235, 1000));
end;

procedure AntiBan(HumanCompass: Boolean);
begin
if(HumanCompass and ((KeyTimer = 0) or (TimeFromMark(KeyTimer) >= RandTime))) then
begin
MarkTime(KeyTimer);
RandTime := randomrange(465, 2100) + randomrange(-465, 764);
case randomrange(0, 4) of
0:begin //Left
if(IsKeyDown(39)) then
KeyUp(39);
KeyDown(37);
WriteLN('Left arrow');
end;
1:begin //Right
if(IsKeyDown(37)) then
KeyUp(37);
KeyDown(39);
WriteLN('Right arrow');
end;
2..4:begin //Neither, or make it so
if(IsKeyDown(37)) then
KeyUp(37);
if(IsKeyDown(39)) then
KeyUp(39);
end;

end;
case randomrange(0, 4) of
0:begin //Down
if(IsKeyDown(38)) then
KeyUp(38);
KeyDown(40);
WriteLN('Down arrow');
end;
1:begin //Up
if(IsKeyDown(40)) then
KeyUp(40);
KeyDown(38);
WriteLN('Up arrow');
end;
2..4:begin //Neither, or make it so
if(IsKeyDown(38)) then
KeyUp(38);
if(IsKeyDown(40)) then
KeyUp(40);
end;
end;
end;
end;

begin
SetupSRL;
repeat
doInventoryThings;
AntiBan(True);
until(false);
end.

Brandon

2014-12-04 17:08:33

Or you can just use libThread by @Dgby; or libNative by myself. I'd go with Dgby's as it is pascal and integrates with Simba nicely.

What are these libs? They are multi-threading libraries for Simba. You'll of course need to know how to multi-thread PROPERLY & safely.

See: https://villavu.com/forum/showthread.php?t=109447

Dgby714

2014-12-04 23:30:37

From: Brandon
Or you can just use libThread by @Dgby; or libNative by myself. I'd go with Dgby's as it is pascal and integrates with Simba nicely.

What are these libs? They are multi-threading libraries for Simba. You'll of course need to know how to multi-thread PROPERLY & safely.

See: https://villavu.com/forum/showthread.php?t=109447


Just pushed a new version with the exports fixed, should work in recent Simbas.

Olly

2014-12-04 23:42:17

From: Dgby714
I still need to recompile libThread because Olly decided it was a good idea to just add his version to Simba and export something my library exports.


Nop, cynics version.. (Which was in pascalscript).