SRL Archive - RS3 Script Requests

Simple unf potion maker


slackeru

2010-08-04 18:55:18

I need a script that withdraws 14 herbs and 14 vials, mix, deposit and repeat :)

Thanks.

marpis

2010-08-05 03:34:23

This used to be perfect a couple of months ago, so I think it's worth a try.
You will have to update the DTMs though.

If it works like it used to then it's the best herblore script you're ever going to use :) It's so über smooth. Not a single unnecessary wait, no bot-like mouse movements. I was pretty proud of this when I used it myself.

Please tell me if it still works and I'll make a thread to it.

program PotionMaker;
{.include srl/srl/misc/smart.scar}
{.include srl/srl.scar}


{

INSTRUCTIONS:
o Start in Varrock East Bank
o Have option "Withdraw-14" already visible
o Inventory full, and ready to start mixing
- marpis
}
var
Loads: integer;
LastBankPoint: TPoint;

procedure DeclarePlayers;
begin
SMART_Server := 138;
SMART_Members := True;
SMART_Signed := True;

NumberOfPlayers(1);

with Players[0] do
begin
Name := '';
Pass := '';
Integers[0] := 999; // Loads to make
Strings[0] := 'prayer'; // 'unf', 'prayer'
Active := True;
end;
end;


function LoadDTM2(Which: string): integer;
begin

case lowercase(Which) of
'herb': Result := DTMFromString('78DA637461626078CC8002C43C95197418191' +
'88088E13F10307A03D5BC6440034C609211CA63F4C33407438D1B' +
'90FF86801A0720FF150135B644B8C78A4835CF09A8B104F29F115' +
'01300E4DFC7AF0600038F1086');

'vial': Result := DTMFromString('78DA639CC6C4C010CCC8800C728B17317C010' +
'A8144FF0301E36CA01A7F54350C0C4C601226CA380FC80F23A066' +
'2E901F43400DC83D7104D44C02F26309A8E905F2A3885043C8CDF' +
'D407E207E350064FA0EFE');

'snape': Result := DTMFromString('78DA63746062602862644006BC31560C5F804' +
'220D1FF40C06886A9868181094CC244196D80FC4A026AEC81FC5A' +
'026A1C81FC3A026A3C8950E303E4D71050E307E4571150E305E49' +
'71050E34144F880DC5C40408D05905F4D849A3CFC6A00024D0F59' +
'');

'unf': Result := DTMFromString('78DA637466626078C58002EA26D5317C61646' +
'0002286FF40C0680B54F394010D30814946288FD10AC87F41408D' +
'0590FF96801A7B20FF130135AE44A8F106F2DF1150E309E4BFC4A' +
'F06006B421017');

end;

end;


function FindIngredient(Primary: boolean; area: string; var X, Y: integer): Boolean;
var
DTM: integer;
B: TBox;
begin
if Primary then
case Players[CurrentPlayer].Strings[0] of
'unf': DTM := LoadDTM2('vial');
'prayer': DTM := LoadDTM2('unf');
end else
case Players[CurrentPlayer].Strings[0] of
'unf': DTM := LoadDTM2('herb');
'prayer': DTM := LoadDTM2('snape');
end;

GameTab(tab_Inv);
case area of
'inv': B := IntToBox(MIX1, MIY1, MIX2, MIY2);
'bank': B := IntToBox(MBX1, MBY1, MBX2, MBY2);
end;
Result := FindDTM(DTM, X, Y, B.X1, B.Y1, B.X2, B.Y2);
FreeDTM(DTM);
end;


function MakePotion: boolean;
var
X, Y, T: integer;
begin
FindNormalRandoms;
GameTab(tab_Inv);
T := GetSystemTime + 10000;
while (GetSystemTime < T) do
begin
if (GetSystemTime > T) then Exit;
if FindIngredient(True, 'inv', X, Y) and FindIngredient(False, 'inv', X, Y) then Break;
Wait(5 + Random(10));
end;

T := GetSystemTime + 20000;
while (GetSystemTime < T) and (Not Result) do
begin
MouseItem(14, True);
Wait(RandomRange(250, 300));
MouseItem(15, True);
if Random(5) = 0 then
begin
getMousePos(X, Y);
MouseBox(X - 25, Y - 25, X + 25, Y + 25, 3);
end else
if Random(7) = 0 then
PickupMouse;

MouseBox(249, 416, 264, 431, 3);
T := GetSystemTime + 30000;
while (GetSystemTime < T) do
begin
if FindNPCChatText('many', Nothing) then
break;
Wait(10 + random(15));
end;

if (GetSystemTime < T) then
begin
GetMousePos(X, Y);
Mouse(X, Y, 0, 0, False);
Result := WaitOption('ll', 1800);
end;
end;

end;

function ClickBooth: boolean;
var
TPA: TPointArray;
ATPA: T2DPointArray;
i, H, X, Y: integer;
begin
FindNormalRandoms;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.41, 1.31);
FindColorsTolerance(TPA, 3037288, 228, 193, 273, 244, 2);
ColorToleranceSpeed(0);
SetColorSpeed2Modifiers(0.2, 0.2);

ATPA := TPAtoATPA(TPA, 10);
SortATPAFrom(ATPA, LastBankPoint);

H := High(ATPA);
if (H < 1) then Exit;

for i := 0 to H do
begin
if (Length(ATPA[i]) < 30) then Continue;
MiddleTPAEx(ATPA[i], X, Y);
MMouse(X, Y, 3, 3);
if WaitUptext('ooth', 250 + random(100)) then
begin
GetMousePos(X, Y);
LastBankPoint := Point(X, Y);
Mouse(X, Y, 0, 0, False);
Result := WaitOptionEx('uick', 'all', Move, 3400 + random(1000));
end;
if Result then
Exit;
end;
end;

procedure WaitWhileMixing;
begin
while (InvCount > 14) do
begin
if (not LoggedIn) then
begin
WriteLn('*** Logged out while mixing ***');
TerminateScript;
end;
Wait(10 + random(15));
FindNormalRandoms;
LevelUp;
end;
end;

function Withd: boolean;
var
X, Y, DTM, T: integer;
begin
if (not LoggedIn) then Exit;
T := GetSystemTime + 20000;
while (GetSystemTime < T) do
begin
DepositAll;
if FindIngredient(True, 'bank', X, Y) then
begin
Mouse(X, Y, 4, 4, False);
if WaitOption('14', 3800 + random(200)) then
begin
Wait(80 + random(20));
if FindIngredient(False, 'bank', X, Y) then
begin
Mouse(X, Y, 4, 4, False);
Result := WaitOption('14', 3800 + random(200));
end;
end;
end;
if WaitFunc(@InvFull, 5, 2500) then Break;
end;
CloseBank;
end;

function OpenBnk: boolean;
var
X, Y, T: integer;
begin
GetMousePos(X, Y); // We have already hovered option
Mouse(X, Y, 0, 0, True);
T := GetSystemTime + 20000;
while (GetSystemTime < T) and (not Result) do
begin
wait(10 + random(15));
if BankScreen then
if FindIngredient(True, 'bank', X, Y) and FindIngredient(False, 'bank', X, Y) then
Result := true;
end;
end;


procedure Quit(s: string);
begin
WriteLn(TimeRunning + ' // '+ s);
TerminateScript;
end;

begin
DeclarePlayers;
SetupSRL;
if not WaitFunc(@LoggedIn, 5, 2000) then
loginplayer;
SetAngle(true);
MakeCompass('n');
LastBankPoint := Point(244, 206);
repeat
if not MakePotion then Quit('Mixing failed');
if Players[CurrentPlayer].Strings[0] = 'unf' then
if not ClickBooth then Quit('Couldn''t find booth');
WaitWhileMixing;
if Players[CurrentPlayer].Strings[0] <> 'unf' then
if not ClickBooth then Quit('Couldn''t find booth');
if not OpenBnk then Quit('Bank didn''t open');
if not Withd then Quit('Withdraw failed!');
Inc(Loads);
WriteLn(TimeRunning + '// Loads: '+IntToStr(Loads)+' // Potions per hour: ' + FloatToStr((Loads*14.0) / (GetTimeRunning /1000.0 /60.0 /60.0)));
until(not LoggedIn) or (Loads >= Players[CurrentPlayer].Integers[0]);
end.

i luffs yeww

2010-08-05 03:42:08

I don't believe that all grimy/clean herbs are the same.

Capricorn

2010-08-05 03:45:27

I would wait to do any herblore related activities, there was a glitch in MTK and herbs are crashing because of this (panic selling + large influx of herbs + herbs are really high)

i luffs yeww

2010-08-05 04:13:51

Mtk?

slackeru

2010-08-05 05:20:31

Thanks alot. I'll test it with clean avantoes :)

Edit: I ran it with 14 avantoes and 14 vial of water in inventory, it used the vial with the herb and moved the mouse to the big vial and there it stops. I guess it's a simple solution for this, I would fix if I was able to :(

Becks

2010-08-05 11:06:06

Offtopic: but how much gp is lost? And can you sell unf potions?

Capricorn

2010-08-05 12:25:38

From: Becks
Offtopic: but how much gp is lost? And can you sell unf potions?


You don't lose money making unfinished potions, you profit.

People pay a premium for all the hard work you did by making unfinished potions. You get no experience for doing so (unless you count cleaning the herbs).

Basically you can profit 400-1000k a hour by choosing the right unfinished potions to make (or can when the market is in relative stability)

Becks

2010-08-05 13:43:45

From: Capricorn
You don't lose money making unfinished potions, you profit.

People pay a premium for all the hard work you did by making unfinished potions. You get no experience for doing so (unless you count cleaning the herbs).

Basically you can profit 400-1000k a hour by choosing the right unfinished potions to make (or can when the market is in relative stability)


Hm. Good to know thanks for the information.