don't know how to phrase this whatsoever, but is there a way i can get simba to turn off my laptop once the script has failed, this would be handy for overnight botting
don't know how to phrase this whatsoever, but is there a way i can get simba to turn off my laptop once the script has failed, this would be handy for overnight botting
Im not sure about simba being able to do that but there is a program you can download on the web which you can program it to turn off your computer at a certain time.
Then it makes a countdown timer.
Unlucky for you, I forgot what's it called but it's a black icon program and its for windows.
i suppose i could use a shutdown timer that shutdowns once memory usage drops below a certain amount. i know this is possible
Create a bat which shutdowns your computer.
Google it.
Simply a GOD beast...
My Tutorials
This is what I used since I have windows Vista.
Not sure if this is were i got it from but it was legit and virus free.
http://www.vistashutdowntimer.toflo.de/
Could you do this?
Simba Code:Repeat
DoStuff;
MoreStuff;
Until(Not LoggedIn);
If ( Not LoggedIn) then
begin
OpenFile("Shutdown.batDirectory");
end;
end;
You would have to make A shutdown.Bat file for it to open.
Now i'm not sure if that's what "OpenFile" actually does in Simba but it's a thought...
From harry
Simba Code://-----------------------------------------------------------------\\
{ ShutDownPC - Shuts down your computer (Do'h?) ||
{ By: Jahuro / Edit by Hy71194 ||
\\-----------------------------------------------------------------//}
procedure ShutDownPC;
begin
if (ShutDownYourPC = False) then
TerminateScript;
if ShutDownYourPC then
begin
WriteLn('');
WriteLn('Shutting down your PC.');
WriteLn('To stop it once it starts counting, go to Start, Run, then type ''shutdown -a''');
Wait(2000);
KeyDown(92);
Wait(200);
KeyDown(82);
Wait(200);
KeyUp(82);
Wait(200);
KeyUp(92);
Wait(2000);
SendKeys('shutdown -s -f -t 80 -c "Thank you for using Hy71194s Fight Caver. '+TimeRunning+'"');
Wait(2000);
KeyDown(13);
Wait(200);
KeyUp(13);
Wait(160000);
SaveDebug;
TerminateScript;
end;
end;
Oh Hai Dar
I used to use this back in the day, give it a test.
SCAR Code:procedure ShutDownPC;
begin
KeyDown(92);
wait(200);
KeyDown(82);
wait(200);
KeyUp(82);
wait(200);
KeyUp(92);
wait(200);
Sendkeys('shutdown -s -f -t 00'+chr(13), 100);
end;
Old thread: http://villavu.com/forum/showthread.php?t=19246
You must have API calls enabled in Settings->Interpreter.
SCAR Code:program Shutdown;
procedure ExitWindowsEx(flags, reason : Integer); external 'ExitWindowsEx@user32.dll stdcall';
begin
ExitWindowsEx(8, 0);
end.
Last edited by ShawnjohnSJ; 04-27-2012 at 08:22 AM.
This works for me on Windows, no idea if it works on Linux though:
pascal Code:library ShutdownPlugin;
{$mode objfpc}{$H+}
uses
Classes, Process, SysUtils;
{$R *.res}
procedure Shutdown; register;
var
Process: TProcess;
begin
Process := TProcess.Create(nil);
{$ifdef Win32}
Process.CommandLine := 'shutdown -s';
{$endif}
{$ifdef Linux}
Process.CommandLine := 'sudo shutdown -h now';
{$endif}
Process.Execute;
Process.Free;
end;
function GetFunctionCount: Integer; stdcall; export;
begin
Result := 1;
end;
function GetFunctionCallingConv(X: Integer): Integer; stdcall; export;
begin
Result := 0;
if X = 0 then
Result := 1;
end;
function GetFunctionInfo(X: Integer; var ProcAddr: Pointer; var ProcDef: PChar): Integer; stdcall; export;
begin
if X = 0 then begin
ProcAddr := @Shutdown;
StrPCopy(ProcDef, 'procedure Shutdown;');
end else
X := -1;
Result := X;
end;
exports GetFunctionCount;
exports GetFunctionInfo;
exports GetFunctionCallingConv;
begin
end.
Simba Code:program new;
{$loadlib ShutdownPlugin}
begin
Shutdown;
end.
shizz thanks for all the options, but i also want to put it into the script so it turns off only once the script has stopped, sorry to be such a pain but i reckon a lot of u are finding this interesting and maybe a bit of a challenge
post your mainloop, we can tell you where to call the shutdown procedure.
its not really for any script particular- YET
but lets say i wanted to use it in methdwarfminer:
can't see the main loop :S <-ima noob get over itSimba Code:tprogram MethDwarfMiner;
{$define SMART}
{$i srl/srl.simba}
var
numOre, numGems, numLoads, ORE_DTM, GEM_DTM, tempMX, tempMY:integer;
const
SRLStats_Username = 'Anonymous';
SRLStats_Password = 'anon1337';
LOADS = 100; //How many loads per player
DROP_GEMS = False; //Set to true to drop gems, leave false to bank
PICKAXE_EQUIPPED = True; // Set to false if pickaxe is in your inventory
BETA_MINING = False; // Set to true to use a potentially faster, but buggier mining method
procedure DeclarePlayers;
begin
HowManyPlayers := 1; // Change Accordingly
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; // Username
Players[0].Pass := ''; // Password
Players[0].Nick := ''; // 4 lowercase letters from your character name
Players[0].Active := True;
{
Players[1].Name := '';
Players[1].Pass := '';
Players[1].Nick := '';
Players[1].Active := True;
Players[2].Name := '';
Players[2].Pass := '';
Players[2].Nick := '';
Players[2].Active := True;
}
end;
(* ******************************************************************************
CREDIT TO Mayazcherquoi on IRC / Daniel on Forums
Finds multiple instances of colour, spiralling outwards from (cx, cy). Returns
only points that are not within the bounds of any of the multiple TBox's
specified in parametre, SkipBoxArray.
- by Daniel
****************************************************************************** *)
function FindColorsSpiralToleranceSkipBoxArray(const cx, cy: Integer; var Points: TPointArray; const Colour, x1, y1, x2, y2, Tolerance: Integer; SkipBoxArray: TBoxArray): Boolean;
var
I, arrLen: Integer; { Go through Points array }
sI, sArrLen: Integer; { Go through SkipBoxArray }
addCnt: Integer; { Additions count }
canAdd: Boolean; { Can add to array? }
tempPoints: TPointArray;
begin
Result := FindColorsSpiralTolerance(cx, cy, tempPoints, Colour, x1, y1, x2, y2, Tolerance);
if(not(Result)) then
Exit;
arrLen := High(tempPoints);
SetArrayLength(Points, arrLen + 1);
addCnt := 0;
sArrLen := High(SkipBoxArray);
for I := 0 to arrLen do
begin
canAdd := True;
for sI := 0 to sArrLen do
begin
if(InRange(tempPoints[I].X, SkipBoxArray[sI].X1, SkipBoxArray[sI].X2) and
InRange(tempPoints[I].Y, SkipBoxArray[sI].Y1, SkipBoxArray[sI].Y2)) then
begin
canAdd := False;
Break;
end;
end;
if(canAdd) then
begin
Points[addCnt] := tempPoints[I];
Inc(addCnt);
end;
end;
end;
function FindColorSpiralToleranceSkipBoxArray(var x, y: Integer; const cx, cy: Integer; const Colour, x1, y1, x2, y2, Tolerance: Integer; SkipBoxArray: TBoxArray): Boolean;
var
tempPoints: TPointArray;
begin
Result := FindColorsSpiralToleranceSkipBoxArray(cx, cy, tempPoints, Colour, x1, y1, x2, y2, Tolerance, SkipBoxArray);
Result := (Length(tempPoints) > 0);
if(not(Result)) then
Exit;
x := tempPoints[0].x;
y := tempPoints[0].y;
end;
function FindColorSpiralToleranceSkipBox(var x, y: Integer; const cx, cy: Integer; const Colour, x1, y1, x2, y2, Tolerance: Integer; SkipBox: TBox): Boolean;
begin
Result := FindColorSpiralToleranceSkipBoxArray(x, y, cx, cy, Colour, x1, y1, x2, y2, Tolerance, [SkipBox]);
end;
(* ******************************************************************************
End of code that isn't mine
****************************************************************************** *)
procedure AntiBan;
begin
if(not(LoggedIn)) then
Exit;
If FindNormalRandoms Then
begin
Players[CurrentPlayer].Active := False;
numLoads := 0;
NextPlayer(Players[CurrentPlayer].Active);
Exit;
end;
case Random(80) of
10: RandomRClick;
20: HoverSkill('Mining', False);
30: PickUpMouse;
40: RandomMovement;
50: BoredHuman;
59: ExamineInv;
end;
end;
procedure WalkToBank(atCoal:Boolean);
begin
MakeCompass(0);
wait(1000 + random(666));
if (atCoal) then
begin
RadialWalkTolerance(9931140, 264, 300, 70, 0, 1, 18);
wait(500 + random(227));
end;
RadialWalkTolerance(6778480, 285, 250, 62, 1, 0, 13);
wait(1000 + random(666));
end;
procedure WalkToCoal(atBank:Boolean);
begin
if (atBank) then
begin
RadialWalkTolerance(9931140, 106, 70, 50, 0, 0, 18);
wait(500 + random(227));
end;
RadialWalkTolerance(4808039, 84, 105, 67, -1, 0, 15);
wait(1000 + random(666));
end;
function isMining:Boolean;
var
Box: TBox;
begin
Box := IntToBox(245, 130, 285, 195);
Result := (AveragePixelShift(Box, 250, 500) > 260);
end;
function FindBox(open:Boolean):Boolean;
var
x, y, CTS: Integer;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.14, 0.58);
while (FindColorSpiralTolerance(x, y, 6653850, MSX1, MSY1, MSX2, MSY2, 3)) do
begin
MMouse(x, y, 2, 2);
if IsUpText('posit') then
begin
if (open) then
begin
Mouse(x, y, 2, 2, mouse_right);
end;
Result := True;
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);
exit;
end;
end;
Result := False;
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;
function FindOre(mine, moveMouse:Boolean):Boolean;
var
x, y, CTS: Integer;
skipOre: TBox;
pointsA: TPointArray;
begin
skipOre := IntToBox(tempMX - 30, tempMY - 30, tempMX + 30, tempMY + 30);
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.00, 0.23);
FindColorsSpiralTolerance(x, y, pointsA, 1776668, MSX1, MSY1, MSX2, MSY2, 4)
//while (FindColorSpiralTolerance(x, y, 1776668, MSX1, MSY1, MSX2, MSY2, 4)) do
while (FindColorSpiralToleranceSkipBox(x, y, MSCX, MSCY, 1776668, MSX1 + 10, MSY1 + 10, MSX2, MSY2, 4, skipOre)) do
begin
if (moveMouse) then
MMouse(x, y, 2, 2);
if (IsUpText('ine') or OptionsExist(['ine'], False)) then
begin
Result := True;
if (mine) then
begin
Mouse(x, y, 2, 2, mouse_right);
end;
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);
exit;
end;
end;
Result := False;
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;
procedure FindOreSpot(x, y: Integer);
var
direction, yTrigPoint, xTrigPoint: Integer;
begin
yTrigPoint := (iAbs(256 - x));
if ((x >= MSCX) and (x <= (MSCX + 167))) then
begin
if (y > (MSCY + yTrigPoint)) then
direction := 3
else if (y < (MSCY - yTrigPoint)) then
direction := 1
else
direction := 0
end else if ((x <= MSCX) and (x > (MSCX - 167))) then
begin
if (y > (MSCY + yTrigPoint)) then
direction := 3
else if (y < (MSCY - yTrigPoint)) then
direction := 1
else
direction := 2
end else if (x > (MSCX + 167)) then
direction := 0
else if (x < (MSCX - 167)) then
direction := 2;
case direction of
0:
begin
x := (MSCX + 40);
y := (MSCY);
end;
1:
begin
x := (MSCX);
y := (MSCY - 40);
end;
2:
begin
x := (MSCX - 40);
y := (MSCY);
end;
3:
begin
x := (MSCX);
y := (MSCY + 40);
end;
end;
tempMX := x;
tempMY := y;
end;
procedure MineOre;
var
i, x, y, prevMX, prevMY: Integer;
begin
while (not InvFull) do
begin
If FindNormalRandoms Then
begin
Players[CurrentPlayer].Active := False;
numLoads := 0;
NextPlayer(Players[CurrentPlayer].Active);
Exit;
end;
if (BETA_MINING) then
begin
if ((FindOre(true, true)) and (not InvFull)) then
begin
while ((FindOre(false, false)) and (not InvFull)) do
begin
while ((OptionsExist(['ine'], False)) and (not InvFull)) do
begin
GetMousePos(prevMX, prevMY);
FindOreSpot(prevMX, prevMY);
ChooseOption('ine');
wait(random(300));
AntiBan;
repeat
wait(random(200));
until (not isMoving)
FindOre(True, True);
//while (MouseTooClose(tempMX, tempMY)) do
while (not OptionsExist(['ine'], False)) do
begin
FindOre(True, True);
end;
repeat
wait(random(100));
until (not isMining);
end;
if (OptionsExist(['ancel'], false)) then
ChooseOption('ancel');
FindOre(True, True);
end;
end;
end else
begin
if FindOre(True, True) then
begin
ChooseOption('ine');
wait(random(200));
AntiBan;
repeat
wait(random(500));
until (not isMining);
end;
end;
if (not InvFull) then
begin
i := i + 1;
if (i = 20) then
begin
i := 0;
if FindBox(False) then
begin
WalkToCoal(True);
end else
begin
WalkToCoal(False);
end;
end;
end;
end;
if (DROP_GEMS) then
begin
while (FindDTM(GEM_DTM, x, y, MIX1, MIY1, MIX2, MIY2)) do
begin
Mouse(x, y, 2, 2, mouse_right);
ChooseOption('rop');
end;
end;
If (Not InvFull) then
begin
MineOre;
end;
end;
procedure DepositOre;
var i, j, d, o, g: integer;
begin
d := 0;
i := 0;
j := 0;
g := CountItems('dtm', GEM_DTM, []);
o := CountItems('dtm', ORE_DTM, []);
repeat
If FindNormalRandoms Then
begin
Players[CurrentPlayer].Active := False;
numLoads := 0;
NextPlayer(Players[CurrentPlayer].Active);
Exit;
end;
if FindBox(False) then
begin
FindBox(True);
ChooseOption('posit');
while ((not DepositScreen) and (j < 20)) do
begin
wait(random(500));
j := j + 1;
end;
if (DepositScreen) then
begin
if (PICKAXE_EQUIPPED) then
begin
QuickDeposit(SRL_DEPOSIT_ALL);
d := 1;
end else
begin
Deposit(2, 28, True);
d := 1;
end;
numOre := numOre + o;
numGems := numGems + g;
numLoads := numLoads + 1;
stats_IncVariable('Loads Done', 1);
stats_IncVariable('Coal Ore (Mined)', o);
stats_IncVariable('Gems (Mined)', g);
end;
if (j >= 20) then
begin
j := 0
end;
end else
begin
i := i + 1;
end;
if (i = 10) then
begin
i := 0;
MakeCompass(90);
end;
until (d = 1);
MakeCompass(0);
wait(1000 + random(750));
end;
procedure CheckAtStart;
begin
if (FindBox(False)) then
begin
WalkToCoal(True);
end;
if not (FindOre(False, True)) then
begin;
WalkToCoal(False);
end;
end;
procedure ProgReport;
begin
Stats_Commit;
Writeln(' ');
Writeln(' Methrends Dwarf Coal Miner ');
Writeln(' Running For: ' + TimeRunning);
Writeln(' Total Ores Deposited: ' + IntToStr(numOre));
If (DROP_GEMS = False) then
Writeln(' Total Gems Deposited: ' + IntToStr(numGems));
Writeln(' ');
end;
begin
Smart_Server := 30;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
ClearDebug;
SetupSRL;
SetupSRLStats(439, SRLStats_Username, SRLStats_Password);
DeclarePlayers;
ORE_DTM := DTMFromString('mggAAAHicY2NgYHBmYWCwg+IgIDYCYl8gPgKU2wrEl4B4PxCfAOLTQKyiLA0kmTDwfwbsgBEHhgAAwY8HvQ==');
GEM_DTM := DTMFromString('mAAEAAHic42FgYJjBxMCwEIjnA/ECKJ4LxJOAuAeIu4F4KhD3Q/lljBBcBMRVQFwHxA1AXA/ElVDxLCDOBuJcIBYQKgDawkQ0/s9AGmAkESMDAEPLDnQ=');
while (not (AllPlayersInactive)) do
begin
if not LoggedIn then
LoginPlayer;
while(not LoggedIn) do
wait(1000);
MakeCompass(0);
SetAngle(SRL_ANGLE_HIGH);
tempMX := MSCX;
tempMY := MSCY;
while(LoggedIn) do
begin
CheckAtStart;
MineOre;
AntiBan;
WalkToBank(True);
AntiBan;
DepositOre;
ProgReport;
WalkToCoal(True);
if ((numLoads = LOADS) and (length(Players) > 1 )) then
begin
numLoads := 0;
NextPlayer(Players[CurrentPlayer].Active);
end;
end;
end;
end.![]()
Last edited by The Killer; 04-27-2012 at 05:35 PM.
Just do something like:
Simba Code:function ActivePlayers: Boolean;
var
I: Integer;
begin
Result := False;
for I := 0 to High(Players) do
if Players[I].Active then
Result := True;
end;
begin
//mainloop stuff
if not ActivePlayers then
Shutdown;
end.
i have though about this myself quite a few time i curentley use
"Advanced SystemCare Free 5" (if you download make sure you get it from a safe site)
in the toold program it had a nice auto shutdown computer at set time
Learning To Code - So Excuse the n00b questions!
Ktimer can watch processes running on your comp and either shutdown, sleep, hibernate, or notify when the process stops running amoung others. Now if there was a way for SMART manager to close simba when a script has finished running, you can set KTimer to watch simba.exe and when it closes it will do one of the options you have chosen.
Here is a link to download the timer: http://www.softpedia.com/progDownloa...ad-177190.html
SMART manager could be found here: http://villavu.com/forum/showthread.php?t=76404. I will go ahead and post this suggestion on the thread and hopefully in the near future, this can be implemented into the program
Last edited by Recursive; 04-28-2012 at 12:06 AM.
I posted code that should shutdown your computer, it would be nice to know if it works or not...
Last edited by ShawnjohnSJ; 04-28-2012 at 03:30 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)