SRL Archive - First Scripts

Superheater: Mithril Bars


Macros

2008-11-08 14:47:34

::SEE POST 22 FOR THE MOST RECENT SCRIPT VERSION::
::script works well, but is not the most updated version by far, (SRL Jr script soon)::

Hey, this is my first ever script, it works great, (I've made over 400 bars just debugging it etc), but I have a few questions to help make it better:

1. Is there a difference between "terminatescript" and "exit"?
2. I have two methods of withdrawing stuff from the bank, (in the script-lines 144-184), which one is better?
3. When I raise the PlayerSuperheats, (number of superheats to cast before exiting), above to 10, the script never stops, but at 5, it only does 5 Superheats, (as expected), and then stops… What's wrong?!
4. The compass directioning stuff doesn't seem to work for any direction besides North, (if you put it on East, it goes to almost North)?!
5. The mouse speeds seems to vary a lot, some of which seem dangerously fast, how can I fix this?
6. The progress report always says that it only banked once?! How can I fix this?
7. After the desired amount of superheats are done, the script should log you out and terminate, only it skips the logout stage for some reason!

Of course if you see anything else wrong with it, or even just weird, (ie, odd place meant of var declarations, or procedures etc), please tell me! After all, this is my first script…

Thanks, Macros

PS, the forum formats code weirdly, this script looks nicer in SCAR…



program SuperheatMithril;
{.include SRL/SRL.scar}
{.include SRL/SRL/skill/magic.scar}

{---------------------------------------------------------------------------]
[ d[-_-]b :: Mithril Superheater :: d[-_-]b ]
[---------------------------------------------------------------------------]
[ Created by: Macros, for Scar 3.15+ and SRL 28+ ]
[ Last Update : 11/8/2008 ]
[ ]
[ 1. Customize the basic setup, and player array. ]
[ 2. Use with Low Detail, Very Bright. ]
[ 3. Equip a Fire Staff. ]
[ 4. Position player in desired bank, (see basic setup). ]
[ 5. Have an adequate amount of Nature Runes in the last inventory space. ]
[ 6. Put any item in the first bank space, mithril ore in the second ]
[ and coal in third, (in the first, (infinity symbol), tab). ]
[ 7. Strongly suggested that you place one Mithril Ore in the twelfth ]
[ inventory spot, (right on top of the Superheat spell). ]
[---------------------------------------------------------------------------}

{------------------------------------------------------------------------------]
Basic script setup.
-------------------------------------------------------------------------------}

var
MithrilBarDTM, SuperheatDTM, MithrilOreDTM, CoalDTM,
l, loads, x, y: integer;

const
StartPlayer = 0; //Determines who will play first.
MSpeed = 50; //Speed of the mouse, (higher=faster, recommended 40-60).
DropRandomItems = False; //Drop the items you get from random events, such as gems and coins?

BankName = 'veb'; //Search for "OpenBankQuiet" in the SRL Manual for a list of valid abbreviations.
RandomSkill = 'Prayer'; //Which skill would you like to use Genie Lamps on, (if any are recieved).
CompassDirection = 'N'; //Insert a direction that will show lots of bank windows in your desired bank, (first letter only).
PlayerSuperheats = 10; //How many Mithril Bars would you like to superheat?

Version = '0.2'; //Script version, (don't change).
//YourSRLID = 'Username'; //Your SRL User ID. (for when the script is done)
//YourSRLPass = 'Password'; //Your SRL User Pass. (for when the script is done)

{------------------------------------------------------------------------------]
Declare Players
-------------------------------------------------------------------------------}

procedure DeclarePlayers; //More arrays when script is done...
begin
HowManyPlayers := 1; //Set Number of Players here.
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := StartPlayer;

Players[0].Name := 'Username'; //Username
Players[0].Pass := 'Password'; //Password
Players[0].Nick := 'Nickname'; //3-4 consecutive letters of your user name, (ex: "Nickname" -> "ick").
Players[0].Strings[0] := 'mithril'; //Type of bar, (only use with mithril at the moment).
Players[0].Active := True; //Say, are you going to use this player?
end;

{------------------------------------------------------------------------------]
NO NEED TO CHANGE ANYTHING BELOW THIS LINE... Hit run and post proggies!
[------------------------------------------------------------------------------}

{------------------------------------------------------------------------------]
AntiBan!
[------------------------------------------------------------------------------}

procedure AntiBan;
begin
if not LoggedIn then Exit;
case Random(10) of
1: HoverSkill('Smithing', False);
2: HoverSkill('Magic', False);
end;
end;

{------------------------------------------------------------------------------]
"Find" the ore!
[------------------------------------------------------------------------------}

function FindOre(oreType: string; var rx, ry: integer; x1, y1, x2, y2: integer):
boolean;
var
ore, oreColor: integer;
oreMP: TDTMPointDef;
oreSP: array of TDTMPointDef;
oreSkel: TDTM;
begin
case lowercase(oreType) of
'coal': oreColor := 2570553;
'mithril': oreColor := 7425357;
else
begin
writeln('Desired ore type(s) not found!');
exit;
end;
end;
setarraylength(oreSP, 4);

oreMP.x := 580;
oreMP.y := 229;
oreMP.areasize := 1;
oreMP.areashape := 0;
oreMP.color := oreColor;
oreMP.tolerance := 15;

oreSP[0].x := 576;
oreSP[0].y := 227;
oreSP[0].areasize := 1;
oreSP[0].areashape := 0;
oreSP[0].color := 65536;
oreSP[0].tolerance := 0;

oreSP[1].x := 574;
oreSP[1].y := 229;
oreSP[1].areasize := 1;
oreSP[1].areashape := 0;
oreSP[1].color := 65536;
oreSP[1].tolerance := 0;

oreSP[2].x := 563;
oreSP[2].y := 230;
oreSP[2].areasize := 1;
oreSP[2].areashape := 0;
oreSP[2].color := 65536;
oreSP[2].tolerance := 0;

oreSP[3].x := 592;
oreSP[3].y := 227;
oreSP[3].areasize := 1;
oreSP[3].areashape := 0;
oreSP[3].color := 65536;
oreSP[3].tolerance := 0;

oreSkel.MainPoint := oreMP;
oreSkel.SubPoints := oreSP;
ore := AddDTM(oreSkel);

result := findDTM(ore, rx, ry, x1, y1, x2, y2);
freeDTM(ore);
end;

{------------------------------------------------------------------------------]
Withdraw ores from the bank.
[------------------------------------------------------------------------------}

procedure WithdrawOres;
begin;
l := 0
if (not (Loggedin)) then exit;
if (not (bankscreen)) then exit;
case lowercase(players[currentplayer].Strings[0]) of
'mithril':
begin
if findOre('mithril', x, y, msx1, msy1, msx2, msy2) then
else
begin
writeln('Can not find Mithril Ore!');
terminatescript;
end;
begin
Withdraw(2,1,5);
end;
wait(100 + random(50));
begin
if FindDTM(CoalDTM, x, y, 120, 85, 160, 125) then
else
begin
writeln('Can not find Coal!');
terminatescript;
end;
begin
ClickMouseSpline(x, y, 5, 5, False);
ChooseOption('All');
end;
Wait(75 + random(50));
CloseBank;
Wait(50 + random(50));
end;
end;
end;
end;

{------------------------------------------------------------------------------]
Cast the spell: Superheat, (five times).
[------------------------------------------------------------------------------}

procedure CastSuperheat;

var
i: Integer;

begin
i:= 0;
Wait(25 + random(50));
ClickMouseSpline(740, 180, 5, 5, True);
repeat
if (not (Loggedin)) then exit;

if FindDTM(SuperheatDTM, x, y, 670, 285, 710, 315) then
begin
ClickMouseSpline(x, y, 3, 3, True);
end;
Wait(25 + random(50));
if findOre(players[currentplayer].Strings[0], x, y, MIX1, MIY1, MIX2, MiY2) then
else
begin
writeln('Can not find ore.');
exit;
end;
begin
MoveMouseSpline(x, y, 5, 5);
wait(25 + random(50));
if IsUpText('ith') then
else
begin
Writeln('Incorret uptext.');
exit;
end;
begin
ClickMouseSpline(x, y, 5, 5, True);
Wait(25 + random(50));
i:= i + 1;
end;
end;
until(i >= 5);
AntiBan;
end;

{------------------------------------------------------------------------------]
Load the DTMs.
[------------------------------------------------------------------------------}

procedure LoadDTMs;
begin

MithrilBarDTM := DTMFromString('78DA6394606060106540018E8EF10C3C409A1' +
'188FF0301238823C18006189148200D32839F801A5922D4280109' +
'21026A5488700FC82E7922DCAC845F0D00D9240685');

SuperheatDTM := DTMFromString('78DA639460606090614001BF2245197880342' +
'310FF0702461C6A18A06AC0B40090906640038CA86A0481841001' +
'359244A85104126204D428010979026A40F24A04D40813560300F' +
'88F08C1');

MithrilOreDTM := DTMFromString('78DA6394626060906040017EFEC50C3C409A1' +
'188FF030123279021CE8006189148202D06243809A8510012DC04' +
'D4A8030901026A948184141176C913502344580D00094106B0');

CoalDTM := DTMFromString('78DA639461606010634001D6561A0C3C409A1' +
'188FF03012337A61A882C8C04D222404280801A0920C149408D3A' +
'90E025420D21F728020979026A2481840A0135203FC9E15703007' +
'76E0674');
end;

{------------------------------------------------------------------------------]
Bank the Mithil Bars.
[------------------------------------------------------------------------------}

procedure Bank;
var
time: Integer;
begin
MarkTime(time);
repeat
if (not (Loggedin)) then break;
OpenBankQuiet(BankName)
until (BankScreen or (TimeFromMark(time) > 100000));
Wait(150 + random(100));
if Bankscreen then
else
begin
terminatescript;
end;
begin
if FindDTM(MithrilBarDTM, x, y, 550, 200, 600, 250) then
begin
ClickMouseSpline(x, y, 3, 3, False);
ChooseOption('All');
end;
loads := + 1
end;
end;

{------------------------------------------------------------------------------]
Progress Report.
[------------------------------------------------------------------------------}

procedure ProgressReport;
begin
ClearDebug;
Writeln('Version 0.2 by: Macros, (LOTS of help from wtfwtfwtf).');
Writeln('Worked for ' + TimeRunning + '.');
Writeln('Banked ' + inttostr(Loads) + ' time(s).');
end;

{------------------------------------------------------------------------------]
Setup!
[------------------------------------------------------------------------------}

procedure Setup;
begin;
ClearDebug;
SetupSRL;
LoadDTMs;
ActivateClient;
Mousespeed := Mspeed;
DeclarePlayers;
LoginPlayer;
//SRLID := YourSRLId; (for when the script is done)
//SRLPassword := YourSRLPass; (for when the script is done)
MakeCompass('CompassDirection');
SetAngle(true);
end;

begin
setup;
repeat
OpenBankQuiet(BankName);
WithdrawOres;
CastSuperheat;
LampSkill := RandomSkill;
FindNormalRandoms;
Bank;
ProgressReport;
until (Loads = (PlayerSuperheats/5));
Logout;
if (Players[CurrentPlayer].Active = false) then
terminatescript;
end.

anonymity

2008-11-08 15:04:09

Hey, I will try this out and post a proggy for you… let you know of any bugs that I might find.

joelster134

2008-11-08 15:19:01

put in [SCAR.] tags (the orange bull dozer :p


loooks good for first script good work!

SirPa

2008-11-08 15:41:46

Is there a difference between "terminatescript" and "exit"?


– Exit exit's the procedure you put it in
– TerminateScript stops the whole script all together


Looks like a nice script :) I'll try it out

Sandstorm

2008-11-08 15:50:48

All of these:

ClickMouseSpline(x, y, 5, 5, False);

Should be changed to Mouse(x, y, 5, 5, False);, similar for the True ones.

MoveMouseSpline(x, y, 5, 5);

These should be MMouse(x, y, 5, 5);.

  result := findDTM(ore, rx, ry, x1, y1, x2, y2);
freeDTM(ore);

Shouldn't you withdraw them there? If you withdraw them in your WithdrawOre Procedure, try this instead:

if findOre('mithril', x, y, msx1, msy1, msx2, msy2) then
begin
Mmouse(x, y, 5, 5);
If IsUpText('irthil Or') Then
Mouse(x, y, 0, 0, false);
ChooseOption('ithdraw Al');
freeDTM(ore);
end else
begin
writeln('Can not find Mithril Ore!');
terminatescript;
end;

Not entirely sure if that'll work, but it should.

Instead of wasting space with a DTM, you can just do this:

Cast('Superheat');

You may have to change the string, but I think that will work.

See how much space it saves?

  if FindDTM(SuperheatDTM, x, y, 670, 285, 710, 315) then
begin
Mouse(x, y, 3, 3, True);
end;

I made a quick procedure to help you with banking, DepositAllExcept(A : Array Of Integer);. Currently it will only work if the item is at the start of the inventory, so DepositAllExcept([1, 2, 4]); would still deposit item number four. Anyways, since runes are almost always in the first spot, have fun :).

procedure DepositAllExcept(A : Array of Integer);
begin
if (BankScreen) then
begin
For I:=1 To 28 Do
if not(InIntArray(a, i)) then
Deposit(I, 28, True);
end;
end;

Put that in your script, then do this:


procedure Bank;
var
time: Integer;
begin
MarkTime(time);
repeat
if (not (Loggedin)) then break;
OpenBankFast(BankName)
until (BankScreen or (TimeFromMark(time) > 100000));
DepositAllExcept([1]);
loads := loads + 1;
end;

I've never used OpenBankQuiet, so I don't know whether it's detectable or not. I just switched it to OpenBankFast to be safe. The 1 is which slots NOT to deposit.

All in all, not a bad script. I think the edited version will work, but I'm not sure. It DOES compile though. Here it is:

program SuperheatMithril;
{.include SRL/SRL.scar}
{.include SRL/SRL/skill/magic.scar}

{---------------------------------------------------------------------------]
[ d[-_-]b :: Mithril Superheater :: d[-_-]b ]
[---------------------------------------------------------------------------]
[ Created by: Macros, for Scar 3.15+ and SRL 28+ ]
[ Last Update : 11/8/2008 ]
[ ]
[ 1. Customize the basic setup, and player array. ]
[ 2. Use with Low Detail, Very Bright. ]
[ 3. Equip a Fire Staff. ]
[ 4. Position player in desired bank, (see basic setup). ]
[ 5. Have an adequate amount of Nature Runes in the last inventory space. ]
[ 6. Put any item in the first bank space, mithril ore in the second ]
[ and coal in third, (in the first, (infinity symbol), tab). ]
[ 7. Strongly suggested that you place one Mithril Ore in the twelfth ]
[ inventory spot, (right on top of the Superheat spell). ]
[---------------------------------------------------------------------------}

{------------------------------------------------------------------------------]
Basic script setup.
-------------------------------------------------------------------------------}

var
MithrilBarDTM, MithrilOreDTM, CoalDTM,
l, loads, x, y, ore, I: integer;

const
StartPlayer = 0; //Determines who will play first.
MSpeed = 50; //Speed of the mouse, (higher=faster, recommended 40-60).
DropRandomItems = False; //Drop the items you get from random events, such as gems and coins?

BankName = 'veb'; //Search for "OpenBankFast" in the SRL Manual for a list of valid abbreviations.
RandomSkill = 'Prayer'; //Which skill would you like to use Genie Lamps on, (if any are recieved).
CompassDirection = 'N'; //Insert a direction that will show lots of bank windows in your desired bank, (first letter only).
PlayerSuperheats = 10; //How many Mithril Bars would you like to superheat?

Version = '0.2'; //Script version, (don't change).
//YourSRLID = 'Username'; //Your SRL User ID. (for when the script is done)
//YourSRLPass = 'Password'; //Your SRL User Pass. (for when the script is done)

{------------------------------------------------------------------------------]
Declare Players
-------------------------------------------------------------------------------}

procedure DeclarePlayers; //More arrays when script is done...
begin
HowManyPlayers := 1; //Set Number of Players here.
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := StartPlayer;

Players[0].Name := 'Username'; //Username
Players[0].Pass := 'Password'; //Password
Players[0].Nick := 'Nickname'; //3-4 consecutive letters of your user name, (ex: "Nickname" -> "ick").
Players[0].Strings[0] := 'mithril'; //Type of bar, (only use with mithril at the moment).
Players[0].Active := True; //Say, are you going to use this player?
end;

{------------------------------------------------------------------------------]
NO NEED TO CHANGE ANYTHING BELOW THIS LINE... Hit run and post proggies!
[------------------------------------------------------------------------------}

{------------------------------------------------------------------------------]
AntiBan!
[------------------------------------------------------------------------------}

procedure AntiBan;
begin
if not LoggedIn then Exit;
case Random(10) of
1: HoverSkill('Smithing', False);
2: HoverSkill('Magic', False);
end;
end;

procedure DepositAllExcept(A : Array of Integer);
begin
if (BankScreen) then
begin
For I:=1 To 28 Do
if not(InIntArray(a, i)) then
Deposit(I, 28, True);
end;
end;

{------------------------------------------------------------------------------]
"Find" the ore!
[------------------------------------------------------------------------------}

function FindOre(oreType: string; var rx, ry: integer; x1, y1, x2, y2: integer):
boolean;
var
oreColor: integer;
oreMP: TDTMPointDef;
oreSP: array of TDTMPointDef;
oreSkel: TDTM;
begin
case lowercase(oreType) of
'coal': oreColor := 2570553;
'mithril': oreColor := 7425357;
else
begin
writeln('Desired ore type(s) not found!');
exit;
end;
end;
setarraylength(oreSP, 4);

oreMP.x := 580;
oreMP.y := 229;
oreMP.areasize := 1;
oreMP.areashape := 0;
oreMP.color := oreColor;
oreMP.tolerance := 15;

oreSP[0].x := 576;
oreSP[0].y := 227;
oreSP[0].areasize := 1;
oreSP[0].areashape := 0;
oreSP[0].color := 65536;
oreSP[0].tolerance := 0;

oreSP[1].x := 574;
oreSP[1].y := 229;
oreSP[1].areasize := 1;
oreSP[1].areashape := 0;
oreSP[1].color := 65536;
oreSP[1].tolerance := 0;

oreSP[2].x := 563;
oreSP[2].y := 230;
oreSP[2].areasize := 1;
oreSP[2].areashape := 0;
oreSP[2].color := 65536;
oreSP[2].tolerance := 0;

oreSP[3].x := 592;
oreSP[3].y := 227;
oreSP[3].areasize := 1;
oreSP[3].areashape := 0;
oreSP[3].color := 65536;
oreSP[3].tolerance := 0;

oreSkel.MainPoint := oreMP;
oreSkel.SubPoints := oreSP;
ore := AddDTM(oreSkel);

result := findDTM(ore, rx, ry, x1, y1, x2, y2);
end;

{------------------------------------------------------------------------------]
Withdraw ores from the bank.
[------------------------------------------------------------------------------}

procedure WithdrawOres;

begin;
l := 0
if (not (Loggedin)) then exit;
if (not (bankscreen)) then exit;
case lowercase(players[currentplayer].Strings[0]) of
'mithril':
begin
if findOre('mithril', x, y, msx1, msy1, msx2, msy2) then
begin
Mmouse(x, y, 5, 5);
If IsUpText('irthil Or') Then
Mouse(x, y, 0, 0, false);
ChooseOption('ithdraw Al');
freeDTM(ore);
end else
begin
writeln('Can not find Mithril Ore!');
terminatescript;
end;
wait(100 + random(50));
begin
if FindDTM(CoalDTM, x, y, 120, 85, 160, 125) then
begin
Mouse(x, y, 5, 5, False);
ChooseOption('All');
end else
begin
writeln('Can not find Coal!');
terminatescript;
end;
Wait(75 + random(50));
CloseBank;
Wait(50 + random(50));
end;
end;
end;
end;

{------------------------------------------------------------------------------]
Cast the spell: Superheat, (five times).
[------------------------------------------------------------------------------}

procedure CastSuperheat;

var
i: Integer;

begin
i:= 0;
Wait(25 + random(50));
Mouse(740, 180, 5, 5, True);
repeat
if (not (Loggedin)) then exit;
If Gametab(7) Then
Cast('superheat');
Wait(25 + random(50));
if findOre(players[currentplayer].Strings[0], x, y, MIX1, MIY1, MIX2, MiY2) then
else
begin
writeln('Can not find ore.');
exit;
end;
begin
MMouse(x, y, 5, 5);
wait(25 + random(50));
if IsUpText('ith') then
begin
Mouse(x, y, 5, 5, True);
Wait(25 + random(50));
i:= i + 1;
end else
begin
Writeln('Incorret uptext.');
exit;
end;
end;
until(i >= 5);
AntiBan;
end;

{------------------------------------------------------------------------------]
Load the DTMs.
[------------------------------------------------------------------------------}

procedure LoadDTMs;
begin

MithrilBarDTM := DTMFromString('78DA6394606060106540018E8EF10C3C409A1' +
'188FF0301238823C18006189148200D32839F801A5922D4280109' +
'21026A5488700FC82E7922DCAC845F0D00D9240685');

MithrilOreDTM := DTMFromString('78DA6394626060906040017EFEC50C3C409A1' +
'188FF030123279021CE8006189148202D06243809A8510012DC04' +
'D4A8030901026A948184141176C913502344580D00094106B0');

CoalDTM := DTMFromString('78DA639461606010634001D6561A0C3C409A1' +
'188FF03012337A61A882C8C04D222404280801A0920C149408D3A' +
'90E025420D21F728020979026A2481840A0135203FC9E15703007' +
'76E0674');
end;

{------------------------------------------------------------------------------]
Bank the Mithil Bars.
[------------------------------------------------------------------------------}

procedure Bank;
var
time: Integer;
begin
MarkTime(time);
repeat
if (not (Loggedin)) then break;
OpenBankFast(BankName)
until (BankScreen or (TimeFromMark(time) > 100000));
DepositAllExcept([1]);
loads := loads + 1;
end;

{------------------------------------------------------------------------------]
Progress Report.
[------------------------------------------------------------------------------}

procedure ProgressReport;
begin
ClearDebug;
Writeln('Version 0.2 by: Macros, (LOTS of help from wtfwtfwtf).');
Writeln('Worked for ' + TimeRunning + '.');
Writeln('Banked ' + inttostr(Loads) + ' time(s).');
end;

{------------------------------------------------------------------------------]
Setup!
[------------------------------------------------------------------------------}

procedure Setup;
begin;
ClearDebug;
SetupSRL;
LoadDTMs;
ActivateClient;
Mousespeed := Mspeed;
DeclarePlayers;
LoginPlayer;
//SRLID := YourSRLId; (for when the script is done)
//SRLPassword := YourSRLPass; (for when the script is done)
MakeCompass('CompassDirection');
SetAngle(true);
end;

begin
setup;
repeat
OpenBankQuiet(BankName);
WithdrawOres;
CastSuperheat;
LampSkill := RandomSkill;
FindNormalRandoms;
Bank;
ProgressReport;
until (Loads = (PlayerSuperheats/5));
if (Players[CurrentPlayer].Active = false) then
begin
Logout;
terminatescript;
end;
end.

1. Is there a difference between "terminatescript" and "exit"?
[PHP]Terminate script will stop the script, exit leaves the current procedure[/PHP]
2. I have two methods of withdrawing stuff from the bank, (in the script-lines 144-184), which one is better?
[PHP]I'm not sure, as I edited it.[/PHP]
3. When I raise the PlayerSuperheats, (number of superheats to cast before exiting), above to 10, the script never stops, but at 5, it only does 5 Superheats, (as expected), and then stops… What's wrong?!
[PHP]I couldn't tell you.[/PHP]
4. The compass directioning stuff doesn't seem to work for any direction besides North, (if you put it on East, it goes to almost North)?!
[PHP]Odd, it works for me.[/PHP]
5. The mouse speeds seems to vary a lot, some of which seem dangerously fast, how can I fix this?
[PHP]Not sure, but SetupSRL; makes mousespeed 15, you don't need this:
Mousespeed := Mspeed;[/PHP]
6. The progress report always says that it only banked once?! How can I fix this?
[PHP]loads := + 1; You had that. It should be loads := loads + 1;[/PHP]
7. After the desired amount of superheats are done, the script should log you out and terminate, only it skips the logout stage for some reason!
[PHP]Try this:

if (Players[CurrentPlayer].Active = false) then
begin
Logout;
terminatescript;
end;[/PHP]

Macros

2008-11-08 19:13:38

Things that have been fixed/answered so far:
1. Is there a difference between "terminatescript" and "exit"?
Thanks!
2. I have two methods of withdrawing stuff from the bank, (in the script-lines 144-184), which one is better?
Changed both to the withdraw(x,x,x) function, (so coal withdraws 10 twice to withdraw 20, instead of withdrawing-x and typing 20 in everytime, (more human-like, since you could just withdraw-20 after doing withdraw-x and typing 20 once…)
3. When I raise the PlayerSuperheats, (number of superheats to cast before exiting), above to 10, the script never stops, but at 5, it only does 5 Superheats, (as expected), and then stops… What's wrong?!
Thanks!
6. The progress report always says that it only banked once?! How can I fix this?
Thanks!
7. After the desired amount of superheats are done, the script should log you out and terminate, only it skips the logout stage for some reason!
I needed to close the bank first, before attempting to logout, fixed…


THINGS THAT STILL NEED FIXING:
4. The compass directioning stuff doesn't seem to work for any direction besides North, (if you put it on East, it goes to almost North)?!
I have no idea what's wrong?!
5. The mouse speeds seems to vary a lot, some of which seem dangerously fast, how can I fix this?
After all the "splines" where gotten rid of, the mouse speed wasn't so varied, but I think it's still dangerously fast! (Maybe not, I dunno, what do you think? I've clocked 2 inventories, (that's 10 superheats), in 49 seconds; that includes the SRL setup, (graphics check etc), and everything.))

Here's the latest version of the script, with all those updates, (thanks Sand storm for all your awesome help! I didn't take all of your advice, (I'll say why in the next post), but nevertheless, it all helped!)

-Macros

PS,

program MithrilSuperheater;
{.include SRL/SRL.scar}
{.include SRL/SRL/skill/magic.scar}

{---------------------------------------------------------------------------]
[ d[-_-]b :: Mithril Superheater :: d[-_-]b ]
[---------------------------------------------------------------------------]
[ Created by: Macros, for Scar 3.15+ and SRL 28+ ]
[ Last Update : 11/8/2008 ]
[ ]
[ 1. Customize the basic setup, and player array. ]
[ 2. Use with Low Detail, Very Bright. ]
[ 3. Equip a Fire Staff. ]
[ 4. Position player in desired bank, (see basic setup). ]
[ 5. Have an adequate amount of Nature Runes in the last inventory space. ]
[ 6. Put any item in the first bank space, mithril ore in the second ]
[ and coal in third, (in the first, (infinity symbol), tab). ]
[ 7. Strongly suggested that you place one Mithril Ore in the twelfth ]
[ inventory spot, (right on top of the Superheat spell). ]
[---------------------------------------------------------------------------}

{------------------------------------------------------------------------------]
Basic script setup.
-------------------------------------------------------------------------------}

var
MithrilBarDTM, MithrilOreDTM, CoalDTM, SuperheatDTM,
l, loads, x, y: integer;

const
StartPlayer = 0; //Determines who will play first.
MSpeed = 50; //Speed of the mouse, (higher=faster, recommended 40-60).
DropRandomItems = False; //Drop the items you get from random events, such as gems and coins?

BankName = 'veb'; //Search for "OpenBankQuiet" in the SRL Manual for a list of valid abbreviations.
RandomSkill = 'Prayer'; //Which skill would you like to use Genie Lamps on, (if any are recieved).
CompassDirection = 'S'; //Insert a direction that will show lots of bank windows in your desired bank, (first letter only).
PlayerSuperheats = 10; //How many Mithril Bars would you like to superheat?

Version = '0.21'; //Script version, (don't change).
//YourSRLID = 'Username'; //Your SRL User ID. (for when the script is done)
//YourSRLPass = 'Password'; //Your SRL User Pass. (for when the script is done)

{------------------------------------------------------------------------------]
Declare Players
-------------------------------------------------------------------------------}

procedure DeclarePlayers; //More arrays when script is done...
begin
HowManyPlayers := 1; //Set Number of Players here.
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := StartPlayer;

Players[0].Name := 'Username'; //Username
Players[0].Pass := 'Password'; //Password
Players[0].Nick := 'Nickname'; //3-4 consecutive letters of your user name, (ex: "Nickname" -> "ick").
Players[0].Strings[0] := 'mithril'; //Type of bar, (only use with mithril at the moment).
Players[0].Active := True; //Say, are you going to use this player?
end;

{------------------------------------------------------------------------------]
NO NEED TO CHANGE ANYTHING BELOW THIS LINE... Hit run and post proggies!
[------------------------------------------------------------------------------}

{------------------------------------------------------------------------------]
AntiBan!
[------------------------------------------------------------------------------}

procedure AntiBan;
begin
if not LoggedIn then Exit;
case Random(10) of
1: HoverSkill('Smithing', False);
2: HoverSkill('Magic', False);
end;
end;

{------------------------------------------------------------------------------]
"Find" the ore!
[------------------------------------------------------------------------------}

function FindOre(oreType: string; var rx, ry: integer; x1, y1, x2, y2: integer):
boolean;
var
ore, oreColor: integer;
oreMP: TDTMPointDef;
oreSP: array of TDTMPointDef;
oreSkel: TDTM;
begin
case lowercase(oreType) of
'coal': oreColor := 2570553;
'mithril': oreColor := 7425357;
else
begin
writeln('Desired ore type(s) not found!');
exit;
end;
end;
setarraylength(oreSP, 4);

oreMP.x := 580;
oreMP.y := 229;
oreMP.areasize := 1;
oreMP.areashape := 0;
oreMP.color := oreColor;
oreMP.tolerance := 15;

oreSP[0].x := 576;
oreSP[0].y := 227;
oreSP[0].areasize := 1;
oreSP[0].areashape := 0;
oreSP[0].color := 65536;
oreSP[0].tolerance := 0;

oreSP[1].x := 574;
oreSP[1].y := 229;
oreSP[1].areasize := 1;
oreSP[1].areashape := 0;
oreSP[1].color := 65536;
oreSP[1].tolerance := 0;

oreSP[2].x := 563;
oreSP[2].y := 230;
oreSP[2].areasize := 1;
oreSP[2].areashape := 0;
oreSP[2].color := 65536;
oreSP[2].tolerance := 0;

oreSP[3].x := 592;
oreSP[3].y := 227;
oreSP[3].areasize := 1;
oreSP[3].areashape := 0;
oreSP[3].color := 65536;
oreSP[3].tolerance := 0;

oreSkel.MainPoint := oreMP;
oreSkel.SubPoints := oreSP;
ore := AddDTM(oreSkel);

result := findDTM(ore, rx, ry, x1, y1, x2, y2);
end;

{------------------------------------------------------------------------------]
Withdraw ores from the bank.
[------------------------------------------------------------------------------}

procedure WithdrawOres;

begin;
l := 0
if (not (Loggedin)) then exit;
if (not (bankscreen)) then exit;
case lowercase(players[currentplayer].Strings[0]) of
'mithril':
begin
if findOre('mithril', x, y, msx1, msy1, msx2, msy2) then
begin
Withdraw(2,1,5);
end else
begin
writeln('Can not find Mithril Ore!');
terminatescript;
end;
wait(100 + random(50));
begin
if findOre('coal', x, y, msx1, msy1, msx2, msy2) then
begin
Withdraw(3,1,10)
Wait(25 + random(50));
Withdraw(3,1,10)
Wait(300 + random(100));
end else
begin
writeln('Can not find Coal!');
terminatescript;
end;
CloseBank;
Wait(50 + random(50));
end;
end;
end;
end;

{------------------------------------------------------------------------------]
Cast the spell: Superheat, (five times).
[------------------------------------------------------------------------------}

procedure CastSuperheat;

var
i: Integer;

begin
i:= 0;
Wait(25 + random(50));
Mouse(740, 180, 5, 5, True);
repeat
if (not (Loggedin)) then exit;
if FindDTM(SuperheatDTM, x, y, 670, 285, 710, 315) then
begin
Mouse(x, y, 3, 3, True);
end;
Wait(25 + random(50));
if findOre(players[currentplayer].Strings[0], x, y, MIX1, MIY1, MIX2, MiY2) then
begin
MMouse(x, y, 5, 5);
wait(25 + random(50));
if IsUpText('ith') then
begin
Mouse(x, y, 5, 5, True);
Wait(1250 + random(250));
i:= i + 1;
end else
begin
Writeln('Incorret uptext.');
exit;
end;
end else
begin
writeln('Can not find ore.');
exit;
end;
until(i >= 5);
AntiBan;
end;


{------------------------------------------------------------------------------]
Load the DTMs.
[------------------------------------------------------------------------------}

procedure LoadDTMs;
begin

MithrilBarDTM := DTMFromString('78DA6394606060106540018E8EF10C3C409A1' +
'188FF0301238823C18006189148200D32839F801A5922D4280109' +
'21026A5488700FC82E7922DCAC845F0D00D9240685');

MithrilOreDTM := DTMFromString('78DA6394626060906040017EFEC50C3C409A1' +
'188FF030123279021CE8006189148202D06243809A8510012DC04' +
'D4A8030901026A948184141176C913502344580D00094106B0');

CoalDTM := DTMFromString('78DA639461606010634001D6561A0C3C409A1' +
'188FF03012337A61A882C8C04D222404280801A0920C149408D3A' +
'90E025420D21F728020979026A2481840A0135203FC9E15703007' +
'76E0674');

SuperheatDTM := DTMFromString('78DA639460606090614001BF2245197880342' +
'310FF0702461C6A18A06AC0B40090906640038CA86A0481841001' +
'359244A85104126204D428010979026A40F24A04D40813560300F' +
'88F08C1');
end;

{------------------------------------------------------------------------------]
Bank the Mithil Bars.
[------------------------------------------------------------------------------}

procedure Bank;
var
time: Integer;
begin
MarkTime(time);
repeat
if (not (Loggedin)) then break;
OpenBankFast(BankName)
until (BankScreen or (TimeFromMark(time) > 100000));
Deposit(1,5,5);
loads := loads + 1;
end;

{------------------------------------------------------------------------------]
Progress Report.
[------------------------------------------------------------------------------}

procedure ProgressReport;
begin
ClearDebug;
Writeln('Version 0.21 by: Macros, (LOTS of help from wtfwtfwtf).');
Writeln('Worked for ' + TimeRunning + '.');
Writeln('Banked ' + inttostr(Loads) + ' time(s).');
end;

{------------------------------------------------------------------------------]
Setup!
[------------------------------------------------------------------------------}

procedure Setup;
begin;
ClearDebug;
SetupSRL;
LoadDTMs;
ActivateClient;
DeclarePlayers;
LoginPlayer;
//SRLID := YourSRLID; (for when the script is done)
//SRLPassword := YourSRLPass; (for when the script is done)
MakeCompass('CompassDirection');
SetAngle(true);
end;

begin
setup;
repeat
OpenBankFast(BankName);
WithdrawOres;
CastSuperheat;
LampSkill := RandomSkill;
FindNormalRandoms;
Bank;
ProgressReport;
until (Loads = (PlayerSuperheats/5));
if (Players[CurrentPlayer].Active = false) then
CloseBank;
LogOut;
terminatescript;
end.

Macros

2008-11-08 19:20:22

Explanations for Sand storm:

I didn't use your bank array because I didn't want to deposit the nats and one mithril ore, so the array wouldn't work for that. I'm not sure how to modify it correctly, but with the correct modification it should be good to include.

I didn't use the cast('superheat item'), because it looks inhuman-like, since the mouse moves from the spell, across the screen to the ore, to the spell book, and then back to the spell… (instead of just clicking the spell, moving about 5 pixels to the right, clicking, and moving about 5 pixels to the left).

But don't get me wrong, you help A LOT!

-Macros

Sandstorm

2008-11-08 19:25:50

Of course.

Withdraw(3,1,10)

Only problem with those is that the ore MUST be in the same spot for everyone. Not a problem, just a little less user friendly.

Mouse(740, 180, 5, 5, True);

Co-ord clicking isn't recommended, although that'll probably work just as well as Cast, unless they overhaul the whole mage book again, which will probably break Cast anyways.

  if (Players[CurrentPlayer].Active = false) then
CloseBank;
LogOut;
terminatescript;

That will only execute CloseBank; in the if statement. No matter what, it'll logout and stop the script.

Use this:


if (Players[CurrentPlayer].Active = false) then
begin
CloseBank;
LogOut;
terminatescript;
end;


if IsUpText('ith') then
begin
Mouse(x, y, 5, 5, True);
Wait(1250 + random(250));
i:= i + 1;
end else

I don't suggest using this, as it moves the mouse after the IsUpText check. I'd suggest this, so that it clicks where your mouse is at the time.


if IsUpText('ith') then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, True);
Wait(1250 + random(250));
i:= i + 1;
end else

Also, if I'm not mistaken, you can just do this:


if findOre('coal', x, y, msx1, msy1, msx2, msy2) then
begin
Withdraw(3,1,20);
Wait(25 + random(50));
end else

It should hit Withdraw-X that way.

Beyond that, I can't see any obvious flaws in it.

~Sandstorm

P.S. - Don't hesitate to pm me if you want some help :).

Edit:

I didn't use your bank array because I didn't want to deposit the nats and one mithril ore, so the array wouldn't work for that. I'm not sure how to modify it correctly, but with the correct modification it should be good to include.

What do you mean by this? Also, I created another function that can skip any item in the inventory (I'll admit, it's a bit slow - that's not my fault though). I can pm you that if you want.

Macros

2008-11-08 19:41:04

Ok, once all the more major problems are sorted out, I'll work on fixing the user-friendly issues such as manually entering coordinates like that.

Finally! Thank you! I've been looking for something along the lines of "GetMousePos(x, y);", I can't try it right no, since my account is busy, away from a bank, but it should work great!

Yea, with the withdraw-x function you can do "withdraw(3,1,20);" except it types in "20" each time, which seems a little inhuman to me since the option to withdraw "20" appears after you type it in once, (and the function still types it in…) I dunno, maybe I'm being a little overly concerned, but….


About that array… Yes, please pm me your new array, the only problem with the old one was that it couldn't skip more than 1 object.

Thanks again!

-Macros

Sandstorm

2008-11-08 19:42:56

You could do this:


Withdraw(3,1,20+random(20));

That should type anything from 20-40. Gimme a sec to pm you it.

Macros

2008-11-08 19:55:46

OK, thanks for this and the pm stuff!

Oh, and can someone who's tried this script please tell me if the mouse speed is indeed too fast? I'm not a SRL member yet, so I don't know what the pro script are like…

-Macros

Sandstorm

2008-11-08 19:57:13

Generally 15 (as declared in SetupSRL) is what's used, but sometimes it's set higher/lower depending on what's needed of it.

Macros

2008-11-09 09:34:38

Does the SCAR scripting language know about catches? If so, what is the syntax?

I'm trying to do something like this:

if FindDTM(MithrilOreDTM, x, y, 670, 285, 710, 315)  //fix coord.'s 
then
begin
end else
withdraw(2,1,1)
end;
end;



Basically if it finds the mithril ore at the desired coordinates, it doesn't do anything and moves on, but if it doesn't…

SirPa

2008-11-09 09:57:10

if FindDTM(MithrilOreDTM, x, y, 670, 285, 710, 315)  //fix coord.'s 
then
begin
withdraw(2,1,1)
end else
Begin
//What to do when it doesnt find the ore
end;
end;

That should work :)

Sandstorm

2008-11-09 10:28:22

if FindDTM(MithrilOreDTM, x, y, 670, 285, 710, 315) Then                                      
withdraw(2,1,1)
else
//What to do when it doesnt find the ore

That's the bare minimum of what would be needed. I've seen people do this, but I've never been sure how they accomplish it, since it always tells me it doesn't work, with an Identifier Expected error.

SirPa

2008-11-09 10:49:33

I did that, but that indeed gives an error when adding more functions (for me)
So always use begin's and end's :p

Macros

2008-11-09 10:50:35

OK, I'll try that, but I think there is a try/catch in SCAR:

From: Method
I think this is the correct syntax:

try
Code;
MoreCode;
except
DoStuff;
finally
ThisIsOptional;
end;


I'll try that too and post the results, but there's an error I'm having atm:

program MithrilSuperheater;
{.include SRL/SRL.scar}
{.include SRL/SRL/skill/magic.scar}

{---------------------------------------------------------------------------]
[ d[-_-]b :: Mithril Superheater :: d[-_-]b ]
[---------------------------------------------------------------------------]
[ Created by: Macros, for Scar 3.15+ and SRL 28+ ]
[ Last Update : 11/8/2008 ]
[ ]
[ 1. Customize the basic setup, and player array. ]
[ 2. Use with Low Detail, Very Bright. ]
[ 3. Equip a Fire Staff. ]
[ 4. Position player in desired bank, (see basic setup). ]
[ 5. Have an adequate amount of Nature Runes in the last inventory space. ]
[ 6. Put any item in the first bank space, mithril ore in the second ]
[ and coal in third, (in the first, (infinity symbol), tab). ]
[ 7. Strongly suggested that you place one Mithril Ore in the twelfth ]
[ inventory spot, (right on top of the Superheat spell). ]
[ 8. Select the client, and hit run! (Oh and make sure you've typed in your ]
[ bank PIN, it doesn't guess them =p ]
[---------------------------------------------------------------------------}

{------------------------------------------------------------------------------]
Basic script setup.
-------------------------------------------------------------------------------}

var
MithrilBarDTM, MithrilOreDTM, CoalDTM, SuperheatDTM,
l, loads, x, y: integer;

const
StartPlayer = 0; //Determines who will play first.
MSpeed = 50; //Speed of the mouse, (higher=faster, recommended 40-60).
DropRandomItems = False; //Drop the items you get from random events, such as gems and coins?

BankName = 'veb'; //Search for "OpenBankQuiet" in the SRL Manual for a list of valid abbreviations.
RandomSkill = 'Prayer'; //Which skill would you like to use Genie Lamps on, (if any are recieved).
CompassDirection = 'S'; //Insert a direction that will show lots of bank windows in your desired bank, (first letter only).
PlayerSuperheats = 25; //How many Mithril Bars would you like to superheat?

Version = '0.21'; //Script version, (don't change).
//YourSRLID = 'Username'; //Your SRL User ID. (for when the script is done)
//YourSRLPass = 'Password'; //Your SRL User Pass. (for when the script is done)

{------------------------------------------------------------------------------]
Declare Players
-------------------------------------------------------------------------------}

procedure DeclarePlayers; //More arrays when script is done...
begin
HowManyPlayers := 1; //Set Number of Players here.
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := StartPlayer;

Players[0].Name := 'Username'; //Username
Players[0].Pass := 'Password'; //Password
Players[0].Nick := 'Nickname'; //3-4 consecutive letters of your user name, (ex: "Nickname" -> "ick").
Players[0].Strings[0] := 'mithril'; //Type of bar, (only use with mithril at the moment).
Players[0].Active := True; //Say, are you going to use this player?
end;

{------------------------------------------------------------------------------]
NO NEED TO CHANGE ANYTHING BELOW THIS LINE... Hit run and post proggies!
[------------------------------------------------------------------------------}

{------------------------------------------------------------------------------]
AntiBan!
[------------------------------------------------------------------------------}

procedure AntiBan;
begin
if not LoggedIn then Exit;
case Random(10) of
1: HoverSkill('Smithing', False);
2: HoverSkill('Magic', False);
end;
end;

{------------------------------------------------------------------------------]
Deposit all except... //NOT IN USE ATM
[------------------------------------------------------------------------------}
{NOTE: Procedure edited by Sandstorm, (originally made by: WT-Fakawi/PPLSUQBAWLZ/Stupid3ooo/Town}

{Description: Deposits from Slot to ToSlot, skipping user defined slots.
vType True = Deposit All. vType False = Deposit one by one.
Any integer is deposit with Deposit X. (except for 5 and 10)}
//Procedure DepositExcept(SlotFrom, SlotTo: Integer; vType: Variant; ItemsToSkip: Array of Integer);

Procedure DepositExcept(SlotFrom, SlotTo: Integer; vType: Variant; ItemsToSkip: Array of Integer);

Var
DepositX: Boolean;
All: Variant;
I, T, x, y: Integer;

Begin
If Not BankScreen Then
Exit;
If vType = 2 Then
srl_Warn('Deposit', '2 now means store per 2, not ''All''', 15);
DepositX := False;
Case VarType(vType) Of
3: Begin
DepositX := Not InIntArray([1, 5, 10], vType);
If vType = 1 Then
All := False
Else
All := True;
End;
11: All := vType;
End;
For I := SlotFrom To SlotTo Do
Begin
If Not ExistsItem(I) Then
Continue;
If not(InIntArray(ItemsToSkip, I)) Then
MouseItem(I, Not All);
If DepositX Then
Begin
ChooseOption('Deposit-X');
T := GetSystemTime;
While (Not FindColor(x, y, 8388608, MCX1, MCY1, MCX2, MCY2)) And (GetSystemTime - T < 3000) Do
Wait(100);
TypeSend(vType);
End Else If VarType(vType) = 3 Then
ChooseOption('Deposit-' + vType)
Else
ChooseOption('Deposit-All');
T := GetSystemTime;
Wait(RandomRange(200, 300));
While ExistsItem(I) And (GetSystemTime - T < 2000) Do
Wait(50);
End;
End;

{------------------------------------------------------------------------------]
"Find" the ore!
[------------------------------------------------------------------------------}

function FindOre(oreType: string; var rx, ry: integer; x1, y1, x2, y2: integer):
boolean;
var
ore, oreColor: integer;
oreMP: TDTMPointDef;
oreSP: array of TDTMPointDef;
oreSkel: TDTM;
begin
case lowercase(oreType) of
'coal': oreColor := 2570553;
'mithril': oreColor := 7425357;
else
begin
writeln('Desired ore type(s) not found!');
exit;
end;
end;
setarraylength(oreSP, 4);

oreMP.x := 580;
oreMP.y := 229;
oreMP.areasize := 1;
oreMP.areashape := 0;
oreMP.color := oreColor;
oreMP.tolerance := 15;

oreSP[0].x := 576;
oreSP[0].y := 227;
oreSP[0].areasize := 1;
oreSP[0].areashape := 0;
oreSP[0].color := 65536;
oreSP[0].tolerance := 0;

oreSP[1].x := 574;
oreSP[1].y := 229;
oreSP[1].areasize := 1;
oreSP[1].areashape := 0;
oreSP[1].color := 65536;
oreSP[1].tolerance := 0;

oreSP[2].x := 563;
oreSP[2].y := 230;
oreSP[2].areasize := 1;
oreSP[2].areashape := 0;
oreSP[2].color := 65536;
oreSP[2].tolerance := 0;

oreSP[3].x := 592;
oreSP[3].y := 227;
oreSP[3].areasize := 1;
oreSP[3].areashape := 0;
oreSP[3].color := 65536;
oreSP[3].tolerance := 0;

oreSkel.MainPoint := oreMP;
oreSkel.SubPoints := oreSP;
ore := AddDTM(oreSkel);

result := findDTM(ore, rx, ry, x1, y1, x2, y2);
end;

{------------------------------------------------------------------------------]
Withdraw ores from the bank.
[------------------------------------------------------------------------------}

procedure WithdrawOres;

begin;
l := 0
if (not (Loggedin)) then exit;
if (not (bankscreen)) then exit;
case lowercase(players[currentplayer].Strings[0]) of
'mithril':
begin
if FindDTM(MithrilOreDTM, x, y, 680, 275, 725, 320) then
begin
writeln('Mithril Ore found in slot 12'); //continues, this is where I'll be adding that try/catch...
end else
begin
if findOre('mithril', x, y, msx1, msy1, msx2, msy2) then
begin
Withdraw(2,1,1); //withdraws one ore, but now I want to move it to inven. slot 12
if FindDTM(MithrilOreDTM, x, y, 555, 205, 600, 250) then
begin
ItemCoords(1); //pretty sure this part will work for moving the ore to slot 12
HoldMouse(x, y, True);
ItemCoords(12);
MMouse(x, y, 5, 5);
GetMousePos(x, y);
ReleaseMouse(x, y, true);
end else
begin
writeln('Can not find Mithril Ore in inventory!');
end;
end else
begin
writeln('Can not find Mithril Ore in bank! (I)');
terminatescript;
end;
end;
end;
begin
if findOre('mithril', x, y, msx1, msy1, msx2, msy2) then
begin
Withdraw(2,1,5);
end else
begin
writeln('Can not find Mithril Ore! (II)');
terminatescript;
end;
end;
wait(100 + random(50));
begin
if findOre('coal', x, y, msx1, msy1, msx2, msy2) then
begin
Withdraw(3,1,10)
Wait(100 + random(50));
Withdraw(3,1,10)
Wait(300 + random(100));
end else
begin
writeln('Can not find Coal!');
terminatescript;
end;
CloseBank;
Wait(50 + random(50));
end;
end;
end;
end;

{------------------------------------------------------------------------------]
Cast the spell: Superheat, (five times).
[------------------------------------------------------------------------------}

procedure CastSuperheat;

var
i: Integer;

begin
i:= 0;
Wait(25 + random(50));
GameTab(7);
//Mouse(740, 180, 5, 5, True);
repeat
if (not (Loggedin)) then exit;
if FindDTM(SuperheatDTM, x, y, 670, 285, 710, 315) then
begin
Mouse(x+2, y, 1, 3, True);
end;
Wait(25 + random(50));
if findOre(players[currentplayer].Strings[0], x, y, MIX1, MIY1, MIX2, MiY2) then
begin
MMouse(x, y, 5, 5);
wait(25 + random(50));
{if IsUpText('ith') then
begin
Mouse(x, y, 5, 5, True);
Wait(1250 + random(250));
i:= i + 1;
end else}
if IsUpText('ith') then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, True);
Wait(1250 + random(250));
i:= i + 1;
end else
begin
Writeln('Incorret uptext.');
exit;
end;
end else
begin
writeln('Can not find ore.');
exit;
end;
until(i >= 5);
AntiBan;
end;


{------------------------------------------------------------------------------]
Load the DTMs.
[------------------------------------------------------------------------------}

procedure LoadDTMs;
begin

MithrilBarDTM := DTMFromString('78DA6394606060106540018E8EF10C3C409A1' +
'188FF0301238823C18006189148200D32839F801A5922D4280109' +
'21026A5488700FC82E7922DCAC845F0D00D9240685');

MithrilOreDTM := DTMFromString('78DA6394626060906040017EFEC50C3C409A1' +
'188FF030123279021CE8006189148202D06243809A8510012DC04' +
'D4A8030901026A948184141176C913502344580D00094106B0');

CoalDTM := DTMFromString('78DA639461606010634001D6561A0C3C409A1' +
'188FF03012337A61A882C8C04D222404280801A0920C149408D3A' +
'90E025420D21F728020979026A2481840A0135203FC9E15703007' +
'76E0674');

SuperheatDTM := DTMFromString('78DA639460606090614001BF2245197880342' +
'310FF0702461C6A18A06AC0B40090906640038CA86A0481841001' +
'359244A85104126204D428010979026A40F24A04D40813560300F' +
'88F08C1');
end;

{------------------------------------------------------------------------------]
Bank the Mithil Bars.
[------------------------------------------------------------------------------}

procedure Bank;
var
time: Integer;
begin
MarkTime(time);
repeat
if (not (Loggedin)) then break;
OpenBankFast(BankName)
until (BankScreen or (TimeFromMark(time) > 100000));
if FindDTM(MithrilBarDTM, x, y, 550, 210, 600, 245) then //FIX coordinates
begin
Deposit(1,5,5);
end else
begin
DepositExcept(1, 27, True, []); //Procedure DepositExcept(SlotFrom, SlotTo: Integer; vType: Variant; ItemsToSkip: Array of Integer);
end;
loads := loads + 1;
end;



{------------------------------------------------------------------------------]
Progress Report.
[------------------------------------------------------------------------------}

procedure ProgressReport;
begin
ClearDebug;
Writeln('Version 0.21 by: Macros, (credits to wtfwtfwtf and Sand Storm as well).');
Writeln('Worked for ' + TimeRunning + '.');
Writeln('Banked ' + inttostr(Loads) + ' time(s).');
end;

{------------------------------------------------------------------------------]
Setup!
[------------------------------------------------------------------------------}

procedure Setup;
begin;
ClearDebug;
SetupSRL;
LoadDTMs;
ActivateClient;
DeclarePlayers;
LoginPlayer;
//SRLID := YourSRLID; (for when the script is done)
//SRLPassword := YourSRLPass; (for when the script is done)
MakeCompass('CompassDirection');
SetAngle(true);
end;

begin
setup;
repeat
OpenBankFast(BankName);
WithdrawOres;
CastSuperheat;
LampSkill := RandomSkill;
FindNormalRandoms;
Bank;
ProgressReport;
until (Loads = (PlayerSuperheats/5));
if (Players[CurrentPlayer].Active = false) then
begin
CloseBank;
LogOut;
terminatescript;
end;
end.


Does anyone know why it's saying there's a syntax error on 242? (I haven't debugged everything else I changed, because It keeps having this problem here, so there might be some minor problems elsewhere, but this is the main one.)

The problem I need help with are in the "Withdraw ores from the bank." procedure, (lines 202-271).

Sandstorm

2008-11-09 10:54:59

You have one to many End;'s before the begin.


program MithrilSuperheater;
{.include SRL/SRL.scar}
{.include SRL/SRL/skill/magic.scar}

{---------------------------------------------------------------------------]
[ d[-_-]b :: Mithril Superheater :: d[-_-]b ]
[---------------------------------------------------------------------------]
[ Created by: Macros, for Scar 3.15+ and SRL 28+ ]
[ Last Update : 11/8/2008 ]
[ ]
[ 1. Customize the basic setup, and player array. ]
[ 2. Use with Low Detail, Very Bright. ]
[ 3. Equip a Fire Staff. ]
[ 4. Position player in desired bank, (see basic setup). ]
[ 5. Have an adequate amount of Nature Runes in the last inventory space. ]
[ 6. Put any item in the first bank space, mithril ore in the second ]
[ and coal in third, (in the first, (infinity symbol), tab). ]
[ 7. Strongly suggested that you place one Mithril Ore in the twelfth ]
[ inventory spot, (right on top of the Superheat spell). ]
[ 8. Select the client, and hit run! (Oh and make sure you've typed in your ]
[ bank PIN, it doesn't guess them =p ]
[---------------------------------------------------------------------------}

{------------------------------------------------------------------------------]
Basic script setup.
-------------------------------------------------------------------------------}

var
MithrilBarDTM, MithrilOreDTM, CoalDTM, SuperheatDTM,
l, loads, x, y: integer;

const
StartPlayer = 0; //Determines who will play first.
MSpeed = 50; //Speed of the mouse, (higher=faster, recommended 40-60).
DropRandomItems = False; //Drop the items you get from random events, such as gems and coins?

BankName = 'veb'; //Search for "OpenBankQuiet" in the SRL Manual for a list of valid abbreviations.
RandomSkill = 'Prayer'; //Which skill would you like to use Genie Lamps on, (if any are recieved).
CompassDirection = 'S'; //Insert a direction that will show lots of bank windows in your desired bank, (first letter only).
PlayerSuperheats = 25; //How many Mithril Bars would you like to superheat?

Version = '0.21'; //Script version, (don't change).
//YourSRLID = 'Username'; //Your SRL User ID. (for when the script is done)
//YourSRLPass = 'Password'; //Your SRL User Pass. (for when the script is done)

{------------------------------------------------------------------------------]
Declare Players
-------------------------------------------------------------------------------}

procedure DeclarePlayers; //More arrays when script is done...
begin
HowManyPlayers := 1; //Set Number of Players here.
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := StartPlayer;

Players[0].Name := 'Username'; //Username
Players[0].Pass := 'Password'; //Password
Players[0].Nick := 'Nickname'; //3-4 consecutive letters of your user name, (ex: "Nickname" -> "ick").
Players[0].Strings[0] := 'mithril'; //Type of bar, (only use with mithril at the moment).
Players[0].Active := True; //Say, are you going to use this player?
end;

{------------------------------------------------------------------------------]
NO NEED TO CHANGE ANYTHING BELOW THIS LINE... Hit run and post proggies!
[------------------------------------------------------------------------------}

{------------------------------------------------------------------------------]
AntiBan!
[------------------------------------------------------------------------------}

procedure AntiBan;
begin
if not LoggedIn then Exit;
case Random(10) of
1: HoverSkill('Smithing', False);
2: HoverSkill('Magic', False);
end;
end;

{------------------------------------------------------------------------------]
Deposit all except... //NOT IN USE ATM
[------------------------------------------------------------------------------}
{NOTE: Procedure edited by Sandstorm, (originally made by: WT-Fakawi/PPLSUQBAWLZ/Stupid3ooo/Town}

{Description: Deposits from Slot to ToSlot, skipping user defined slots.
vType True = Deposit All. vType False = Deposit one by one.
Any integer is deposit with Deposit X. (except for 5 and 10)}
//Procedure DepositExcept(SlotFrom, SlotTo: Integer; vType: Variant; ItemsToSkip: Array of Integer);

Procedure DepositExcept(SlotFrom, SlotTo: Integer; vType: Variant; ItemsToSkip: Array of Integer);

Var
DepositX: Boolean;
All: Variant;
I, T, x, y: Integer;

Begin
If Not BankScreen Then
Exit;
If vType = 2 Then
srl_Warn('Deposit', '2 now means store per 2, not ''All''', 15);
DepositX := False;
Case VarType(vType) Of
3: Begin
DepositX := Not InIntArray([1, 5, 10], vType);
If vType = 1 Then
All := False
Else
All := True;
End;
11: All := vType;
End;
For I := SlotFrom To SlotTo Do
Begin
If Not ExistsItem(I) Then
Continue;
If not(InIntArray(ItemsToSkip, I)) Then
MouseItem(I, Not All);
If DepositX Then
Begin
ChooseOption('Deposit-X');
T := GetSystemTime;
While (Not FindColor(x, y, 8388608, MCX1, MCY1, MCX2, MCY2)) And (GetSystemTime - T < 3000) Do
Wait(100);
TypeSend(vType);
End Else If VarType(vType) = 3 Then
ChooseOption('Deposit-' + vType)
Else
ChooseOption('Deposit-All');
T := GetSystemTime;
Wait(RandomRange(200, 300));
While ExistsItem(I) And (GetSystemTime - T < 2000) Do
Wait(50);
End;
End;

{------------------------------------------------------------------------------]
"Find" the ore!
[------------------------------------------------------------------------------}

function FindOre(oreType: string; var rx, ry: integer; x1, y1, x2, y2: integer):
boolean;
var
ore, oreColor: integer;
oreMP: TDTMPointDef;
oreSP: array of TDTMPointDef;
oreSkel: TDTM;
begin
case lowercase(oreType) of
'coal': oreColor := 2570553;
'mithril': oreColor := 7425357;
else
begin
writeln('Desired ore type(s) not found!');
exit;
end;
end;
setarraylength(oreSP, 4);

oreMP.x := 580;
oreMP.y := 229;
oreMP.areasize := 1;
oreMP.areashape := 0;
oreMP.color := oreColor;
oreMP.tolerance := 15;

oreSP[0].x := 576;
oreSP[0].y := 227;
oreSP[0].areasize := 1;
oreSP[0].areashape := 0;
oreSP[0].color := 65536;
oreSP[0].tolerance := 0;

oreSP[1].x := 574;
oreSP[1].y := 229;
oreSP[1].areasize := 1;
oreSP[1].areashape := 0;
oreSP[1].color := 65536;
oreSP[1].tolerance := 0;

oreSP[2].x := 563;
oreSP[2].y := 230;
oreSP[2].areasize := 1;
oreSP[2].areashape := 0;
oreSP[2].color := 65536;
oreSP[2].tolerance := 0;

oreSP[3].x := 592;
oreSP[3].y := 227;
oreSP[3].areasize := 1;
oreSP[3].areashape := 0;
oreSP[3].color := 65536;
oreSP[3].tolerance := 0;

oreSkel.MainPoint := oreMP;
oreSkel.SubPoints := oreSP;
ore := AddDTM(oreSkel);

result := findDTM(ore, rx, ry, x1, y1, x2, y2);
end;

{------------------------------------------------------------------------------]
Withdraw ores from the bank.
[------------------------------------------------------------------------------}

procedure WithdrawOres;

begin;
l := 0
if (not (Loggedin)) then exit;
if (not (bankscreen)) then exit;
case lowercase(players[currentplayer].Strings[0]) of
'mithril':
begin
if FindDTM(MithrilOreDTM, x, y, 680, 275, 725, 320) then
begin
writeln('Mithril Ore found in slot 12'); //continues, this is where I'll be adding that try/catch...
end else
begin
if findOre('mithril', x, y, msx1, msy1, msx2, msy2) then
begin
Withdraw(2,1,1); //withdraws one ore, but now I want to move it to inven. slot 12
if FindDTM(MithrilOreDTM, x, y, 555, 205, 600, 250) then
begin
ItemCoords(1); //pretty sure this part will work for moving the ore to slot 12
HoldMouse(x, y, True);
ItemCoords(12);
MMouse(x, y, 5, 5);
GetMousePos(x, y);
ReleaseMouse(x, y, true);
end else
begin
writeln('Can not find Mithril Ore in inventory!');
end;
end else
begin
writeln('Can not find Mithril Ore in bank! (I)');
terminatescript;
end;
end;
begin
if findOre('mithril', x, y, msx1, msy1, msx2, msy2) then
begin
Withdraw(2,1,5);
end else
begin
writeln('Can not find Mithril Ore! (II)');
terminatescript;
end;
end;
wait(100 + random(50));
begin
if findOre('coal', x, y, msx1, msy1, msx2, msy2) then
begin
Withdraw(3,1,10)
Wait(100 + random(50));
Withdraw(3,1,10)
Wait(300 + random(100));
end else
begin
writeln('Can not find Coal!');
terminatescript;
end;
CloseBank;
Wait(50 + random(50));
end;
end;
end;
end;

{------------------------------------------------------------------------------]
Cast the spell: Superheat, (five times).
[------------------------------------------------------------------------------}

procedure CastSuperheat;

var
i: Integer;

begin
i:= 0;
Wait(25 + random(50));
GameTab(7);
//Mouse(740, 180, 5, 5, True);
repeat
if (not (Loggedin)) then exit;
if FindDTM(SuperheatDTM, x, y, 670, 285, 710, 315) then
begin
Mouse(x+2, y, 1, 3, True);
end;
Wait(25 + random(50));
if findOre(players[currentplayer].Strings[0], x, y, MIX1, MIY1, MIX2, MiY2) then
begin
MMouse(x, y, 5, 5);
wait(25 + random(50));
{if IsUpText('ith') then
begin
Mouse(x, y, 5, 5, True);
Wait(1250 + random(250));
i:= i + 1;
end else}
if IsUpText('ith') then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, True);
Wait(1250 + random(250));
i:= i + 1;
end else
begin
Writeln('Incorret uptext.');
exit;
end;
end else
begin
writeln('Can not find ore.');
exit;
end;
until(i >= 5);
AntiBan;
end;


{------------------------------------------------------------------------------]
Load the DTMs.
[------------------------------------------------------------------------------}

procedure LoadDTMs;
begin

MithrilBarDTM := DTMFromString('78DA6394606060106540018E8EF10C3C409A1' +
'188FF0301238823C18006189148200D32839F801A5922D4280109' +
'21026A5488700FC82E7922DCAC845F0D00D9240685');

MithrilOreDTM := DTMFromString('78DA6394626060906040017EFEC50C3C409A1' +
'188FF030123279021CE8006189148202D06243809A8510012DC04' +
'D4A8030901026A948184141176C913502344580D00094106B0');

CoalDTM := DTMFromString('78DA639461606010634001D6561A0C3C409A1' +
'188FF03012337A61A882C8C04D222404280801A0920C149408D3A' +
'90E025420D21F728020979026A2481840A0135203FC9E15703007' +
'76E0674');

SuperheatDTM := DTMFromString('78DA639460606090614001BF2245197880342' +
'310FF0702461C6A18A06AC0B40090906640038CA86A0481841001' +
'359244A85104126204D428010979026A40F24A04D40813560300F' +
'88F08C1');
end;

{------------------------------------------------------------------------------]
Bank the Mithil Bars.
[------------------------------------------------------------------------------}

procedure Bank;
var
time: Integer;
begin
MarkTime(time);
repeat
if (not (Loggedin)) then break;
OpenBankFast(BankName)
until (BankScreen or (TimeFromMark(time) > 100000));
if FindDTM(MithrilBarDTM, x, y, 550, 210, 600, 245) then //FIX coordinates
begin
Deposit(1,5,5);
end else
begin
DepositExcept(1, 27, True, []); //Procedure DepositExcept(SlotFrom, SlotTo: Integer; vType: Variant; ItemsToSkip: Array of Integer);
end;
loads := loads + 1;
end;



{------------------------------------------------------------------------------]
Progress Report.
[------------------------------------------------------------------------------}

procedure ProgressReport;
begin
ClearDebug;
Writeln('Version 0.21 by: Macros, (credits to wtfwtfwtf and Sand Storm as well).');
Writeln('Worked for ' + TimeRunning + '.');
Writeln('Banked ' + inttostr(Loads) + ' time(s).');
end;

{------------------------------------------------------------------------------]
Setup!
[------------------------------------------------------------------------------}

procedure Setup;
begin;
ClearDebug;
SetupSRL;
LoadDTMs;
ActivateClient;
DeclarePlayers;
LoginPlayer;
//SRLID := YourSRLID; (for when the script is done)
//SRLPassword := YourSRLPass; (for when the script is done)
MakeCompass('CompassDirection');
SetAngle(true);
end;

begin
setup;
repeat
OpenBankFast(BankName);
WithdrawOres;
CastSuperheat;
LampSkill := RandomSkill;
FindNormalRandoms;
Bank;
ProgressReport;
until (Loads = (PlayerSuperheats/5));
if (Players[CurrentPlayer].Active = false) then
begin
CloseBank;
LogOut;
terminatescript;
end;
end.

SirPa

2008-11-09 10:57:32

EDIT:

Gah Sand beat me too it :p

Macros

2008-11-09 11:10:21

OK thanks, (silly that =p). As far as try/catches go, I don't think I'll use one, as it may actually result in more code in this circumstance… New question: How do you click on an item in the inventory, (slot 1), and drag it somewhere else, (slot 12), and then release the left mouse button? This is what I have right now, but it doesn't work…

if FindDTM(MithrilOreDTM, x, y, 555, 205, 600, 250) then
begin
ItemCoords(1);
HoldMouse(x, y, True);
ItemCoords(12);
MMouse(x, y, 5, 5);
GetMousePos(x, y);
ReleaseMouse(x, y, true);
end else
begin
writeln('Can not find Mithril Ore in inventory!');
end;

Sandstorm

2008-11-09 11:13:54

DragItem(1, 12);

:).

Macros

2008-11-09 11:33:02

Wow that was easy! Thanks again… And here is the latest (v. 0.22) script:

program MithrilSuperheater;
{.include SRL/SRL.scar}
{.include SRL/SRL/skill/magic.scar}

{---------------------------------------------------------------------------]
[ d[-_-]b :: Mithril Superheater :: d[-_-]b ]
[---------------------------------------------------------------------------]
[ Created by: Macros, for Scar 3.15+ and SRL 28+ ]
[ Last Update : 11/8/2008 ]
[ ]
[ 1. Customize the basic setup, and player array. ]
[ 2. Use with Low Detail, Very Bright. ]
[ 3. Equip a Fire Staff. ]
[ 4. Position player in desired bank, (see basic setup). ]
[ 5. Have an adequate amount of Nature Runes in the last inventory space. ]
[ 6. Put any item in the first bank space, mithril ore in the second ]
[ and coal in third, (in the first, (infinity symbol), tab). ]
[ 7. Select the client, and hit run! (Oh and make sure you've typed in your ]
[ bank PIN, it doesn't guess them =p ]
[---------------------------------------------------------------------------}

{------------------------------------------------------------------------------]
Basic script setup.
-------------------------------------------------------------------------------}

var
MithrilBarDTM, MithrilOreDTM, CoalDTM, SuperheatDTM,
l, loads, x, y: integer;

const
StartPlayer = 0; //Determines who will play first.
MSpeed = 50; //Speed of the mouse, (higher=faster, recommended 40-60).
DropRandomItems = False; //Drop the items you get from random events, such as gems and coins?

BankName = 'veb'; //Search for "OpenBankQuiet" in the SRL Manual for a list of valid abbreviations.
RandomSkill = 'Prayer'; //Which skill would you like to use Genie Lamps on, (if any are recieved).
CompassDirection = 'S'; //Insert a direction that will show lots of bank windows in your desired bank, (first letter only).
PlayerSuperheats = 25; //How many Mithril Bars would you like to superheat?

Version = '0.22'; //Script version, (don't change).
//YourSRLID = 'Username'; //Your SRL User ID. (for when the script is done)
//YourSRLPass = 'Password'; //Your SRL User Pass. (for when the script is done)

{------------------------------------------------------------------------------]
Declare Players
-------------------------------------------------------------------------------}

procedure DeclarePlayers; //More arrays when script is done...
begin
HowManyPlayers := 1; //Set Number of Players here.
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := StartPlayer;

Players[0].Name := 'Username'; //Username
Players[0].Pass := 'Password'; //Password
Players[0].Nick := 'Nickname'; //3-4 consecutive letters of your user name, (ex: "Nickname" -> "ick").
Players[0].Strings[0] := 'mithril'; //Type of bar, (only use with mithril at the moment).
Players[0].Active := True; //Say, are you going to use this player?
end;

{------------------------------------------------------------------------------]
NO NEED TO CHANGE ANYTHING BELOW THIS LINE... Hit run and post proggies!
[------------------------------------------------------------------------------}

{------------------------------------------------------------------------------]
AntiBan!
[------------------------------------------------------------------------------}

procedure AntiBan;
begin
if not LoggedIn then Exit;
case Random(10) of
1: HoverSkill('Smithing', False);
2: HoverSkill('Magic', False);
end;
end;

{------------------------------------------------------------------------------]
Deposit all except...
[------------------------------------------------------------------------------}
{NOTE: Procedure edited by Sandstorm, (originally made by: WT-Fakawi/PPLSUQBAWLZ/Stupid3ooo/Town}

{Description: Deposits from Slot to ToSlot, skipping user defined slots.
vType True = Deposit All. vType False = Deposit one by one.
Any integer is deposit with Deposit X. (except for 5 and 10)}

//Procedure DepositExcept(SlotFrom, SlotTo: Integer; vType: Variant; ItemsToSkip: Array of Integer);

Procedure DepositExcept(SlotFrom, SlotTo: Integer; vType: Variant; ItemsToSkip: Array of Integer);

Var
DepositX: Boolean;
All: Variant;
I, T, x, y: Integer;

Begin
If Not BankScreen Then
Exit;
If vType = 2 Then
srl_Warn('Deposit', '2 now means store per 2, not ''All''', 15);
DepositX := False;
Case VarType(vType) Of
3: Begin
DepositX := Not InIntArray([1, 5, 10], vType);
If vType = 1 Then
All := False
Else
All := True;
End;
11: All := vType;
End;
For I := SlotFrom To SlotTo Do
Begin
If Not ExistsItem(I) Then
Continue;
If not(InIntArray(ItemsToSkip, I)) Then
MouseItem(I, Not All);
If DepositX Then
Begin
ChooseOption('Deposit-X');
T := GetSystemTime;
While (Not FindColor(x, y, 8388608, MCX1, MCY1, MCX2, MCY2)) And (GetSystemTime - T < 3000) Do
Wait(100);
TypeSend(vType);
End Else If VarType(vType) = 3 Then
ChooseOption('Deposit-' + vType)
Else
ChooseOption('Deposit-All');
T := GetSystemTime;
Wait(RandomRange(200, 300));
While ExistsItem(I) And (GetSystemTime - T < 2000) Do
Wait(50);
End;
End;

{------------------------------------------------------------------------------]
"Find" the ore!
[------------------------------------------------------------------------------}

function FindOre(oreType: string; var rx, ry: integer; x1, y1, x2, y2: integer):
boolean;
var
ore, oreColor: integer;
oreMP: TDTMPointDef;
oreSP: array of TDTMPointDef;
oreSkel: TDTM;
begin
case lowercase(oreType) of
'coal': oreColor := 2570553;
'mithril': oreColor := 7425357;
else
begin
writeln('Desired ore type(s) not found!');
exit;
end;
end;
setarraylength(oreSP, 4);

oreMP.x := 580;
oreMP.y := 229;
oreMP.areasize := 1;
oreMP.areashape := 0;
oreMP.color := oreColor;
oreMP.tolerance := 15;

oreSP[0].x := 576;
oreSP[0].y := 227;
oreSP[0].areasize := 1;
oreSP[0].areashape := 0;
oreSP[0].color := 65536;
oreSP[0].tolerance := 0;

oreSP[1].x := 574;
oreSP[1].y := 229;
oreSP[1].areasize := 1;
oreSP[1].areashape := 0;
oreSP[1].color := 65536;
oreSP[1].tolerance := 0;

oreSP[2].x := 563;
oreSP[2].y := 230;
oreSP[2].areasize := 1;
oreSP[2].areashape := 0;
oreSP[2].color := 65536;
oreSP[2].tolerance := 0;

oreSP[3].x := 592;
oreSP[3].y := 227;
oreSP[3].areasize := 1;
oreSP[3].areashape := 0;
oreSP[3].color := 65536;
oreSP[3].tolerance := 0;

oreSkel.MainPoint := oreMP;
oreSkel.SubPoints := oreSP;
ore := AddDTM(oreSkel);

result := findDTM(ore, rx, ry, x1, y1, x2, y2);
end;

{------------------------------------------------------------------------------]
Withdraw ores from the bank.
[------------------------------------------------------------------------------}

procedure WithdrawOres;

begin;
l := 0
if (not (Loggedin)) then exit;
if (not (bankscreen)) then exit;
case lowercase(players[currentplayer].Strings[0]) of
'mithril':
begin
if FindDTM(MithrilOreDTM, x, y, 680, 275, 725, 320) then
begin
writeln('Mithril Ore found in slot 12');
end else
begin
if findOre('mithril', x, y, msx1, msy1, msx2, msy2) then
begin
Withdraw(2,1,1);
wait(1000 + random(50));
if FindDTM(MithrilOreDTM, x, y, 555, 205, 600, 250) then
begin
DragItem(1, 12);
end else
begin
writeln('Can not find Mithril Ore in inventory!');
end;
end else
begin
writeln('Can not find Mithril Ore in bank! (I)');
terminatescript;
end;
end;
begin
if findOre('mithril', x, y, msx1, msy1, msx2, msy2) then
begin
Withdraw(2,1,5);
end else
begin
writeln('Can not find Mithril Ore! (II)');
terminatescript;
end;
end;
wait(100 + random(50));
begin
if findOre('coal', x, y, msx1, msy1, msx2, msy2) then
begin
Withdraw(3,1,10)
Wait(100 + random(50));
Withdraw(3,1,10)
Wait(300 + random(100));
end else
begin
writeln('Can not find Coal!');
terminatescript;
end;
CloseBank;
Wait(50 + random(50));
end;
end;
end;
end;

{------------------------------------------------------------------------------]
Cast the spell: Superheat, (five times).
[------------------------------------------------------------------------------}

procedure CastSuperheat;

var
i: Integer;

begin
i:= 0;
Wait(25 + random(50));
GameTab(7);
repeat
if (not (Loggedin)) then exit;
if FindDTM(SuperheatDTM, x, y, 670, 285, 710, 315) then
begin
Mouse(x+2, y, 1, 3, True);
end;
Wait(25 + random(50));
if findOre(players[currentplayer].Strings[0], x, y, MIX1, MIY1, MIX2, MiY2) then
begin
MMouse(x, y, 5, 5);
wait(25 + random(50));
if IsUpText('ith') then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, True);
Wait(1250 + random(250));
i:= i + 1;
end else
begin
Writeln('Incorret uptext.');
exit;
end;
end else
begin
writeln('Can not find ore.');
exit;
end;
until(i >= 5);
AntiBan;
end;


{------------------------------------------------------------------------------]
Load the DTMs.
[------------------------------------------------------------------------------}

procedure LoadDTMs;
begin

MithrilBarDTM := DTMFromString('78DA6394606060106540018E8EF10C3C409A1' +
'188FF0301238823C18006189148200D32839F801A5922D4280109' +
'21026A5488700FC82E7922DCAC845F0D00D9240685');

MithrilOreDTM := DTMFromString('78DA6394626060906040017EFEC50C3C409A1' +
'188FF030123279021CE8006189148202D06243809A8510012DC04' +
'D4A8030901026A948184141176C913502344580D00094106B0');

CoalDTM := DTMFromString('78DA639461606010634001D6561A0C3C409A1' +
'188FF03012337A61A882C8C04D222404280801A0920C149408D3A' +
'90E025420D21F728020979026A2481840A0135203FC9E15703007' +
'76E0674');

SuperheatDTM := DTMFromString('78DA639460606090614001BF2245197880342' +
'310FF0702461C6A18A06AC0B40090906640038CA86A0481841001' +
'359244A85104126204D428010979026A40F24A04D40813560300F' +
'88F08C1');
end;

{------------------------------------------------------------------------------]
Bank the Mithil Bars.
[------------------------------------------------------------------------------}

procedure Bank;
var
time: Integer;
begin
MarkTime(time);
repeat
if (not (Loggedin)) then break;
OpenBankFast(BankName)
until (BankScreen or (TimeFromMark(time) > 100000));
if FindDTM(MithrilBarDTM, x, y, 550, 210, 600, 245) then
begin
Deposit(1,5,5);
end else
begin
DepositExcept(1, 27, True, []);
end;
loads := loads + 1;
end;



{------------------------------------------------------------------------------]
Progress Report.
[------------------------------------------------------------------------------}

procedure ProgressReport;
begin
ClearDebug;
Writeln('Version 0.22 by: Macros, (credits to wtfwtfwtf and Sand Storm as well).');
Writeln('Worked for ' + TimeRunning + '.');
Writeln('Banked ' + inttostr(Loads) + ' time(s).');
end;

{------------------------------------------------------------------------------]
Setup!
[------------------------------------------------------------------------------}

procedure Setup;
begin;
ClearDebug;
SetupSRL;
LoadDTMs;
ActivateClient;
DeclarePlayers;
LoginPlayer;
//SRLID := YourSRLID; (for when the script is done)
//SRLPassword := YourSRLPass; (for when the script is done)
MakeCompass('CompassDirection');
SetAngle(true);
end;

begin
setup;
repeat
OpenBankFast(BankName);
WithdrawOres;
CastSuperheat;
LampSkill := RandomSkill;
FindNormalRandoms;
Bank;
ProgressReport;
until (Loads = (PlayerSuperheats/5));
if (Players[CurrentPlayer].Active = false) then
//begin //doesn't seem to logout/close bank with these?!
CloseBank;
LogOut;
terminatescript;
//end;
end.


Next step: Add fail-safes for the coal in the inventory, like the mithril has, and maybe some more anitban, (you can never have enough of that stuff =p).

PS, It's fun to screw with the script as it tries to superheat, love it when it fixes itself :p It's made over 600 bars for me now…

PPS, someone "needs" this comp right now, so I'll be back in a bit to respond etc

Macros

2008-11-09 14:45:31

I'm thinking of moving this thread to the SRL Junior Members - Smithing section… There aren't many Superheaters out there, and a quick search revealed that Superheaters are very often asked for in the request a script section…

Does that sound OK with you guys?
(I would move it in a day or two, after I make a few more sweet updates.)

PS, the latest version works with S.M.A.R.T. Just discovered that… It's sweet! =p

EDIT: It's probably not quite ready yet, but soon…

EliteHacker

2008-11-09 22:56:49

Nice Script. Too bad i don't have the smith lvl :(
Oh well!


\±/EliteHacker\±/

Aser

2008-11-29 03:31:08

Version 0.22 by: Macros, (credits to wtfwtfwtf and Sand Storm as well).
Worked for 20 Minutes and 16 Seconds.
Banked 46 time(s).
Mithril Ore found in slot 12

Worked great.

Somethings to consider…
The banking was pretty good except for…
when it withdrew the coal it withdrew 10 2 times. I would try to make it withdraw x then input 20… then use the withdraw 20 option the next time

you might also try withdrawing "all coal" before depositing the mith, then withdraw 5 mith

… when you had it bank… every time it would go to the inventory slot first and then have to switch back to the spell page when it was done… You don't need to do this… it swiches to inv slot automaticly when you are in bank and then it switches back when exited.

also when it banked it had to search around a bit every time and that looked really fake.

Overall I really liked it and it was the only Superheater I could get to work so thank you very much!

Macros

2008-12-03 18:09:10

Sorry fo the late response, but thanks for the suggestions/proggy!

I've fixed a few problems you mentioned already, such as switching to the inventory tab before you bank, (that was because it was searching for randoms then, but I've moved the random search to a less noticeable place now)…

Also thanks for the suggestions regarding withdrawing the coal. Originally I did it this way because it was suspicious that it had to type in "20" each time with that function, however I have since learned more about SCAR/SRL and I'll insert an If statement or something to fix that.

About that banking being suspicious/having to search a lot, what exactly do you witness/mean by this? I'm not sure I'm seeing what you are.

Glad it worked for you!
-Macros

I also have a much better version at the moment, that I was saving for SRL Jr Members eventually. It includes much better fail-safes, a lot more anti-ban, more descriptive proggies, runs smoother, works with SMART if you want etc. I'm working on an auto-talker currently.