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)
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.