SRL Archive - Jr. Member General Help and Discussion

Best way to run a script on 2 accounts at the same time?


Thomas

2015-04-13 03:42:32

Hey,

Is it at all possible to run 2 smart clients on a single simba?
I was kinda hoping it would be possible thanks to the player form, but when I select 2 players from the form only 1 client spawns with 1 of the accounts from the form?

Perhaps my script isn't setup properly? (Currently updating the login/setup procedures with a little help from bonsai's basic fighter)

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

var
vialCount, vialsPH, wellCount: integer;
timer: TTimeMarker;
welltimer: TTimeMarker;
progressTimer: TTimemarker;

const
timeOut = 20000;

procedure declareplayers();
var
i: integer;
begin
players.setup(playerForm.players);
currentPlayer := 0;
for i := 0 to high(players) do
with players[i] do
begin
World := strToInt(playerForm.players[i].settings[0]);
ismember := true;
booleans[0] := strToBool(playerForm.players[i].settings[1]);
end;
end;

procedure initPlayerForm();
begin
with playerForm do
begin
name := 'Vials';
editBoxLabels := ['World'];
editBoxDefaults := ['124'];
checkBoxLabels := ['Placewell'];
checkBoxDefaults := ['True'];
end;
end;

procedure findNormalrandoms;
begin
exitSquealOfFortune;
ClaimSpinTicket;
closePollWindow();
if not (bankScreen.isOpen()) then
closepopup();
tabBackpack.Open;
end;

procedure afk(duration: integer);
begin
if duration = 1 then
wait(gaussRangeInt(50, 160))
else
wait(gaussRangeInt(1100, 2200));
end;

procedure setCamera;
begin
minimap.clickCompass;
afk(2);
mainScreen.setAngle(MS_ANGLE_HIGH);
afk(2);
mainscreen.setZoom(true);
end;

function loginCheck(): boolean;
begin
if isLoggedIn() then
exit(true);
if not players[currentPlayer].login() then
exit(false);
findNormalrandoms;
mouseSpeed := 35;
setCamera;
exit(true);
end;



procedure antiban;
var
i: integer;
begin
i := random(2000);
case i of
1..3:
begin
hoverRandomSkill();
end;
4..40: mouseMovingObject;
41..60: sleepAndMoveMouse(randomRange(100, 2000));
61..120:
begin
mouseOffClient(4);
afk(2);
end;
121..140: afk(1);
141..200: randomMouseSpeed(2, 30, 40);
end;
end;

procedure progressReport;
begin
vialsPH := round((vialCount * (3600.0 / (getTimeRunning / 1000.0))));
writeln(padR('Running For: ' + timeRunning, 60));
writeln(padR('Vials: ' + groupDigits(vialCount, ','), 37) + padR('Vials/H: ' + groupDigits(vialsPH, ','), 23));
if players[currentPlayer].booleans[0] then
writeln(padR('Wells placed: ' + groupDigits(wellCount, ','), 37));
progressTimer.start;
end;

function banking(preset: integer): boolean;
var
button: integer;
backpackResult: boolean;
begin
if not isLoggedIn then
exit;
timer.start;
if preset = 1 then
button := BANK_BUTTON_PRESET_1
else
button := BANK_BUTTON_PRESET_2;
begin
repeat
if bankscreen.open(BANK_CHEST_BARB_OUTPOST) then
break
else
setCamera;
if (timer.getTime > timeOut) or (not isLoggedIn) then
exit;
until (bankScreen.isOpen(2000) or pinscreen.isOpen);
pinScreen.Enter(players[currentPlayer].bankPin);
repeat
if bankScreen.clickButton(button) then
break;
if (timer.getTime > timeOut) or (not isLoggedIn) then
exit;
until (not bankScreen.isOpen);
end;
result := true;
end;

function findPortable: boolean;
var
i, x, y: integer;
portTPA: TPointArray;
portATPA: T2DPointArray;
begin
if not isLoggedIn() then
exit;
findColorsSpiralTolerance(x, y, portTPA, 3031949, mainScreen.getBounds(), 10, colorSetting(2, 0.3, 1.7));
if length(portTPA) < 1 then
exit;
portATPA := portTPA.toATPA(35, 35);
portATPA.filterBetween(0, 20);
portATPA.sortFromSize(25, true);
if length(portATPA) < 1 then
exit;
smartImage.debugATPA(portATPA);
for i := 0 to high(portATPA) do
begin
middleTPAEx(portATPA[i], x, y);
mouse(x, y, 10, 11, MOUSE_MOVE);
if isMouseOverText(['well', 'ortab'], 2500) then
begin
result := true;
portATPA := [];
exit;
end;
end;
portATPA := [];
end;

function renewPortable: boolean;
var
x, y: integer;
begin
if not isLoggedIn() then
exit;
writeln('Renewing Portable');
afk(2);
sendKeys('w', 200, 40);
if conversationBox.isOpen(5500) then
begin
conversationBox.selectOption(1);
wellCount := wellCount + 1;
afk(2);
end;
if findPortable then
result := true;
end;

function getVials: boolean;
var
time, x, y, amount: integer;
begin
if not isLoggedIn then
exit;
tabBackpack.Open;
timer.start;
amount := gaussRangeInt(30, 36);
if not tabBackpack.isEmpty then
exit
else
begin
repeat
if isMouseOverText(['well', 'ortab'], 3300) then
fastClick(MOUSE_RIGHT);
if (chooseOption.isOpen(5500)) then
chooseOption.select(['ake vials', 'vials', 'vial'], 2200);
if (not isLoggedIn) or (timer.getTime > timeOut) or (not tabBackpack.isEmpty) then
exit;
until bankScreen._enterAmount(amount, 5500);
repeat
afk(1);
if (not isLoggedIn) or (timer.getTime > timeOut) then
exit;
until tabBackpack.isFull;
vialCount := vialCount + 28;
result := true;
end;
end;

procedure waitPortable;
begin
welltimer.start;
repeat
antiban;
if (not isLoggedIn) then
exit;
if (welltimer.getTime > 120000) then
begin
writeln('No new well found in 2 minutes, terminating script');
players[currentPlayer].logout;
terminateScript;
end;
until findPortable;
end;

procedure setup;
begin
disableSRLLog := true;
initPlayerForm();
runPlayerForm();
if (not playerForm.isScriptReady) then
terminatescript;
declareplayers();
smartShowConsole := false;
disableSRLDebug := true;
smartEnableDrawing := true;
setupSRL;
end;

procedure mainloop;
var
i: integer;
nowell: integer;
begin
while findPortable do
begin
findNormalrandoms;
if tabBackpack.isEmpty and getVials then
begin
findNormalrandoms;
if banking(1) and tabBackpack.isEmpty then
begin
findNormalrandoms;
if (progressTimer.getTime > 60000) then
progressReport;
antiban;
end;
end;
end;
while (not findPortable) do
begin
findNormalrandoms;
if players[currentPlayer].booleans[0] then
begin
if banking(2) and tabBackpack.isEmpty then
inc(nowell);
if (nowell = 4) then
begin
writeln('Failed withdrawing, shutting down');
players[currentPlayer].logout;
terminateScript;
end;
if tabBackpack.isItemInSlot(1) then
begin
findNormalrandoms;
if renewPortable then
writeLn('renewed portable');
end
end
else
waitPortable;
end;
end;

begin
setup;
while loginCheck() do
mainloop;
end.

Renzanity

2015-04-13 03:57:07

To me, I just make a copy of the script that I want to run and then run them both with Simba. If you want to run both of the accounts in the same world, then I think you'll have to run one of the clients on a different IP address. Not sure if I understood you correctly though.:p

Thomas

2015-04-13 04:03:07

From: renzanity
To me, I just make a copy of the script that I want to run and then run them both with Simba. If you want to run both of the accounts in the same world, then I think you'll have to run one of the clients on a different IP address. Not sure if I understood you correctly though.:p


2 accounts on same world is easy! Look for the random.dat file in one of the runescape cache/settings folders and make it read only.

Renzanity

2015-04-13 04:06:38

From: lovebotter
2 accounts on same world is easy! Look for the random.dat file in one of the runescape cache/settings folders and make it read only.


Thanks pal! #toonoobtoknowthesesimplestuff

J_R

2015-04-13 15:37:35

From: lovebotter
Hey,

Is it at all possible to run 2 smart clients on a single simba?
I was kinda hoping it would be possible thanks to the player form, but when I select 2 players from the form only 1 client spawns with 1 of the accounts from the form?

Perhaps my script isn't setup properly? (Currently updating the login/setup procedures with a little help from bonsai's basic fighter)

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

var
vialCount, vialsPH, wellCount: integer;
timer: TTimeMarker;
welltimer: TTimeMarker;
progressTimer: TTimemarker;

const
timeOut = 20000;

procedure declareplayers();
var
i: integer;
begin
players.setup(playerForm.players);
currentPlayer := 0;
for i := 0 to high(players) do
with players[i] do
begin
World := strToInt(playerForm.players[i].settings[0]);
ismember := true;
booleans[0] := strToBool(playerForm.players[i].settings[1]);
end;
end;

procedure initPlayerForm();
begin
with playerForm do
begin
name := 'Vials';
editBoxLabels := ['World'];
editBoxDefaults := ['124'];
checkBoxLabels := ['Placewell'];
checkBoxDefaults := ['True'];
end;
end;

procedure findNormalrandoms;
begin
exitSquealOfFortune;
ClaimSpinTicket;
closePollWindow();
if not (bankScreen.isOpen()) then
closepopup();
tabBackpack.Open;
end;

procedure afk(duration: integer);
begin
if duration = 1 then
wait(gaussRangeInt(50, 160))
else
wait(gaussRangeInt(1100, 2200));
end;

procedure setCamera;
begin
minimap.clickCompass;
afk(2);
mainScreen.setAngle(MS_ANGLE_HIGH);
afk(2);
mainscreen.setZoom(true);
end;

function loginCheck(): boolean;
begin
if isLoggedIn() then
exit(true);
if not players[currentPlayer].login() then
exit(false);
findNormalrandoms;
mouseSpeed := 35;
setCamera;
exit(true);
end;



procedure antiban;
var
i: integer;
begin
i := random(2000);
case i of
1..3:
begin
hoverRandomSkill();
end;
4..40: mouseMovingObject;
41..60: sleepAndMoveMouse(randomRange(100, 2000));
61..120:
begin
mouseOffClient(4);
afk(2);
end;
121..140: afk(1);
141..200: randomMouseSpeed(2, 30, 40);
end;
end;

procedure progressReport;
begin
vialsPH := round((vialCount * (3600.0 / (getTimeRunning / 1000.0))));
writeln(padR('Running For: ' + timeRunning, 60));
writeln(padR('Vials: ' + groupDigits(vialCount, ','), 37) + padR('Vials/H: ' + groupDigits(vialsPH, ','), 23));
if players[currentPlayer].booleans[0] then
writeln(padR('Wells placed: ' + groupDigits(wellCount, ','), 37));
progressTimer.start;
end;

function banking(preset: integer): boolean;
var
button: integer;
backpackResult: boolean;
begin
if not isLoggedIn then
exit;
timer.start;
if preset = 1 then
button := BANK_BUTTON_PRESET_1
else
button := BANK_BUTTON_PRESET_2;
begin
repeat
if bankscreen.open(BANK_CHEST_BARB_OUTPOST) then
break
else
setCamera;
if (timer.getTime > timeOut) or (not isLoggedIn) then
exit;
until (bankScreen.isOpen(2000) or pinscreen.isOpen);
pinScreen.Enter(players[currentPlayer].bankPin);
repeat
if bankScreen.clickButton(button) then
break;
if (timer.getTime > timeOut) or (not isLoggedIn) then
exit;
until (not bankScreen.isOpen);
end;
result := true;
end;

function findPortable: boolean;
var
i, x, y: integer;
portTPA: TPointArray;
portATPA: T2DPointArray;
begin
if not isLoggedIn() then
exit;
findColorsSpiralTolerance(x, y, portTPA, 3031949, mainScreen.getBounds(), 10, colorSetting(2, 0.3, 1.7));
if length(portTPA) < 1 then
exit;
portATPA := portTPA.toATPA(35, 35);
portATPA.filterBetween(0, 20);
portATPA.sortFromSize(25, true);
if length(portATPA) < 1 then
exit;
smartImage.debugATPA(portATPA);
for i := 0 to high(portATPA) do
begin
middleTPAEx(portATPA[i], x, y);
mouse(x, y, 10, 11, MOUSE_MOVE);
if isMouseOverText(['well', 'ortab'], 2500) then
begin
result := true;
portATPA := [];
exit;
end;
end;
portATPA := [];
end;

function renewPortable: boolean;
var
x, y: integer;
begin
if not isLoggedIn() then
exit;
writeln('Renewing Portable');
afk(2);
sendKeys('w', 200, 40);
if conversationBox.isOpen(5500) then
begin
conversationBox.selectOption(1);
wellCount := wellCount + 1;
afk(2);
end;
if findPortable then
result := true;
end;

function getVials: boolean;
var
time, x, y, amount: integer;
begin
if not isLoggedIn then
exit;
tabBackpack.Open;
timer.start;
amount := gaussRangeInt(30, 36);
if not tabBackpack.isEmpty then
exit
else
begin
repeat
if isMouseOverText(['well', 'ortab'], 3300) then
fastClick(MOUSE_RIGHT);
if (chooseOption.isOpen(5500)) then
chooseOption.select(['ake vials', 'vials', 'vial'], 2200);
if (not isLoggedIn) or (timer.getTime > timeOut) or (not tabBackpack.isEmpty) then
exit;
until bankScreen._enterAmount(amount, 5500);
repeat
afk(1);
if (not isLoggedIn) or (timer.getTime > timeOut) then
exit;
until tabBackpack.isFull;
vialCount := vialCount + 28;
result := true;
end;
end;

procedure waitPortable;
begin
welltimer.start;
repeat
antiban;
if (not isLoggedIn) then
exit;
if (welltimer.getTime > 120000) then
begin
writeln('No new well found in 2 minutes, terminating script');
players[currentPlayer].logout;
terminateScript;
end;
until findPortable;
end;

procedure setup;
begin
disableSRLLog := true;
initPlayerForm();
runPlayerForm();
if (not playerForm.isScriptReady) then
terminatescript;
declareplayers();
smartShowConsole := false;
disableSRLDebug := true;
smartEnableDrawing := true;
setupSRL;
end;

procedure mainloop;
var
i: integer;
nowell: integer;
begin
while findPortable do
begin
findNormalrandoms;
if tabBackpack.isEmpty and getVials then
begin
findNormalrandoms;
if banking(1) and tabBackpack.isEmpty then
begin
findNormalrandoms;
if (progressTimer.getTime > 60000) then
progressReport;
antiban;
end;
end;
end;
while (not findPortable) do
begin
findNormalrandoms;
if players[currentPlayer].booleans[0] then
begin
if banking(2) and tabBackpack.isEmpty then
inc(nowell);
if (nowell = 4) then
begin
writeln('Failed withdrawing, shutting down');
players[currentPlayer].logout;
terminateScript;
end;
if tabBackpack.isItemInSlot(1) then
begin
findNormalrandoms;
if renewPortable then
writeLn('renewed portable');
end
end
else
waitPortable;
end;
end;

begin
setup;
while loginCheck() do
mainloop;
end.


Simba's "multi-player" is (as far as I know) meant to run multiple accounts after each other, not at the same time.

KeepBotting

2015-04-13 16:14:15

From: J_R
Simba's "multi-player" is (as far as I know) meant to run multiple accounts after each other, not at the same time.


This is correct. Multiplayer is handled by players.simba, which contains routines that will mark an account as inactive, log it out, mark the next one as active, log it in, and continue the script.

In short, it runs multiple accounts, but runs them sequentially, in succession.

I believe this started when MSI Phoenix was in development, and has carried over through the various revisions of the SRL include.

Turpinator

2015-04-13 16:22:18

Just open 2 script tabs in simba and hit run twice…

KeepBotting

2015-04-13 16:27:04

From: Turpinator
Just open 2 script tabs in simba and hit run twice…


I'm sure OP knows that. His question was more along the lines of: why does adding more than one player through the SRL player form not precipitate concurrent sessions of the script, one per player?

I can see how one could draw the conslusion that SRL's multiplayer works in such a fashion (when in reality it is decidedly sequential).

Thomas

2015-04-13 16:50:12

From: J_R
Simba's "multi-player" is (as far as I know) meant to run multiple accounts after each other, not at the same time.


This was the answer I was looking for! Thanks

Turpinator

2015-04-13 23:24:39

From: KeepBotting
I can see how one could draw the conslusion that SRL's multiplayer works in such a fashion (when in reality it is decidedly sequential).


mfw op is really @rj;'s 19th account.