SRL Archive - OSR Script Requests

Superheater Request Part 2


Dog

2014-10-12 21:37:20

Hey guys!

Earlier I requested a superheater script on a different thread: https://villavu.com/forum/showthread.php?t=110517

And a lot of people seemed interested. Knowing that this would be a popular script, I decided to do some digging, and actually found something on this thread: https://villavu.com/forum/showthread.php?t=108760

Voilaa superheater script :thumbsup:


program new;
{$DEFINE SMART8}
{$I SRL-OSR/SRL.Simba}
{$I SRL-OSR\SRL\misc\SmartGraphics.simba}
{$I SRL-OSR/SRL/Reflection/Reflection.simba}

function F_OpenBank: Boolean;
var
Booth: TPoint;
begin
if (not LoggedIn) or (BankScreen) then
Exit;

Booth := R_TileToMS(Point(3186, 3436));
MMouse(Booth.X, Booth.Y, 2, 2);
Sleep(100 + Random(100));
if (R_IsUpText('Bank Ba')) then begin
ClickMouse2(Mouse_Left);
end else begin
ClickMouse2(Mouse_Right);
Sleep(250 + Random(250));
R_ChooseOption('Bank Ba');
end;
Sleep(500 + Random(250));

if (PinScreen) then
InPin(Players[CurrentPlayer].Pin);

Result := WaitFunc(@BankScreen, 250, 2500);
Sleep(1000 + Random(250));
end;

procedure F_CloseBank;
begin
if (not LoggedIn) or (not BankScreen) then
Exit;

MMouse(486, 42, 2, 2);
ClickMouse2(Mouse_Left);
Sleep(250 + Random(250));
end;

function F_WithdrawEx(Col, Row, Amount: Integer; Uptexts: TStringArray): Boolean;
var
BBox: TBox;
X, Y: Integer;
begin
Result := False;
FixBank;
if not bankscreen then
exit;

BBox := BankIndexToMSBox(BankPointToBankIndex(Point(Col, Row)));
BBox := IntToBox(BBox.X1 - 2, BBox.Y1 + 10, BBox.X2 - 2, BBox.Y2 + 3);
GetMousePos(X, Y);
if (not PointInBox(Point(X, Y), BBox)) then
MouseBox(BBox.X1 - 2, BBox.Y1 + 10, BBox.X2 - 2, BBox.Y2 + 3, mouse_move);

if (Length(Uptexts) > 0) then
if (not R_WaitUpTextMulti(Uptexts, 500)) then
Exit;

if (Amount = 1) then
ClickMouse2(mouse_left)
else
ClickMouse2(mouse_right);
if (Amount = 1) then
begin
Result := True;
Wait(RandomRange(250, 550));
Exit;
end;

if (Amount = -1) then
begin
if (WaitOptionMultiEx(['Withdraw-All-but', 'l-b'], 'All', Nothing, 300)) then
Result := R_ChooseOption('Withdraw-All-but');
end else
if (Amount = 0) then
begin
if (WaitOptionMultiEx(['Withdraw-All', 'w-A'], 'All', Nothing, 300)) then
Result := R_ChooseOption('Withdraw-All');
end else
if (WaitOptionMultiEx(['Withdraw-' + IntToStr(Amount) + ' ', 'w-' + IntToStr(Amount) + ' '], 'All', Nothing, 300)) then
Result := R_ChooseOption('Withdraw-' + IntToStr(Amount) + ' ');

if (not (Result)) and (Amount > 0) then
begin
if (not OptionsExist(['Withdraw', 'ithdraw', 'draw'], False)) then
MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, mouse_right);

if WaitOptionMulti(['Withdraw-X', 'w-X', 'X'], 500) then
begin
X := GetSystemTime + 10000;
while (X >= GetSystemTime) and (not (InRange(CountColor(0, 211, 394, 308, 411), 200, 300))) do
Wait(50);
Wait(RandomRange(75, 400));
TypeSend(IntToStr(Amount));
Result := True;
end;
end;
end;

procedure WithdrawOres;
begin
F_OpenBank;
F_WithdrawEx(2, 0, 9, ['Iron ore']);
F_WithdrawEx(1, 0, 0, ['Coal']);
F_CloseBank;
end;

procedure SuperheatBar;
begin
GameTab(tab_Magic);
MMouse(666 + RandomRange(-3, 3), 313 + RandomRange(-3, 3), 2, 2);
Sleep(100 + Random(100));
ClickMouse2(Mouse_Left);
Sleep(100 + Random(100));
InvMouse(10, 1);
Sleep(1000 + Random(250));
end;

procedure Superheat;
var
I: Integer;
begin
for I := 0 to 8 do begin
SuperheatBar;
end;
end;

procedure DepositBars;
begin
F_OpenBank;
Deposit(2, 28, True);
end;

begin
SetupSRL;
SetupReflection;
repeat
WithdrawOres;
Superheat;
DepositBars;
until(False);
end.

I was really excited to find what I had been looking for, but unfortunately the script is quite old, and won't even run. Now that we have a basic script, could a script writer maybe fix this one? Or even better make a new and better script? ;)

I'm sure it would be a great addition to the script library, and with color I see this script running forever. Heck, maybe someone could code this in Aerolib, and make it amazing :spot:

Thanks to whomever decides to take this on :)

Credit:
All credit goes to Frement for making the superheating script attached.

~Dog

Harrier

2014-10-13 11:42:19

Compiled successfully in 484 ms.


How doesn't this work?

Kyle

2014-10-13 11:53:12

From: Dog
….


Well atm reflection hooks are outdated as of a couple hours ago, I'm not home atm to run our updater, so if that is the only problem just remove R_ChooseOption and replace with ChooseOption, and just use srl's banking function it should work.

But @Frement; literally made that in a couple hours, so I wouldn't be surprised if it doesn't work anymore. If you just wait a couple days i'll make you one…

Rlp

2014-10-13 12:20:40

Rather than having a part 2 and two threads why didn't you just add this to your first request?

Dog

2014-10-13 13:01:42

From: Harrier
How doesn't this work?


If you actually run it in game, it has issues removing bars from the bank. But yes, it does compile.

Dog

2014-10-13 13:13:30

From: elfyyy
Well atm reflection hooks are outdated as of a couple hours ago, I'm not home atm to run our updater, so if that is the only problem just remove R_ChooseOption and replace with ChooseOption, and just use srl's banking function it should work.

But @Frement; literally made that in a couple hours, so I wouldn't be surprised if it doesn't work anymore. If you just wait a couple days i'll make you one…


I'd appreciate it if you did :)

Harrier

2014-10-13 13:30:49

From: Dog
If you actually run it in game, it has issues removing bars from the bank. But yes, it does compile.

Set it to hide tab bar

Dog

2014-10-13 13:34:14

From: Harrier
Set it to hide tab bar


I would have to collapse all of my tabs then :/
I'll just wait for @elfyyy to make a new one

Frement

2014-10-13 21:38:04

From: Dog
I would have to collapse all of my tabs then :/
I'll just wait for @elfyyy to make a new one


Runtime: 3 Minutes and 34 Seconds
Bars made: 81

program new;
{$DEFINE SMART8}
{$I SRL-OSR/SRL.Simba}
{$I SRL-OSR\SRL\misc\SmartGraphics.simba}
{$I SRL-OSR/SRL/Reflection/Reflection.simba}

var bars: integer;

function F_BankScreen: Boolean;
begin
Result := (CountColor(2070783, 176, 7, 350, 38) > 200);
end;

function F_OpenBank: Boolean;
var
Booth: TPoint;
begin
if (not LoggedIn) or (F_BankScreen) then
Exit;

Booth := R_TileToMS(Point(3186, 3436));
MMouse(Booth.X, Booth.Y, 2, 2);
Sleep(100 + Random(100));
if (R_IsUpText('Bank Ba')) then begin
ClickMouse2(Mouse_Left);
end else begin
ClickMouse2(Mouse_Right);
Sleep(250 + Random(250));
R_ChooseOption('Bank Ba');
end;
Sleep(500 + Random(250));

if (PinScreen) then
InPin(Players[CurrentPlayer].Pin);

Result := WaitFunc(@F_BankScreen, 250, 2500);
Sleep(1000 + Random(250));
end;

procedure F_CloseBank;
begin
if (not LoggedIn) or (not F_BankScreen) then
Exit;

MMouse(486+randomrange(-2, 2), 25+randomrange(-2, 2), 2, 2);
ClickMouse2(Mouse_Left);
Sleep(250 + Random(250));
end;

function F_WithdrawEx(Col, Row, Amount: Integer; Uptexts: TStringArray): Boolean;
var
BBox: TBox;
X, Y: Integer;
begin
Result := False;
FixBank;
if (not LoggedIn) or (not F_BankScreen) then
exit;

BBox := BankIndexToMSBox(BankPointToBankIndex(Point(Col, Row)));
BBox := IntToBox(BBox.X1 - 2, BBox.Y1 + 30, BBox.X2 - 2, BBox.Y2 + 23);
GetMousePos(X, Y);
if (not PointInBox(Point(X, Y), BBox)) then
MouseBox(BBox.X1 - 2, BBox.Y1 + 10, BBox.X2 - 2, BBox.Y2 + 3, mouse_move);

if (Length(Uptexts) > 0) then
if (not R_WaitUpTextMulti(Uptexts, 500)) then
Exit;

if (Amount = 1) then
ClickMouse2(mouse_left)
else
ClickMouse2(mouse_right);
if (Amount = 1) then
begin
Result := True;
Wait(RandomRange(250, 550));
Exit;
end;

if (Amount = -1) then
begin
if (WaitOptionMultiEx(['Withdraw-All-but', 'l-b'], 'All', Nothing, 300)) then
Result := R_ChooseOption('Withdraw-All-but');
end else
if (Amount = 0) then
begin
if (WaitOptionMultiEx(['Withdraw-All', 'w-A'], 'All', Nothing, 300)) then
Result := R_ChooseOption('Withdraw-All');
end else
if (WaitOptionMultiEx(['Withdraw-' + IntToStr(Amount) + ' ', 'w-' + IntToStr(Amount) + ' '], 'All', Nothing, 300)) then
Result := R_ChooseOption('Withdraw-' + IntToStr(Amount) + ' ');

if (not (Result)) and (Amount > 0) then
begin
if (not OptionsExist(['Withdraw', 'ithdraw', 'draw'], False)) then
MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, mouse_right);

if WaitOptionMulti(['Withdraw-X', 'w-X', 'X'], 500) then
begin
X := GetSystemTime + 10000;
while (X >= GetSystemTime) and (not (InRange(CountColor(0, 211, 394, 308, 411), 200, 300))) do
Wait(50);
Wait(RandomRange(75, 400));
TypeSend(IntToStr(Amount));
Result := True;
end;
end;
end;

procedure WithdrawOres;
begin
F_OpenBank;
F_WithdrawEx(3, 0, 9, ['Iron ore']);
F_WithdrawEx(1, 0, 0, ['Coal']);
F_CloseBank;
end;

procedure SuperheatBar;
begin
GameTab(tab_Magic);
MMouse(666 + RandomRange(-3, 3), 313 + RandomRange(-3, 3), 2, 2);
Sleep(100 + Random(100));
ClickMouse2(Mouse_Left);
Sleep(100 + Random(100));
InvMouse(10, 1);
Sleep(1000 + Random(250));
Inc(bars);
end;

procedure Superheat;
var
I: Integer;
begin
for I := 0 to 26 do begin
SuperheatBar;
end;
end;

procedure DepositBars;
var i: integer;
begin
F_OpenBank;
//Deposit(2, 28, True); SRL-5 Deposit() function doesn't work?
for i := 2 to 28 do begin
if (InvCount > 1) then begin
InvMouse(i, mouse_Right);
sleep(200+random(50));
R_ChooseOption('Deposit-All');
end;
end;
end;

procedure proggy;
begin
writeln('Runtime: ' + timerunning);
writeln('Bars made: ' + tostr(bars));
end;

begin
SetupSRL;
SetupReflection;
repeat
WithdrawOres;
Superheat;
DepositBars;
proggy;
until(False);
end.

Dog

2014-10-14 00:17:54

From: Frement
Runtime: 3 Minutes and 34 Seconds
Bars made: 81

program new;
{$DEFINE SMART8}
{$I SRL-OSR/SRL.Simba}
{$I SRL-OSR\SRL\misc\SmartGraphics.simba}
{$I SRL-OSR/SRL/Reflection/Reflection.simba}

var bars: integer;

function F_BankScreen: Boolean;
begin
Result := (CountColor(2070783, 176, 7, 350, 38) > 200);
end;

function F_OpenBank: Boolean;
var
Booth: TPoint;
begin
if (not LoggedIn) or (F_BankScreen) then
Exit;

Booth := R_TileToMS(Point(3186, 3436));
MMouse(Booth.X, Booth.Y, 2, 2);
Sleep(100 + Random(100));
if (R_IsUpText('Bank Ba')) then begin
ClickMouse2(Mouse_Left);
end else begin
ClickMouse2(Mouse_Right);
Sleep(250 + Random(250));
R_ChooseOption('Bank Ba');
end;
Sleep(500 + Random(250));

if (PinScreen) then
InPin(Players[CurrentPlayer].Pin);

Result := WaitFunc(@F_BankScreen, 250, 2500);
Sleep(1000 + Random(250));
end;

procedure F_CloseBank;
begin
if (not LoggedIn) or (not F_BankScreen) then
Exit;

MMouse(486+randomrange(-2, 2), 25+randomrange(-2, 2), 2, 2);
ClickMouse2(Mouse_Left);
Sleep(250 + Random(250));
end;

function F_WithdrawEx(Col, Row, Amount: Integer; Uptexts: TStringArray): Boolean;
var
BBox: TBox;
X, Y: Integer;
begin
Result := False;
FixBank;
if (not LoggedIn) or (not F_BankScreen) then
exit;

BBox := BankIndexToMSBox(BankPointToBankIndex(Point(Col, Row)));
BBox := IntToBox(BBox.X1 - 2, BBox.Y1 + 30, BBox.X2 - 2, BBox.Y2 + 23);
GetMousePos(X, Y);
if (not PointInBox(Point(X, Y), BBox)) then
MouseBox(BBox.X1 - 2, BBox.Y1 + 10, BBox.X2 - 2, BBox.Y2 + 3, mouse_move);

if (Length(Uptexts) > 0) then
if (not R_WaitUpTextMulti(Uptexts, 500)) then
Exit;

if (Amount = 1) then
ClickMouse2(mouse_left)
else
ClickMouse2(mouse_right);
if (Amount = 1) then
begin
Result := True;
Wait(RandomRange(250, 550));
Exit;
end;

if (Amount = -1) then
begin
if (WaitOptionMultiEx(['Withdraw-All-but', 'l-b'], 'All', Nothing, 300)) then
Result := R_ChooseOption('Withdraw-All-but');
end else
if (Amount = 0) then
begin
if (WaitOptionMultiEx(['Withdraw-All', 'w-A'], 'All', Nothing, 300)) then
Result := R_ChooseOption('Withdraw-All');
end else
if (WaitOptionMultiEx(['Withdraw-' + IntToStr(Amount) + ' ', 'w-' + IntToStr(Amount) + ' '], 'All', Nothing, 300)) then
Result := R_ChooseOption('Withdraw-' + IntToStr(Amount) + ' ');

if (not (Result)) and (Amount > 0) then
begin
if (not OptionsExist(['Withdraw', 'ithdraw', 'draw'], False)) then
MouseBox(BBox.X1 + 5, BBox.Y1 + 5, BBox.X2 - 5, BBox.Y2 - 5, mouse_right);

if WaitOptionMulti(['Withdraw-X', 'w-X', 'X'], 500) then
begin
X := GetSystemTime + 10000;
while (X >= GetSystemTime) and (not (InRange(CountColor(0, 211, 394, 308, 411), 200, 300))) do
Wait(50);
Wait(RandomRange(75, 400));
TypeSend(IntToStr(Amount));
Result := True;
end;
end;
end;

procedure WithdrawOres;
begin
F_OpenBank;
F_WithdrawEx(3, 0, 9, ['Iron ore']);
F_WithdrawEx(1, 0, 0, ['Coal']);
F_CloseBank;
end;

procedure SuperheatBar;
begin
GameTab(tab_Magic);
MMouse(666 + RandomRange(-3, 3), 313 + RandomRange(-3, 3), 2, 2);
Sleep(100 + Random(100));
ClickMouse2(Mouse_Left);
Sleep(100 + Random(100));
InvMouse(10, 1);
Sleep(1000 + Random(250));
Inc(bars);
end;

procedure Superheat;
var
I: Integer;
begin
for I := 0 to 26 do begin
SuperheatBar;
end;
end;

procedure DepositBars;
var i: integer;
begin
F_OpenBank;
//Deposit(2, 28, True); SRL-5 Deposit() function doesn't work?
for i := 2 to 28 do begin
if (InvCount > 1) then begin
InvMouse(i, mouse_Right);
sleep(200+random(50));
R_ChooseOption('Deposit-All');
end;
end;
end;

procedure proggy;
begin
writeln('Runtime: ' + timerunning);
writeln('Bars made: ' + tostr(bars));
end;

begin
SetupSRL;
SetupReflection;
repeat
WithdrawOres;
Superheat;
DepositBars;
proggy;
until(False);
end.


I keep getting this error when I go to compile. I just reinstalled reflection, so I'm not quite sure what's not letting it compile.

The error reads:
Exception in Script: Operator expected at line 446, column 3 in file "C:\Simba\Includes\SRL-OSR\SRL\Reflection\Core\Tiles.simba"
Exception in Script: Operator expected at line 446, column 3 in file "C:\Simba\Includes\SRL-OSR\SRL\Reflection\Core\Tiles.simba"

Frement

2014-10-14 00:22:20

From: Dog
I keep getting this error when I go to compile. I just reinstalled reflection, so I'm not quite sure what's not letting it compile.

The error reads:
Exception in Script: Operator expected at line 446, column 3 in file "C:\Simba\Includes\SRL-OSR\SRL\Reflection\Core\Tiles.simba"
Exception in Script: Operator expected at line 446, column 3 in file "C:\Simba\Includes\SRL-OSR\SRL\Reflection\Core\Tiles.simba"


Because you are using a wrong interpreter. Script > Interpreter > PascalScript

Dog

2014-10-14 00:24:05

From: Frement
Because you are using a wrong interpreter. Script > Interpreter > PascalScript


You just made my day. :spot: