SRL Archive - First Scripts

Fire RuneCrafter w\ rings of duelling teleport


maigel

2012-01-21 20:27:54


Maigel's FireCrafter


Description:
Crafts fire runes in al kharid using ring of duelling to teleport between the duel arena and castle wars.

Setup:
Change the constants and players in the script:

const
EssenceTab = 2; // The bank tab your essence is stored on
EssenceSlot = 3; // The bank slot your essence is stored on
RingTab = 2; // The bank tab your rings of duelling are stored on
RingSlot = 14; // The bank slot your rings of duelling are stored on
Num[B][/B]OfPouches = 1; // The number of essence pouches you are using
Bank:
Red = Tab
Green = Slot

Inventory:
Have your pouches in the first slots of your inventory

Equip:
Make sure a fire tiara is equipped

Location:
Start your toon in front of castle wars bank and make sure the chest is visible

Known Bugs & Future updates:
Bugs:
  • It will sometimes say "Ran out of rings of duelling / essence" when it's not the case, this is however a SRL issue, so no script related.

Future updates:
  • Auto detect pouches
  • Support multiple players
  • Forms

Change log:

v1.1:
- Improved autocolor on the altar once more, I hope this fixes it :/
- Added SRL stats support
- Added a "lost" function, if it gets lost it will try to teleport to castle wars and find it's way again. If this fails it logs out.

v1.0.3 - 28 views:
- Improved the autocolor, it should be way more accurate now
- The script no longer keeps running (and bugging) when out of rings / essence
- Replaced my custom "open bank chest" function with SRL's built in one

v1.0.2 - 6 views:
- Changed fixed colors by autocolor

v1.0:
- Initial release

maigel

2012-01-21 20:28:54

Progress Reports:


*********************************************
Maigel's Fire Runecrafter
*********************************************
Ran for: 04:45:16
*********************************************
Player: ....
Experience Gained: 55034
Essence Crafted: 7862
*********************************************

From: Giant Panda
*********************************************
Maigel's Fire Runecrafter
*********************************************
Ran for: 02:59:16
Great script that! only had to pause and manual a couple times to get it going again :)

*********************************************
Player: ***
Experience Gained: 33971
Essence Crafted: 4853
*********************************************
Ran out of rings of duelling

Scaper

2012-01-21 21:26:18

Nice release for a first script

Think this script would get you member access, promising new comer if you ask me :)

AProAdrax

2012-01-22 00:38:21

for some reason you have to have atlease one pouch for the script to work(tries to fill pouches that aren't there).. I dont have any pouches though. Can you fix it to use no pouches?:)

AProAdrax

2012-01-22 01:11:26

Ok, I just went ahead and got me a small pouch from the zamorak mage mini quest and now this script is working flawlessly!!:P

maigel

2012-01-22 07:29:36

From: Scaper
Nice release for a first script

Think this script would get you member access, promising new comer if you ask me :)


Hehe, thanks :) Well I'm a college computer science student and I'm pretty familiar with some other languages. So the step to simba wasn't that hard :)

From: AProAdrax
for some reason you have to have atlease one pouch for the script to work(tries to fill pouches that aren't there).. I dont have any pouches though. Can you fix it to use no pouches?

Doh, I didn't even think of that >.> I'll fix it asap :)

EDIT:
Fixed the "No pouch" bug, if you don't wish to use pouches just set NumOfPouches = 0 and it should work.

NexPB

2012-01-22 10:14:01

Realy nice release and well coded man! Gz on this.

Poppee

2012-01-22 10:59:18

Doesnt click on altar.

Sin

2012-01-22 11:01:07

Aww I was going to do this :c

maigel

2012-01-22 11:14:16

From: Poppee
Doesnt click on altar.


Could you explain this a bit more detailed?
Does it fail at clicking the mysterious ruins (the orange stone thing) or the actual altar inside for crafting?
If it fails at the mysterious ruins make sure you have a fire tiara equipped.

Poppee

2012-01-22 11:19:40

Inside altar..

maigel

2012-01-22 11:29:00

What does the console output say?
(Screenshot might help too)

Poppee

2012-01-22 11:32:27

Doesnt say anything nor errors.

Just wont click on it. / standing next to it

anth_

2012-01-22 12:17:03

From: maigel
What does the console output say?
(Screenshot might help too)


It's just when searching for the altar, for some reason the colour doesn't work - I used 6380896 and it worked for me :)

anth_

2012-01-22 12:20:19

From: divina commedia
It's just when searching for the altar, for some reason the colour doesn't work - I used 6380896 and it worked for me :)


The colour has changed again, 6117723 works for me.

justleveling

2012-01-22 12:48:30

nvm just saw date

maigel

2012-01-22 13:00:42

From: divina commedia
The colour has changed again, 6117723 works for me.


I see. I'll take a look into this. I wanted to use autocolor but ACA wasn't detecting the color for some reason.
Thanks for the report :)

Poppee

2012-01-22 13:17:54

Works now ?

anth_

2012-01-22 13:21:46

From: maigel
I see. I'll take a look into this. I wanted to use autocolor but ACA wasn't detecting the color for some reason.
Thanks for the report :)


Doesn't the game code change every so often now in terms of colours and such? You know more than I do though :P

Bnagy

2012-01-22 13:22:58

From: divina commedia
The colour has changed again, 6117723 works for me.


It's not working anymore new color?

Bnagy

2012-01-22 13:28:32

All it does it search for altar over and over… Any fix?

oligofren

2012-01-22 14:25:08

From: Poppee
Doesnt click on altar.


the same happened to me, after updating colors it ran really well
autocoloring should solve this problem

Bnagy

2012-01-22 15:00:20

How do you update the colors?? lso is it working or still bugging out?? Cause i cant get it to craft the fires still.

maigel

2012-01-22 16:23:02

I managed to get the autocolor for the altar working. The script should be working again.
I'll pop in an autocolor function for the rest of the colors in tommorow.

Bnagy

2012-01-22 16:50:34

For some reason it seems to mess up in random spots… it just goes through the dtms saying.

DTM 0 not found
DTM 1 not found
etc….

That is when teleporting back.

Another one was when trying to enter the mysterious ruins I got

DTM 0 over and over again


EDIT : Now this happens when at the altar

AutoColor failed in finding the color.
TPA 0 = 70
TPA 1 = 68
TPA 2 = 60
TPA 3 = 50
TPA 4 = 44
TPA 5 = 39
TPA 6 = 32
TPA 7 = 6
TPA 8 = 5
TPA 9 = 1
Searching for altar
AutoColor failed in finding the color.
TPA 0 = 70
TPA 1 = 68
TPA 2 = 60
TPA 3 = 50
TPA 4 = 44
TPA 5 = 39

maigel

2012-01-22 16:56:30

From: Bnagy
For some reason it seems to mess up in random spots… it just goes through the dtms saying.

DTM 0 not found
DTM 1 not found
etc….

That is when teleporting back.

Another one was when trying to enter the mysterious ruins I got

DTM 0 over and over again



The first one when teleporting back is normal, it's because sometimes if a person stands in the way at castle wars it fails to find this. To counter this I added 5 DTMs to make sure atleast one works.

The second one i'll have to take a closer look at tommorow

Bnagy

2012-01-22 19:57:20

This happens at the altar

AutoColor failed in finding the color.
TPA 0 = 70
TPA 1 = 68
TPA 2 = 60
TPA 3 = 50
TPA 4 = 44
TPA 5 = 39
TPA 6 = 32
TPA 7 = 6
TPA 8 = 5
TPA 9 = 1
Searching for altar
AutoColor failed in finding the color.
TPA 0 = 70
TPA 1 = 68
TPA 2 = 60
TPA 3 = 50
TPA 4 = 44
TPA 5 = 39

madmatt9797

2012-01-23 09:52:55

From: Bnagy
For some reason it seems to mess up in random spots… it just goes through the dtms saying.

DTM 0 not found
DTM 1 not found
etc….

That is when teleporting back.

Another one was when trying to enter the mysterious ruins I got

DTM 0 over and over again


EDIT : Now this happens when at the altar

AutoColor failed in finding the color.
TPA 0 = 70
TPA 1 = 68
TPA 2 = 60
TPA 3 = 50
TPA 4 = 44
TPA 5 = 39
TPA 6 = 32
TPA 7 = 6
TPA 8 = 5
TPA 9 = 1
Searching for altar
AutoColor failed in finding the color.
TPA 0 = 70
TPA 1 = 68
TPA 2 = 60
TPA 3 = 50
TPA 4 = 44
TPA 5 = 39
I get the exact same problem

Poppee

2012-01-23 12:07:43

Seems to work fine. +1

Just randoms messes up.



Im getting ~~12k/h

V V V V V V V V

illuminatiswag

2012-01-23 12:18:32

Whats xp an hour with this anyone know

maigel

2012-01-23 12:32:51

For the altar "AutoColor failed in finding the color." problems: The autocolor didn't have enough different colors in it, I improved it in the new version. V1.0.3 should fix this problem.

From: illuminatiswag
Whats xp an hour with this anyone know

I was averaging about 12K / hour with small + medium pouch

madmatt9797

2012-01-23 14:23:38

Works great , at the beginning it was glitching out while trying to enter the altar.. but i just paused it for a sec and fixed it and its been working perfect for an hour now. got me from 24-35 runecrafting.

eXoTiK

2012-01-23 15:05:20

Seems to be running smoothly. I opted out of using pouches - they degrade - figured it would mess the script up when they disappeared. Seem to be getting 12-13k/hr, not bad.

maigel

2012-01-23 15:53:52

From: eXoTiK
Seems to be running smoothly. I opted out of using pouches - they degrade - figured it would mess the script up when they disappeared. Seem to be getting 12-13k/hr, not bad.

Yea, atm it does start going crazy if a pouch degrades during runtime. I'll be implementing an auto pouch detect function in the future to prevent this though. (I'm having some problems with getting DTMs to detect them since I can only use small and medium pouches atm :/)

Kasi

2012-01-23 17:40:50

try applying for Members with this if your feeling confident :)

maigel

2012-01-23 18:28:15

From: pur3b100d
try applying for Members with this if your feeling confident :)


Yea I will, soon. :) Right now I'm in the middle of college exams so I wouldn't really have time for that stuff anyway. In about 2 weeks I'll have all the time in the world :D.
Would be kinda stupid to apply and then not have to time to respond or contribute in anyway ^^

Bnagy

2012-01-23 18:49:16

So for some reason when trying to go into the ruins I still get an error and it just runs through the dtms over and over… Does it matter that I'm wearing a training bow or lvl 3?? I cant think of why else it would be bugging out on me

Poppee

2012-01-24 04:49:06

Now starting to withdraw more than 1 duel rings and using them..
And sometimes keeps fire runes with it.

Not due lag or whatsoever. / no errors.

But great script anyway +1 (=


EDIT


TPA 1 = 41
TPA 2 = 37
TPA 3 = 1
Searching for altar
Failed to find the color, no result.
TPA 0 = 71
TPA 1 = 41
TPA 2 = 37
TPA 3 = 1


Doesnt find altar.





Fair enough =)
V

maigel

2012-01-24 08:32:14


Now starting to withdraw more than 1 duel rings and using them..
And sometimes keeps fire runes with it.

The inventory positions for the runes and rings are hardcoded (based on the amount of pouches used). This means that if you start the script with a ring already in your inventory, it will start screwing up since the slots are messed up.
I will, however, make it auto detect whether a ring / fire runes are there or not which should fix this problem. (in a future update)
That autocolor on the altar is really being a bitch >.< I'll look into it tonight

Edit:
I upped the tolerance on the autocolor function for the altar a bit (see new v1.1). This will hopefully fix the "Failed to find the color, no result." error. (I've been testing it for more then an hour now with multiple relogs and it hasn't failed so far)

Helper

2012-01-24 23:19:44

need it but not member to :/

Poppee

2012-01-25 05:10:48

Seems like if u lag even a 0,0001 sec it will start to fail =(

Giant Panda

2012-01-25 06:14:25

seems to running very well! :)

will post a proggy when done

Giant Panda

2012-01-25 09:36:10

*********************************************
Maigel's Fire Runecrafter
*********************************************
Ran for: 02:59:16
Great script that! only had to pause and manual a couple times to get it going again :)

*********************************************
Player: ***
Experience Gained: 33971
Essence Crafted: 4853
*********************************************
Ran out of rings of duelling
Successfully executed.
The following DTMs were not freed: [2, 3, 4, 5, 6, 7, 8, 9]

Bnagy

2012-01-25 16:44:23

From: Giant Panda
*********************************************
Maigel's Fire Runecrafter
*********************************************
Ran for: 02:59:16
Great script that! only had to pause and manual a couple times to get it going again :)

*********************************************
Player: ***
Experience Gained: 33971
Essence Crafted: 4853
*********************************************
Ran out of rings of duelling
Successfully executed.
The following DTMs were not freed: [2, 3, 4, 5, 6, 7, 8, 9]


If I may ask, how can you manual it?? I know how to pause but I haven't been able to figure out how to control it manually like you've said.

On another note, brilliant script. After all the autocolor updates you've made It has finally decided it wants to work now and it is awesome. Getting roughly 12-13k per hour on my skiller. Once again, THANK YOU!

wzaza

2012-01-27 09:57:27

first time i downloaded it it couldent identify the alter so i tried fixing it by changing the colour it recognised but that didnt work so after trying almost every colour i could find i decided just to redowload the bot and not fill in the form and that time it worked perfectly except when there were all the summons crouding arround the chest.
all in all great script

maigel

2012-01-27 10:33:28

From: wzaza
first time i downloaded it it couldent identify the alter so i tried fixing it by changing the colour it recognised but that didnt work so after trying almost every colour i could find i decided just to redowload the bot and not fill in the form and that time it worked perfectly except when there were all the summons crouding arround the chest.
all in all great script


What form are you talking about? I don't have a form in the script yet …
And about the bank, the script is using SRL's bank function, nothing in my reach to fix atm

Mat

2012-01-27 10:38:21

Maigel you should get a mod to move this to the runecraft section as its a great script :)
Mat

Giant Panda

2012-01-27 13:56:52

From: Bnagy
If I may ask, how can you manual it?? I know how to pause but I haven't been able to figure out how to control it manually like you've said.

On another note, brilliant script. After all the autocolor updates you've made It has finally decided it wants to work now and it is awesome. Getting roughly 12-13k per hour on my skiller. Once again, THANK YOU!


press disable smart then you can click and type. you need to enable it again after or the script wont work

wzaza

2012-01-27 14:13:51

From: maigel
What form are you talking about? I don't have a form in the script yet …
And about the bank, the script is using SRL's bank function, nothing in my reach to fix atm


i didnt use any sort of form i tried changing the colour on line 221

l337murd3r

2012-01-27 18:41:26

love this script got 166k ess so ill post a nice prog when im done!

Aleaus

2012-02-15 19:55:35

Working Great man thanks so much for the script! Here is my first progress report! I got 6.15k more ess to go!

Maigel's Fire Runecrafter
*********************************************
Ran for: 02:42:50
*********************************************
Player:
Experience Gained: 32823
Essence Crafted: 4689
*********************************************

Laz

2012-02-15 21:07:05

From: Aleaus
Working Great man thanks so much for the script! Here is my first progress report! I got 6.15k more ess to go!

Maigel's Fire Runecrafter
*********************************************
Ran for: 02:42:50
*********************************************
Player:
Experience Gained: 32823
Essence Crafted: 4689
*********************************************

what !!! i think this wasnt working ! LOL. i will use it now :P

Aleaus

2012-02-16 07:00:09

Here is my last one. Works Great other then I found it gets lost alot and teleports back to castle wars which wastes tons of teleports but not a big deal gets the job done :D

*********************************************
Maigel's Fire Runecrafter
*********************************************
Ran for: 01:33:09
*********************************************
Player:
Experience Gained: 15680
Essence Crafted: 2240
*********************************************

maigel

2012-02-16 14:12:49

I haven't worked / ran it for more then a month since I don't have any member account available so yea, it's possible that it gets lost more because colors are outdated or something like that

qingqinghd

2012-02-16 17:25:22

thanks for this .it work awsome now. just ty,nice man

fretje12

2012-02-16 21:01:44

Dude, you should update it this is an awesome script it need to be updated :P i hope you read this and update it. Please

Thanks



For script testing go to : http://villavu.com/forum/showthread.php?p=932227#post932227

Aleaus

2012-02-19 00:51:21

From: fretje12
Dude, you should update it this is an awesome script it need to be updated :P i hope you read this and update it. Please

Thanks



For script testing go to : http://villavu.com/forum/showthread.php?p=932227#post932227


He Clearly just said he doesn't have members atm.. So since it is a members method he can not update it..

selgius7

2012-02-19 09:30:13

if it teleports when trying to enter fire ruins, then replace RuinsColor with this:
and it should work perfectly
function RuinsColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.11, 1.85);

if not (FindColorsTolerance(arP, 2644180, MSX1, MSY1, MSX2, MSY2, 16)) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC, X, Y, Z);

if (X >= 11.23) and (X <= 51.84) and (Y >= 9.75) and (Y <= 41.39) and (Z >= 4.64) and (Z <= 13.57) then
begin
Result := arC;
Writeln('AutoColor = ' + IntToStr(arC));
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;


http://www.youtube.com/watch?v=gU1_EqjWMSY made a video… it really works. ty for script.

brandon8081

2012-02-19 22:29:30

I've just begun using this script, when i get some decent progies. If i find any bugs at all, i will be sure to post them.

PS: selgius7, your fix helped a lot. Thank you!

Exhale

2012-02-20 13:16:47

how r u guys doing it mine goes inside the altar then stands there

selgius7

2012-02-20 13:47:55

From: Exhale
how r u guys doing it mine goes inside the altar then stands there


need a fix ?
try this:
replace AltarColor; with this:

function AltarColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
R, G, B: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.84, 0.23);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 6512225, MSX1, MSY1, MSX2, MSY2, 2);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToRGB(arC[i], R, G, B);

if (R >= 92) and (R <= 102) and (G >= 90) and (G <= 99) and (B >= 94) and (B <= 104) then
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 10.30) and (X <= 12.20) and (Y >= 10.62) and (Y <= 12.50) and (Z >= 12.31) and (Z <= 14.62) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;

and it should work.
sometimes it stucks in few places, because runescape colors changes a little bit and its not so easy to find perfect color to replace it.

and proggie:
Maigel's Fire Runecrafter
*********************************************
Ran for: 01:41:56
*********************************************
Player:
Experience Gained: 22470
Essence Crafted: 3210
*********************************************
Ran out of essence

Exhale

2012-02-20 14:17:32

Thanks, trying now,

Exhale

2012-02-20 14:43:22

It worked for a bit then it went back to teleporting after entering the alter.

selgius7

2012-02-20 16:07:56

From: Exhale
It worked for a bit then it went back to teleporting after entering the alter.


i think its because fire symbol color on altar… changed. U should try using auto coloring (ACA) for getting that code.

brandon8081

2012-02-20 17:04:00

Selgius, could you tell me how your changing the color? I know about the dropper tool, but i never know which numbers to change. I looked in tutorials and couldn't find it. your helped will be greatly appreciated.

selgius7

2012-02-21 03:02:06

From: brandon8081
Selgius, could you tell me how your changing the color? I know about the dropper tool, but i never know which numbers to change. I looked in tutorials and couldn't find it. your helped will be greatly appreciated.


http://www.youtube.com/watch?v=98wVrr6GwyU&feature=channel check this out.

brandon8081

2012-02-21 04:38:03

i followed the guide but now i keep getting couldn't find color tpa and numbers after that. its when i get in the altar and after i changed things.
EDIT: i got it, i just needed to do it multiple times. thanks

This has been working for me.

i followed the guide but now i keep getting couldn't find color tpa and numbers after that. its when i get in the altar and after i changed things.
EDIT: i got it, i just needed to do it multiple times. thanks

This has been working for me.

function AltarColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(2.51, 0.56);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 6446432, MSX1, MSY1, MSX2, MSY2, 1);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 10.45) and (X <= 11.40) and (Y >= 10.69) and (Y <= 11.70) and (Z >= 12.56) and (Z <= 13.48) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;

Im auz

2012-03-11 08:03:20

Am getting this error when starting script.

[Error] (152:11): Duplicate identifier 'FREEDTMS' at line 151
Compiling failed.

Majnoon

2012-03-11 13:16:41

From: Im auz
Am getting this error when starting script.

[Error] (152:11): Duplicate identifier 'FREEDTMS' at line 151
Compiling failed.


I get the same thing

qingqinghd

2012-03-11 14:42:57

'FREEDTMS' at line 151 change to 'FREDTMS'
quick fixs

Majnoon

2012-03-11 15:45:54

From: qingqinghd
'FREEDTMS' at line 151 change to 'FREDTMS'
quick fixs


Thanks!!!

Edit,

So i had the same issue as the others ( wouldn't click on altar ) but i used ACA and edited the color it should look for, after that it was fixed. But now another error, it doesn't bank after coming back from fire altar

Getting this error message

DTM 0 not found
Successfully executed.
The following DTMs were not freed: [2, 3, 4, 5, 6, 7, 8, 9]

qingqinghd

2012-03-15 16:44:54

i put up my fix one

program DeclarePlayers;
{$DEFINE SMART}
{$i srl/srl/misc/smart.simba} // This is how we include SMART; it HAS to be included BEFORE SRL!
{$i srl/srl.simba}
{$I SRL/SRL/misc/paintsmart.simba}
{$I SRL/SRL/misc/debug.simba}





(*
========================================== Script setup ==========================================
*)
const
EssenceTab = 1; // The bank tab your essence is stored on
EssenceSlot = 1; // The bank slot your essence is stored on
RingTab = 1; // The bank tab your rings of duelling are stored on
RingSlot = 2; // The bank slot your rings of duelling are stored on
NumOfPouches = 0; // The number of essence pouches you are using
// -------------------------------- Script constants | Don't touch ---------------------------------
LOC_DUEL_ARENA = 1;
LOC_CASTLE_WARS = 2;
LOC_BANK = 3;
LOC_RUINS = 4;
LOC_INSIDE_ALTAR = 5;
LOC_AT_ALTAR = 6;
LOC_TP_CW = 7;
LOC_TP_DA = 8;
LOC_LOST = 0;

procedure DeclarePlayers;
begin
HowManyPlayers := 1; // This is set to the total amount of players (more on multiplayer later ;)), for now, just keep it set as 1
NumberOfPlayers(HowManyPlayers); // This is a procedure in SRL which sets up player arrays (also, more on that later), this will always be the same
CurrentPlayer := 0; // This is the player to start with; the first player will always be 0 (you'll find out when you learn all about arrays)

stats_UserName := '';
stats_UserPass := '';

Players[0].Name := ''; // Username
Players[0].Pass := ''; // Password
Players[0].Nick := ''; // 3-4 lowercase letters from username; used for random event detection
Players[0].Member := True;
Players[0].Active := True; // Set to true if you want to use Player 0
Players[0].Pin := ''; // Leave bank if the player doesn't have a bank pin


end;

(*
========================================== DONT touch from here on if you just want to run the script ==========================================
*)
var
AltarPath: Array of Integer;
InsideAltarPath: Array of Integer;
CastleBankPath: Array of Integer;
TeleportsLeft: Integer;
Location: Integer;


(*
========================================== DTM related functions ==========================================
*)

(*
Description: Loads all global DTMs for this script
*)
procedure loadDTM;
begin
SetArrayLength(AltarPath, 2);
SetArrayLength(InsideAltarPath, 1);
SetArrayLength(CastleBankPath, 5);
AltarPath[0] := DTMFromString('mlwAAAHicY2dgYDBjY2BIBmIDIHYCYikgFgBiVyDeCZQ/D8RXgPgcED8B4g9A/AOIZ3enMUQ6STKsmVDI0FjgzjClPohhdn8aw9yedAZ+oDwuzIgHQwEAYTURvA==');
AltarPath[1] := DTMFromString('mggAAAHicY2NgYChkY2DIBeJkII4H4hVAXATE+owMDJZArAbEYkBsAMTRQDyhJpGhuTACjBd0ZTP4WIowrO0pZeAHmoUNM+LAEAAA3oIMWw==');
InsideAltarPath[0] := DTMFromString('mrAAAAHic42BgYDjPxsCwF4jPAvFDIL4AxIeA+A4Q3wJiKUYGBkkgZofSakDMCcQcQKwMxJEB9gyRvmYMoZ7GDAGuhgxJIdYMaRF2DAn++gwJQVYM/EA78GFGAhgGAPLgDwI=');
CastleBankPath[0] := DTMFromString('m6wAAAHic42ZgYKhgYmDIY4LQHUA8BYgXAPEiIF4IxPOg/AQgjgSqrwLpgeJSIM4D4jgg9gNiMyBWBOJAIC4uyGFo65mBgRvbJ6Pw07q0GfiB6onFjCRgJAAAJb0cHA==');
CastleBankPath[1] := DTMFromString('mwQAAAHic42RgYKhjYmBYCMSLgXgZEM8G4j4grgbiCCBOAOJQoDp/II4B4mwgLgLiCiCugdLmQJyZlszQ1jMDK541bRJDWpc2Az9QHSHMSASGAwDRnRb7');
CastleBankPath[2] := DTMFromString('mwQAAAHic42RgYKhkYmAoAeJWIJ4AxAuBeAkQLwbiBCCOB+IgoLo6IC4HqQfiQiBOAOIQIA4EYnMgLi7IYWjrmYEVp3VpgzE/UB0hzEgEhgMAig8WQw==');
CastleBankPath[3] := DTMFromString('mwQAAAHic42RgYKhlYmBYA8SrgXgFEK8F4vVQdhoQxwBxOVBdKRDnAXEQELsBsTUQGwJxIBCXAHFBSTZD84TpWHFynxbD9FkTGfiB6ghhRiIwHAAAA1AXOQ==');
CastleBankPath[4] := DTMFromString('mwQAAAHic42RgYGhnYmBYC8UrgXg9lL0CiGOBOAqIi4DqyoA4F4iDgdgFiM2AWBuIvYC4AIjTspIYmidMx4qnz5oIxsQARiIwHAAAAggXIw==');
end;

(*
Description: Walks a path set by an array of DTMs
Returns: True if the path has been succesfully walked, false if something went wrong
*)
function WalkDTMPathEx(DTM: Array of Integer; PathStart: Integer; PathEnd: Integer): boolean;
var
i: Integer;
x, y: Integer;
aFound: Extended;
timer, tries: Integer;
begin
for i := PathStart to PathEnd do
begin
tries := 0;
repeat
Inc(tries);
if FindDTMRotated(DTM[i], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) then
begin
Mouse(x, y, 3, 3, True);
FFlag(6);
if (i <> High(DTM)) then
begin
MarkTime(timer);
repeat
Wait(50 + Random(25));
until FindDTMRotated(DTM[i+1], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) or (TimeFromMark(timer) > 20000);
if(TimeFromMark(timer) > 20000) then
begin
Writeln('DTM ' + IntToStr(i + 1) + ' not found');
Result := False;
Break;
end;
end;
break;
end;
Wait(500 + Random(500));
until(tries > 10);

Result := True;
if(tries > 10) then
begin
Writeln('DTM ' + IntToStr(i) + ' not found');
Result := False;
end;
end;
end;

function WalkDTMPath(DTM: Array of Integer): boolean;
begin
Result := WalkDTMPathEx(DTM, 0, High(DTM));
end;

(*
Description: Frees all DTMs in a given array
*)
procedure FreeDTMArray(DTM: Array of Integer);//DTM Freeing procedure.
var
i: Integer;
begin
for i := 0 to High(DTM) do
begin
FreeDTM(DTM[i])
end;
end;

(*
Description: Frees all DTMs in this script
*)
procedure FreDTMs;
begin
FreeDTMArray(AltarPath);
FreeDTMArray(InsideAltarPath);
FreeDTMArray(CastleBankPath);
end;

(*
Description: Autocolor function for the mysterious ruins
Returns: Mysterious runes orange color
*)
function RuinsColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.12, 1.88);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 2710230, MSX1, MSY1, MSX2, MSY2, 16);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 11.43) and (X <= 52.22) and (Y >= 9.44) and (Y <= 42.03) and (Z >= 4.82) and (Z <= 12.77) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;


(*
Description: Autocolor function for the runecrafting altar
Returns: Color of the flame in the middle of the altar
*)
function AltarColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(1.26, 0.31);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 6249053, MSX1, MSY1, MSX2, MSY2, 10);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 9.40) and (X <= 11.16) and (Y >= 9.68) and (Y <= 11.45) and (Z >= 11.25) and (Z <= 13.19) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;

(*
Description: Enters the mysterious ruins
Returns: True if the ruins have been entered, false if something went wrong
*)
function EnterRuins: boolean;
var
tpa : TPointArray;
atpa : T2DPointArray;
tries, i, x, y : Integer;
begin
tries := 1;
repeat
writeln('Searching for ruins');
FindColorsTolerance(tpa, RuinsColor, MSX1, MSY1, MSX2, MSY2, 25);
atpa := TPAToATPAEx(tpa, 20, 20);
SortATPASize(atpa, True);
for i := 0 to High(atpa) do
begin
writeln( 'TPA ' + IntToStr(i) + ' = ' + IntToStr(GetArraylength(ATPA[i])) );
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 3, 3);
Wait(800 + Random(300));
if WaitUpTextMulti( ['ysterious', 'uins', 'ruins', 'rious'], 100) then
begin
writeln('Ruins found');
GetMousePos(x, y);
Mouse(x, y, 0, 0, true);
Result := True;
Exit;
end;
end;
Wait(500 + Random(300));
Inc(tries);
until tries > 10;
Result := False;
end;

(*
Description: Loops trough all pouch inventory slots and empties them
Returns: True if the pouches have been emptied, false if something went wrong
*)
function EmptyPouches: boolean;
var
i: Integer;
tries: Integer;
begin

for i := 1 to numOfPouches do
begin
SMART_DrawBoxEx(False,InvBox(i),clRed);
MouseBox(InvBox(i).X1, InvBox(i).Y1, InvBox(i).X2, InvBox(i).Y2, mouse_right);
tries := 1
repeat
Inc(tries);
writeln('Searching for "Empty pouch" text')
wait(200+Random(400));
until (tries > 10) or ChooseOptionMulti(['Empty', 'mpty', 'pty']);
if(tries > 10) then
begin
Result := False;
end else
begin
Result := True;
end;
end;
end;

(*
Description: Loops trough all pouch inventory slots and fills them
Returns: True if the pouches have been filled, false if something went wrong
*)
function FillPouches: boolean;
var
i: Integer;
tries: Integer;
begin
for i := 1 to NumOfPouches do
begin
SMART_DrawBoxEx(False,InvBox(i),clRed);
MouseBox(InvBox(i).X1, InvBox(i).Y1, InvBox(i).X2, InvBox(i).Y2, mouse_right);
tries := 1
repeat
Inc(tries);
writeln('Searching for "Fill pouch" text')
wait(200+Random(400));
until (tries > 10) or ChooseOptionMulti(['Fill', 'ill']);
if(tries > 10) then
begin
Result := False;
end else
begin
Result := True;
end;
end;
end;

(*
Description: Finds and clicks the runecrafting altar
Returns: True if the altar has been clicked, false if it hasn't
*)
function FindAltar: boolean;
var
tpa : TPointArray;
atpa : T2DPointArray;
tries, i, x, y : Integer;
begin
tries := 1;
repeat
writeln('Searching for altar');
FindColorsTolerance(tpa, AltarColor, MSX1, MSY1, MSX2, MSY2, 5);
atpa := TPAToATPAEx(tpa, 20, 20);
SortATPASize(atpa, True);
for i := 0 to High(atpa) do
begin
writeln( 'TPA ' + IntToStr(i) + ' = ' + IntToStr(GetArraylength(ATPA[i])) );
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 3, 3);
Wait(500 + Random(300));
if WaitUpTextMulti( ['raft', 'rune', 'ltar'], 500) then
begin
writeln('Altar found');
GetMousePos(x, y);
Mouse(x, y, 0, 0, true);
Result := True;
Exit;
end;
end;
Wait(500 + Random(300));
Inc(tries);
until tries > 10;
Result := False;
end;

(*
Description: Enters the mysterious ruins
Returns: True if the ruins have been entered, false if something went wrong
*)
function CraftRunes: boolean;
var
i : Integer;
begin
for i := 1 to 2 do
begin
writeln('Crafting load ' + IntToStr(i));
if not FindAltar then
begin
Result := False;
Exit;
end;
if (i = 1) then
begin
if (numOfPouches = 0 ) then
begin
Wait(1000 + Random(500));
Result := True;
Exit;
end;
Wait(1000 + Random(500));
if not EmptyPouches then
begin
writeln('A problem occured emptying the pouches')
Result := False;
Exit;
end;
end;
end;
Wait(1000 + Random(500));
Result := True;
end;

(*
Description: Teleports the player using the ring of duelling
Parameter: True to teleport to dual arena, false to teleport to castle wars
Returns: True if the ring has been found and the player teleported, false if something went wrong
*)
function Teleport(arena: boolean): boolean;
var
tries: Integer;
invSlot: Integer;
begin
tries := 1;
invSlot := NumOfPouches + 1;
MouseBox(InvBox(invSlot).X1, InvBox(invSlot).Y1, InvBox(invSlot).X2, InvBox(invSlot).Y2, mouse_right);
SMART_DrawBoxEx(False,InvBox(invSlot),clRed);
wait(200+Random(200));
Result := False;
repeat
Inc(tries);
writeln('Searching for text')
if ChooseOptionMulti(['Rub', 'Ru', 'ub']) Then
begin
Wait(800 + Random(300));
tries := 12;
dec(TeleportsLeft);
Wait(800 + Random(300));
if(arena) then
begin
KeyDown(49);
Wait(75 + Random(75));
KeyUp(49);
Result := True;
end else
begin
KeyDown(50);
Wait(75 + Random(75));
KeyUp(50);
Result := True;
end;
end;
Wait(1000 + Random(300));
until tries > 10;
end;

(*
Description: Tries a couple of different DTMs to walk to the castle wars bank chest
Returns: True if the chest has been reached, false if it hasn't
*)
function ToCastleWarsChest : Boolean;
var
i: Integer;
begin

Result := False;
for i := 0 to High(CastleBankPath) do
begin
MouseBox(641, 123, 652, 132, 1);
FFlag(0);
Wait(RandomRange(1500, 2000));
begin
Result := True;
Break;
end;
Wait(500 + Random(500));
end;
end;

(*
Description: Temporay fix for the bank tab function in SRL since it wasn't working on tab 2 for some reason
Returns: The current bank tab opened
*)
function CurrentBankTabCustom: Integer;
begin
Result := -1;
if not BankScreen then
Exit;
for Result := 1 to 9 do
if InRange(GetColor(40 + 48 * (Result - 1), 83), 2831418, 2896954) then
Exit;
Result := 0;
end;

(*
Description: Switches to the correct tab and withdraws the rune essence
Returns: True if the essence has been withrawn, false if something went wrong
*)
function WithdrawEssence: boolean;
var
tries: Integer;
begin
if(CurrentBankTabCustom <> EssenceTab) then
BankTab(EssenceTab);
for tries := 1 to 14 do
begin
if Withdraw(0, 0, 28) then
begin
Result := True;
Exit;
end;
wait(500 + Random(500));
end;
Result := False;
end;

(*
Description: Switches to the correct tab and withdraws a ring of duelling
Returns: True if the ring has been withrawn, false if something went wrong
*)
function WithdrawRing: boolean;
var
tries : Integer;
begin
if(CurrentBankTabCustom <> RingTab) then
BankTab(RingTab);
for tries := 1 to 4 do
begin
if WithdrawEx((Ringslot MOD 10) - 1, RingSlot / 10, 1, ['duelling', 'uelling', 'ling', 'duel']) then
begin
Result := True;
Exit;
end;
wait(500 + Random(500));
end;
Result := False;
end;

(*
Description: Sorts an ATPA array by its boundaries' surface area (sort by size sorts by the amount of dots)
*)
procedure SortATPAByBoundaries( atpa : T2DPointArray);
var
i, j, maxIndex : Integer;
box1, box2 : TBox;
temp : TPointArray;
begin

for i := 0 to High(atpa) do
begin
maxIndex := i;
for j := i + 1 to High(atpa) do
begin
box1 := GetTPABounds(atpa[j]);
box2 := GetTPABounds(atpa[maxIndex]);
if( (box1.X2 - box1.X1) * (box1.Y2 - box1.Y1) > (box2.X2 - box2.X1) * (box2.Y2 - box2.Y1) ) then
maxIndex := j;
end;
temp := atpa[i];
atpa[i] := atpa[maxIndex];
atpa[maxIndex] := temp;
end;

end;

(*
Description: Find and opens the castle wars bank chest
Returns: True if the chest has been found and opened, false if something went wrong
*)
function OpenCastleWarsBank: boolean;
var
tpa : TPointArray;
atpa : T2DPointArray;
tries, i, x, y : Integer;
begin
tries := 1;
repeat
writeln('Searching for bank chest');
FindColorsTolerance(tpa, 11053488, MSX1, MSY1, MSX2, MSY2, 6);
atpa := TPAToATPAEx(tpa, 20, 40);
SortATPAByBoundaries(atpa);
for i := 0 to High(atpa) do
begin
writeln( 'TPA ' + IntToStr(i) + ' = ' + IntToStr(GetArraylength(ATPA[i])) );
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 3, 3);
if WaitUpTextMulti(['chest', 'est', 'Bank', 'ank'], 500) then
begin
writeln('Chest found');
Mouse(x, y, 3, 3, true);
Result := True;
Exit;
end;
end;
Wait(200 + Random(200));
Inc(tries);
until tries > 10;
Result := False;
end;

(*
Description: Takes care of all the banking related stuff in the script
*)
function Bank: boolean;
var
timer: Integer;
begin
Result := True;
//Open bank
Wait(1000+Random(500));
if OpenBankChest(SRL_BANK_CW) or BankScreen or PinScreen then
begin
MarkTime(timer);
repeat
Wait(250+Random(250));
until BankScreen or PinScreen or (TimeFromMark(timer) > 7000);
if (TimeFromMark(timer) > 15000) then
begin
writeln('BankScreen wait time exceeded');
Result := False;
Exit;
end;
if PinScreen and not InPin(Players[CurrentPlayer].Pin) then
begin
writeln('Failed to enter pin');
Result := False;
Exit;
end;
end else
begin
writeln('Failed to open bank');
Result := False;
if (Location <> LOC_LOST) and ToCastleWarsChest then
begin
Location := LOC_LOST;
Wait(3000 + Random(1000));
Result := Bank;
end;
Exit;
end;
//Deposit fire runes
Deposit(NumOfPouches+2,NumOfPouches+2, True);

//Check if a new ring of duelling is needed
if(TeleportsLeft <= 1) then
begin
Wait(250+Random(250));
if (TeleportsLeft <> 0) then
begin
Deposit(NumOfPouches+1, NumOfPouches+1, False);
end;
Wait(250+Random(250));
if not WithdrawRing then
begin
writeln('Ran out of rings of duelling');
Result := False;
Exit;
end;
TeleportsLeft := 8;
end;

//Withdraw essence a first time
Wait(250+Random(250));
if not WithdrawEssence then
begin
writeln('Ran out of essence');
Result := False;
Exit;
end;

if (numOfPouches > 0 ) then
begin
//Fill pouches
Wait(250+Random(250));
if not FillPouches then
begin
writeln('Failed to fill pouches');
Result := False;
Exit;
end;

//Withdraw essence a second time
Wait(250+Random(250));
if not WithdrawEssence then
begin
writeln('Ran out of essence');
Result := False;
Exit;
end;
end;


Wait(250+Random(250));
if not CloseBank then
begin
writeln('Failed to close bank');
Result := False;
Exit;
end;
wait(300 + Random(300))
end;

(*
Thanks and credits to YoHoJo for this antiban (copied parts of his antiban in his video tutorial)
(might implement more of my own antiban later)
*)
Procedure Antiban;
Begin
Case Random(150) Of
0:
begin
writeln('Antiban ... Hover runecrafting');
GameTab(tab_Stats) HoverSkill('Runecrafting', False);
Wait(500 + Random(500));
GameTab(tab_Inv);
end;
1:
begin
writeln('Antiban ... Examine inventory');
GameTab(tab_Inv);
ExamineInv;
end;
2:
begin
writeln('Antiban ... Sleep and move mouse');
SleepAndMoveMouse(4000 + Random(500));
end;
3:
begin
writeln('Antiban ... Hover random skill');
HoverSkill('random', False);
Wait(1000 + Random(500));
GameTab(tab_Inv);
end;
4:
begin
writeln('Antiban ... Look at stats');
GameTab(Tab_Stats);
Wait(3000 + Random(1500));
GameTab(tab_Inv);
end;
5:
begin
writeln('Antiban ... Pickup mouse');
PickUpMouse;
end;
6:
begin
writeln('Antiban ... Bored human');
BoredHuman;
end;

End;
End;

(*
Description: Tries to teleport to castle wars and bank if the player got lost
*)
function RecoverFromLost : Boolean;
begin
Result := False;
if Teleport(false) then
begin
wait(2000 + Random(1000));
if ToCastleWarsChest then
begin
wait(2000 + Random(1000));
if Bank then
begin
Result := True;
Location := LOC_TP_DA;
Exit;
end;
end;
end;
end;

(*
Description: Draws the smart overlay with experience and such
*)
procedure DrawSmartProggy;
var
h, m, s : Integer;
xpPerHour : Integer;
essencePerHour : Integer;
begin
SMART_ClearCanvas;
ConvertTime(TimeFromMark(Players[CurrentPlayer].Integers[3]), h, m, s);
xpPerHour := ((60 * 60 * 1000) / TimeFromMark(Players[CurrentPlayer].Integers[3])) * Players[CurrentPlayer].Integers[1];
essencePerHour := ((60 * 60 * 1000) / TimeFromMark(Players[CurrentPlayer].Integers[3])) * Players[CurrentPlayer].Integers[2];
SMART_DrawText(15, 35, 'UpChars', 'Maigel''s Fire RuneCrafter:', clLime);
SMART_DrawText(15, 50, 'UpChars', 'Ran for: '+ PadZ(IntToStr(h), 2)+':'+PadZ(IntToStr(m), 2)+':'+PadZ(IntToStr(s), 2), clWhite);
SMART_DrawText(15, 65, 'UpChars', 'Experience Gained: ' + IntToStr(Players[CurrentPlayer].Integers[1]), clWhite);
SMART_DrawText(15, 80, 'UpChars', 'Experience / Hour: ' + IntToStr(xpPerHour), clWhite);
SMART_DrawText(15, 95, 'UpChars', 'Essence Crafted: '+ IntToStr(Players[CurrentPlayer].Integers[2]), clWhite);
SMART_DrawText(15, 110, 'UpChars', 'Essence / Hour: '+ IntToStr(essencePerHour), clWhite);
end;

(*
Description: Prints out a progress report and commits to SRL Stats
*)
procedure ProgressReport;
var
xpGained : Integer;
h, m, s, player : Integer;
begin
xpGained := GetXPBarTotal - Players[CurrentPlayer].Integers[0];
Players[CurrentPlayer].Integers[0] := GetXPBarTotal;
Players[CurrentPlayer].Integers[1] := Players[CurrentPlayer].Integers[1] + xpGained;
Players[CurrentPlayer].Integers[2] := Players[CurrentPlayer].Integers[2] + (xpGained / 7);
ConvertTime(TimeFromMark(Players[CurrentPlayer].Integers[3]), h, m, s);
Writeln('*********************************************');
Writeln('Maigel''s Fire Runecrafter');
Writeln('*********************************************');
Writeln('Ran for: '+ PadZ(IntToStr(h), 2)+':'+PadZ(IntToStr(m), 2)+':'+PadZ(IntToStr(s), 2));
Writeln('*********************************************');
for player:=0 to High(Players) do
begin
Writeln('Player: '+Players[player].Nick);
Writeln('Experience Gained: '+IntToStr(Players[player].Integers[1]));
Writeln('Essence Crafted: '+IntToStr(Players[player].Integers[2]));
Writeln('*********************************************');
end;
DrawSmartProggy;
stats_IncVariable('Rune Essence (Crafted)', xpGained / 7);
stats_IncVariable('Runecrafting EXP (Gained)', xpGained);
stats_Commit;
end;

begin
//Setup Smart and other variables
Smart_Server := 1;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
ClearDebug;
SetupSRL;
DeclarePlayers;
LoginPlayer;
ClickNorth(SRL_ANGLE_HIGH);
Players[CurrentPlayer].Integers[0] := GetXPBarTotal;
Players[CurrentPlayer].Integers[1] := 0;
Players[CurrentPlayer].Integers[2] := 0;
MarkTime(Players[CurrentPlayer].Integers[3]);
TeleportsLeft := 0;
loadDTM;
Location := LOC_BANK;
SetupSRLStats(596, stats_Username, stats_Userpass);
stats_InitVariable('Rune Essence (Crafted)', 0);
stats_InitVariable('Runecrafting EXP (Gained)', 0);
if (stats_Username = '') then
begin
stats_Username := 'Anonymous';
stats_Userpass := 'anon1337';
end;
SetupSRLStats(596, stats_Username, Stats_Userpass);
// Main loop
repeat
Antiban;
FindNormalRandoms;
DrawSmartProggy;
Case Location of
LOC_DUEL_ARENA:
if walkDTMPath(AltarPath) then Location := LOC_RUINS else Location := LOC_LOST;
LOC_RUINS:
if EnterRuins then Location := LOC_INSIDE_ALTAR;
LOC_INSIDE_ALTAR:
if WalkDTMPath(InsideAltarPath) then Location := LOC_AT_ALTAR else Location := LOC_LOST;
LOC_AT_ALTAR:
if CraftRunes then Location := LOC_TP_CW else Location := LOC_LOST;
LOC_TP_CW:
if Teleport(False) then
begin
Location := LOC_CASTLE_WARS;
ProgressReport;
end else
begin
Location := LOC_LOST;
end;
LOC_CASTLE_WARS:
if ToCastleWarsChest then Location := LOC_BANK else Location := LOC_LOST;
LOC_BANK:
if Bank then Location := LOC_TP_DA else Location := LOC_LOST;
LOC_TP_DA:
if Teleport(True) then Location := LOC_DUEL_ARENA else Location := LOC_LOST;
LOC_LOST:
begin
writeln('Got lost!!! Atempting to recover.')
if not RecoverFromLost then
begin
end else
begin
writeln('Recoverd from being lost successfully!');
end;
end;
end;
Sleep(RandomRange(500,800));
until (False);
FreDTMs;
end.

Majnoon

2012-03-16 13:25:33

From: qingqinghd
i put up my fix one

program DeclarePlayers;
{$DEFINE SMART}
{$i srl/srl/misc/smart.simba} // This is how we include SMART; it HAS to be included BEFORE SRL!
{$i srl/srl.simba}
{$I SRL/SRL/misc/paintsmart.simba}
{$I SRL/SRL/misc/debug.simba}





(*
========================================== Script setup ==========================================
*)
const
EssenceTab = 1; // The bank tab your essence is stored on
EssenceSlot = 1; // The bank slot your essence is stored on
RingTab = 1; // The bank tab your rings of duelling are stored on
RingSlot = 2; // The bank slot your rings of duelling are stored on
NumOfPouches = 0; // The number of essence pouches you are using
// -------------------------------- Script constants | Don't touch ---------------------------------
LOC_DUEL_ARENA = 1;
LOC_CASTLE_WARS = 2;
LOC_BANK = 3;
LOC_RUINS = 4;
LOC_INSIDE_ALTAR = 5;
LOC_AT_ALTAR = 6;
LOC_TP_CW = 7;
LOC_TP_DA = 8;
LOC_LOST = 0;

procedure DeclarePlayers;
begin
HowManyPlayers := 1; // This is set to the total amount of players (more on multiplayer later ;)), for now, just keep it set as 1
NumberOfPlayers(HowManyPlayers); // This is a procedure in SRL which sets up player arrays (also, more on that later), this will always be the same
CurrentPlayer := 0; // This is the player to start with; the first player will always be 0 (you'll find out when you learn all about arrays)

stats_UserName := '';
stats_UserPass := '';

Players[0].Name := ''; // Username
Players[0].Pass := ''; // Password
Players[0].Nick := ''; // 3-4 lowercase letters from username; used for random event detection
Players[0].Member := True;
Players[0].Active := True; // Set to true if you want to use Player 0
Players[0].Pin := ''; // Leave bank if the player doesn't have a bank pin


end;

(*
========================================== DONT touch from here on if you just want to run the script ==========================================
*)
var
AltarPath: Array of Integer;
InsideAltarPath: Array of Integer;
CastleBankPath: Array of Integer;
TeleportsLeft: Integer;
Location: Integer;


(*
========================================== DTM related functions ==========================================
*)

(*
Description: Loads all global DTMs for this script
*)
procedure loadDTM;
begin
SetArrayLength(AltarPath, 2);
SetArrayLength(InsideAltarPath, 1);
SetArrayLength(CastleBankPath, 5);
AltarPath[0] := DTMFromString('mlwAAAHicY2dgYDBjY2BIBmIDIHYCYikgFgBiVyDeCZQ/D8RXgPgcED8B4g9A/AOIZ3enMUQ6STKsmVDI0FjgzjClPohhdn8aw9yedAZ+oDwuzIgHQwEAYTURvA==');
AltarPath[1] := DTMFromString('mggAAAHicY2NgYChkY2DIBeJkII4H4hVAXATE+owMDJZArAbEYkBsAMTRQDyhJpGhuTACjBd0ZTP4WIowrO0pZeAHmoUNM+LAEAAA3oIMWw==');
InsideAltarPath[0] := DTMFromString('mrAAAAHic42BgYDjPxsCwF4jPAvFDIL4AxIeA+A4Q3wJiKUYGBkkgZofSakDMCcQcQKwMxJEB9gyRvmYMoZ7GDAGuhgxJIdYMaRF2DAn++gwJQVYM/EA78GFGAhgGAPLgDwI=');
CastleBankPath[0] := DTMFromString('m6wAAAHic42ZgYKhgYmDIY4LQHUA8BYgXAPEiIF4IxPOg/AQgjgSqrwLpgeJSIM4D4jgg9gNiMyBWBOJAIC4uyGFo65mBgRvbJ6Pw07q0GfiB6onFjCRgJAAAJb0cHA==');
CastleBankPath[1] := DTMFromString('mwQAAAHic42RgYKhjYmBYCMSLgXgZEM8G4j4grgbiCCBOAOJQoDp/II4B4mwgLgLiCiCugdLmQJyZlszQ1jMDK541bRJDWpc2Az9QHSHMSASGAwDRnRb7');
CastleBankPath[2] := DTMFromString('mwQAAAHic42RgYKhkYmAoAeJWIJ4AxAuBeAkQLwbiBCCOB+IgoLo6IC4HqQfiQiBOAOIQIA4EYnMgLi7IYWjrmYEVp3VpgzE/UB0hzEgEhgMAig8WQw==');
CastleBankPath[3] := DTMFromString('mwQAAAHic42RgYKhlYmBYA8SrgXgFEK8F4vVQdhoQxwBxOVBdKRDnAXEQELsBsTUQGwJxIBCXAHFBSTZD84TpWHFynxbD9FkTGfiB6ghhRiIwHAAAA1AXOQ==');
CastleBankPath[4] := DTMFromString('mwQAAAHic42RgYGhnYmBYC8UrgXg9lL0CiGOBOAqIi4DqyoA4F4iDgdgFiM2AWBuIvYC4AIjTspIYmidMx4qnz5oIxsQARiIwHAAAAggXIw==');
end;

(*
Description: Walks a path set by an array of DTMs
Returns: True if the path has been succesfully walked, false if something went wrong
*)
function WalkDTMPathEx(DTM: Array of Integer; PathStart: Integer; PathEnd: Integer): boolean;
var
i: Integer;
x, y: Integer;
aFound: Extended;
timer, tries: Integer;
begin
for i := PathStart to PathEnd do
begin
tries := 0;
repeat
Inc(tries);
if FindDTMRotated(DTM[i], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) then
begin
Mouse(x, y, 3, 3, True);
FFlag(6);
if (i <> High(DTM)) then
begin
MarkTime(timer);
repeat
Wait(50 + Random(25));
until FindDTMRotated(DTM[i+1], x, y, MMX1, MMY1, MMX2, MMY2, -Pi/4, Pi/4, Pi/60, aFound) or (TimeFromMark(timer) > 20000);
if(TimeFromMark(timer) > 20000) then
begin
Writeln('DTM ' + IntToStr(i + 1) + ' not found');
Result := False;
Break;
end;
end;
break;
end;
Wait(500 + Random(500));
until(tries > 10);

Result := True;
if(tries > 10) then
begin
Writeln('DTM ' + IntToStr(i) + ' not found');
Result := False;
end;
end;
end;

function WalkDTMPath(DTM: Array of Integer): boolean;
begin
Result := WalkDTMPathEx(DTM, 0, High(DTM));
end;

(*
Description: Frees all DTMs in a given array
*)
procedure FreeDTMArray(DTM: Array of Integer);//DTM Freeing procedure.
var
i: Integer;
begin
for i := 0 to High(DTM) do
begin
FreeDTM(DTM[i])
end;
end;

(*
Description: Frees all DTMs in this script
*)
procedure FreDTMs;
begin
FreeDTMArray(AltarPath);
FreeDTMArray(InsideAltarPath);
FreeDTMArray(CastleBankPath);
end;

(*
Description: Autocolor function for the mysterious ruins
Returns: Mysterious runes orange color
*)
function RuinsColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.12, 1.88);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 2710230, MSX1, MSY1, MSX2, MSY2, 16);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 11.43) and (X <= 52.22) and (Y >= 9.44) and (Y <= 42.03) and (Z >= 4.82) and (Z <= 12.77) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;


(*
Description: Autocolor function for the runecrafting altar
Returns: Color of the flame in the middle of the altar
*)
function AltarColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(1.26, 0.31);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 6249053, MSX1, MSY1, MSX2, MSY2, 10);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 9.40) and (X <= 11.16) and (Y >= 9.68) and (Y <= 11.45) and (Z >= 11.25) and (Z <= 13.19) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;

(*
Description: Enters the mysterious ruins
Returns: True if the ruins have been entered, false if something went wrong
*)
function EnterRuins: boolean;
var
tpa : TPointArray;
atpa : T2DPointArray;
tries, i, x, y : Integer;
begin
tries := 1;
repeat
writeln('Searching for ruins');
FindColorsTolerance(tpa, RuinsColor, MSX1, MSY1, MSX2, MSY2, 25);
atpa := TPAToATPAEx(tpa, 20, 20);
SortATPASize(atpa, True);
for i := 0 to High(atpa) do
begin
writeln( 'TPA ' + IntToStr(i) + ' = ' + IntToStr(GetArraylength(ATPA[i])) );
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 3, 3);
Wait(800 + Random(300));
if WaitUpTextMulti( ['ysterious', 'uins', 'ruins', 'rious'], 100) then
begin
writeln('Ruins found');
GetMousePos(x, y);
Mouse(x, y, 0, 0, true);
Result := True;
Exit;
end;
end;
Wait(500 + Random(300));
Inc(tries);
until tries > 10;
Result := False;
end;

(*
Description: Loops trough all pouch inventory slots and empties them
Returns: True if the pouches have been emptied, false if something went wrong
*)
function EmptyPouches: boolean;
var
i: Integer;
tries: Integer;
begin

for i := 1 to numOfPouches do
begin
SMART_DrawBoxEx(False,InvBox(i),clRed);
MouseBox(InvBox(i).X1, InvBox(i).Y1, InvBox(i).X2, InvBox(i).Y2, mouse_right);
tries := 1
repeat
Inc(tries);
writeln('Searching for "Empty pouch" text')
wait(200+Random(400));
until (tries > 10) or ChooseOptionMulti(['Empty', 'mpty', 'pty']);
if(tries > 10) then
begin
Result := False;
end else
begin
Result := True;
end;
end;
end;

(*
Description: Loops trough all pouch inventory slots and fills them
Returns: True if the pouches have been filled, false if something went wrong
*)
function FillPouches: boolean;
var
i: Integer;
tries: Integer;
begin
for i := 1 to NumOfPouches do
begin
SMART_DrawBoxEx(False,InvBox(i),clRed);
MouseBox(InvBox(i).X1, InvBox(i).Y1, InvBox(i).X2, InvBox(i).Y2, mouse_right);
tries := 1
repeat
Inc(tries);
writeln('Searching for "Fill pouch" text')
wait(200+Random(400));
until (tries > 10) or ChooseOptionMulti(['Fill', 'ill']);
if(tries > 10) then
begin
Result := False;
end else
begin
Result := True;
end;
end;
end;

(*
Description: Finds and clicks the runecrafting altar
Returns: True if the altar has been clicked, false if it hasn't
*)
function FindAltar: boolean;
var
tpa : TPointArray;
atpa : T2DPointArray;
tries, i, x, y : Integer;
begin
tries := 1;
repeat
writeln('Searching for altar');
FindColorsTolerance(tpa, AltarColor, MSX1, MSY1, MSX2, MSY2, 5);
atpa := TPAToATPAEx(tpa, 20, 20);
SortATPASize(atpa, True);
for i := 0 to High(atpa) do
begin
writeln( 'TPA ' + IntToStr(i) + ' = ' + IntToStr(GetArraylength(ATPA[i])) );
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 3, 3);
Wait(500 + Random(300));
if WaitUpTextMulti( ['raft', 'rune', 'ltar'], 500) then
begin
writeln('Altar found');
GetMousePos(x, y);
Mouse(x, y, 0, 0, true);
Result := True;
Exit;
end;
end;
Wait(500 + Random(300));
Inc(tries);
until tries > 10;
Result := False;
end;

(*
Description: Enters the mysterious ruins
Returns: True if the ruins have been entered, false if something went wrong
*)
function CraftRunes: boolean;
var
i : Integer;
begin
for i := 1 to 2 do
begin
writeln('Crafting load ' + IntToStr(i));
if not FindAltar then
begin
Result := False;
Exit;
end;
if (i = 1) then
begin
if (numOfPouches = 0 ) then
begin
Wait(1000 + Random(500));
Result := True;
Exit;
end;
Wait(1000 + Random(500));
if not EmptyPouches then
begin
writeln('A problem occured emptying the pouches')
Result := False;
Exit;
end;
end;
end;
Wait(1000 + Random(500));
Result := True;
end;

(*
Description: Teleports the player using the ring of duelling
Parameter: True to teleport to dual arena, false to teleport to castle wars
Returns: True if the ring has been found and the player teleported, false if something went wrong
*)
function Teleport(arena: boolean): boolean;
var
tries: Integer;
invSlot: Integer;
begin
tries := 1;
invSlot := NumOfPouches + 1;
MouseBox(InvBox(invSlot).X1, InvBox(invSlot).Y1, InvBox(invSlot).X2, InvBox(invSlot).Y2, mouse_right);
SMART_DrawBoxEx(False,InvBox(invSlot),clRed);
wait(200+Random(200));
Result := False;
repeat
Inc(tries);
writeln('Searching for text')
if ChooseOptionMulti(['Rub', 'Ru', 'ub']) Then
begin
Wait(800 + Random(300));
tries := 12;
dec(TeleportsLeft);
Wait(800 + Random(300));
if(arena) then
begin
KeyDown(49);
Wait(75 + Random(75));
KeyUp(49);
Result := True;
end else
begin
KeyDown(50);
Wait(75 + Random(75));
KeyUp(50);
Result := True;
end;
end;
Wait(1000 + Random(300));
until tries > 10;
end;

(*
Description: Tries a couple of different DTMs to walk to the castle wars bank chest
Returns: True if the chest has been reached, false if it hasn't
*)
function ToCastleWarsChest : Boolean;
var
i: Integer;
begin

Result := False;
for i := 0 to High(CastleBankPath) do
begin
MouseBox(641, 123, 652, 132, 1);
FFlag(0);
Wait(RandomRange(1500, 2000));
begin
Result := True;
Break;
end;
Wait(500 + Random(500));
end;
end;

(*
Description: Temporay fix for the bank tab function in SRL since it wasn't working on tab 2 for some reason
Returns: The current bank tab opened
*)
function CurrentBankTabCustom: Integer;
begin
Result := -1;
if not BankScreen then
Exit;
for Result := 1 to 9 do
if InRange(GetColor(40 + 48 * (Result - 1), 83), 2831418, 2896954) then
Exit;
Result := 0;
end;

(*
Description: Switches to the correct tab and withdraws the rune essence
Returns: True if the essence has been withrawn, false if something went wrong
*)
function WithdrawEssence: boolean;
var
tries: Integer;
begin
if(CurrentBankTabCustom <> EssenceTab) then
BankTab(EssenceTab);
for tries := 1 to 14 do
begin
if Withdraw(0, 0, 28) then
begin
Result := True;
Exit;
end;
wait(500 + Random(500));
end;
Result := False;
end;

(*
Description: Switches to the correct tab and withdraws a ring of duelling
Returns: True if the ring has been withrawn, false if something went wrong
*)
function WithdrawRing: boolean;
var
tries : Integer;
begin
if(CurrentBankTabCustom <> RingTab) then
BankTab(RingTab);
for tries := 1 to 4 do
begin
if WithdrawEx((Ringslot MOD 10) - 1, RingSlot / 10, 1, ['duelling', 'uelling', 'ling', 'duel']) then
begin
Result := True;
Exit;
end;
wait(500 + Random(500));
end;
Result := False;
end;

(*
Description: Sorts an ATPA array by its boundaries' surface area (sort by size sorts by the amount of dots)
*)
procedure SortATPAByBoundaries( atpa : T2DPointArray);
var
i, j, maxIndex : Integer;
box1, box2 : TBox;
temp : TPointArray;
begin

for i := 0 to High(atpa) do
begin
maxIndex := i;
for j := i + 1 to High(atpa) do
begin
box1 := GetTPABounds(atpa[j]);
box2 := GetTPABounds(atpa[maxIndex]);
if( (box1.X2 - box1.X1) * (box1.Y2 - box1.Y1) > (box2.X2 - box2.X1) * (box2.Y2 - box2.Y1) ) then
maxIndex := j;
end;
temp := atpa[i];
atpa[i] := atpa[maxIndex];
atpa[maxIndex] := temp;
end;

end;

(*
Description: Find and opens the castle wars bank chest
Returns: True if the chest has been found and opened, false if something went wrong
*)
function OpenCastleWarsBank: boolean;
var
tpa : TPointArray;
atpa : T2DPointArray;
tries, i, x, y : Integer;
begin
tries := 1;
repeat
writeln('Searching for bank chest');
FindColorsTolerance(tpa, 11053488, MSX1, MSY1, MSX2, MSY2, 6);
atpa := TPAToATPAEx(tpa, 20, 40);
SortATPAByBoundaries(atpa);
for i := 0 to High(atpa) do
begin
writeln( 'TPA ' + IntToStr(i) + ' = ' + IntToStr(GetArraylength(ATPA[i])) );
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 3, 3);
if WaitUpTextMulti(['chest', 'est', 'Bank', 'ank'], 500) then
begin
writeln('Chest found');
Mouse(x, y, 3, 3, true);
Result := True;
Exit;
end;
end;
Wait(200 + Random(200));
Inc(tries);
until tries > 10;
Result := False;
end;

(*
Description: Takes care of all the banking related stuff in the script
*)
function Bank: boolean;
var
timer: Integer;
begin
Result := True;
//Open bank
Wait(1000+Random(500));
if OpenBankChest(SRL_BANK_CW) or BankScreen or PinScreen then
begin
MarkTime(timer);
repeat
Wait(250+Random(250));
until BankScreen or PinScreen or (TimeFromMark(timer) > 7000);
if (TimeFromMark(timer) > 15000) then
begin
writeln('BankScreen wait time exceeded');
Result := False;
Exit;
end;
if PinScreen and not InPin(Players[CurrentPlayer].Pin) then
begin
writeln('Failed to enter pin');
Result := False;
Exit;
end;
end else
begin
writeln('Failed to open bank');
Result := False;
if (Location <> LOC_LOST) and ToCastleWarsChest then
begin
Location := LOC_LOST;
Wait(3000 + Random(1000));
Result := Bank;
end;
Exit;
end;
//Deposit fire runes
Deposit(NumOfPouches+2,NumOfPouches+2, True);

//Check if a new ring of duelling is needed
if(TeleportsLeft <= 1) then
begin
Wait(250+Random(250));
if (TeleportsLeft <> 0) then
begin
Deposit(NumOfPouches+1, NumOfPouches+1, False);
end;
Wait(250+Random(250));
if not WithdrawRing then
begin
writeln('Ran out of rings of duelling');
Result := False;
Exit;
end;
TeleportsLeft := 8;
end;

//Withdraw essence a first time
Wait(250+Random(250));
if not WithdrawEssence then
begin
writeln('Ran out of essence');
Result := False;
Exit;
end;

if (numOfPouches > 0 ) then
begin
//Fill pouches
Wait(250+Random(250));
if not FillPouches then
begin
writeln('Failed to fill pouches');
Result := False;
Exit;
end;

//Withdraw essence a second time
Wait(250+Random(250));
if not WithdrawEssence then
begin
writeln('Ran out of essence');
Result := False;
Exit;
end;
end;


Wait(250+Random(250));
if not CloseBank then
begin
writeln('Failed to close bank');
Result := False;
Exit;
end;
wait(300 + Random(300))
end;

(*
Thanks and credits to YoHoJo for this antiban (copied parts of his antiban in his video tutorial)
(might implement more of my own antiban later)
*)
Procedure Antiban;
Begin
Case Random(150) Of
0:
begin
writeln('Antiban ... Hover runecrafting');
GameTab(tab_Stats) HoverSkill('Runecrafting', False);
Wait(500 + Random(500));
GameTab(tab_Inv);
end;
1:
begin
writeln('Antiban ... Examine inventory');
GameTab(tab_Inv);
ExamineInv;
end;
2:
begin
writeln('Antiban ... Sleep and move mouse');
SleepAndMoveMouse(4000 + Random(500));
end;
3:
begin
writeln('Antiban ... Hover random skill');
HoverSkill('random', False);
Wait(1000 + Random(500));
GameTab(tab_Inv);
end;
4:
begin
writeln('Antiban ... Look at stats');
GameTab(Tab_Stats);
Wait(3000 + Random(1500));
GameTab(tab_Inv);
end;
5:
begin
writeln('Antiban ... Pickup mouse');
PickUpMouse;
end;
6:
begin
writeln('Antiban ... Bored human');
BoredHuman;
end;

End;
End;

(*
Description: Tries to teleport to castle wars and bank if the player got lost
*)
function RecoverFromLost : Boolean;
begin
Result := False;
if Teleport(false) then
begin
wait(2000 + Random(1000));
if ToCastleWarsChest then
begin
wait(2000 + Random(1000));
if Bank then
begin
Result := True;
Location := LOC_TP_DA;
Exit;
end;
end;
end;
end;

(*
Description: Draws the smart overlay with experience and such
*)
procedure DrawSmartProggy;
var
h, m, s : Integer;
xpPerHour : Integer;
essencePerHour : Integer;
begin
SMART_ClearCanvas;
ConvertTime(TimeFromMark(Players[CurrentPlayer].Integers[3]), h, m, s);
xpPerHour := ((60 * 60 * 1000) / TimeFromMark(Players[CurrentPlayer].Integers[3])) * Players[CurrentPlayer].Integers[1];
essencePerHour := ((60 * 60 * 1000) / TimeFromMark(Players[CurrentPlayer].Integers[3])) * Players[CurrentPlayer].Integers[2];
SMART_DrawText(15, 35, 'UpChars', 'Maigel''s Fire RuneCrafter:', clLime);
SMART_DrawText(15, 50, 'UpChars', 'Ran for: '+ PadZ(IntToStr(h), 2)+':'+PadZ(IntToStr(m), 2)+':'+PadZ(IntToStr(s), 2), clWhite);
SMART_DrawText(15, 65, 'UpChars', 'Experience Gained: ' + IntToStr(Players[CurrentPlayer].Integers[1]), clWhite);
SMART_DrawText(15, 80, 'UpChars', 'Experience / Hour: ' + IntToStr(xpPerHour), clWhite);
SMART_DrawText(15, 95, 'UpChars', 'Essence Crafted: '+ IntToStr(Players[CurrentPlayer].Integers[2]), clWhite);
SMART_DrawText(15, 110, 'UpChars', 'Essence / Hour: '+ IntToStr(essencePerHour), clWhite);
end;

(*
Description: Prints out a progress report and commits to SRL Stats
*)
procedure ProgressReport;
var
xpGained : Integer;
h, m, s, player : Integer;
begin
xpGained := GetXPBarTotal - Players[CurrentPlayer].Integers[0];
Players[CurrentPlayer].Integers[0] := GetXPBarTotal;
Players[CurrentPlayer].Integers[1] := Players[CurrentPlayer].Integers[1] + xpGained;
Players[CurrentPlayer].Integers[2] := Players[CurrentPlayer].Integers[2] + (xpGained / 7);
ConvertTime(TimeFromMark(Players[CurrentPlayer].Integers[3]), h, m, s);
Writeln('*********************************************');
Writeln('Maigel''s Fire Runecrafter');
Writeln('*********************************************');
Writeln('Ran for: '+ PadZ(IntToStr(h), 2)+':'+PadZ(IntToStr(m), 2)+':'+PadZ(IntToStr(s), 2));
Writeln('*********************************************');
for player:=0 to High(Players) do
begin
Writeln('Player: '+Players[player].Nick);
Writeln('Experience Gained: '+IntToStr(Players[player].Integers[1]));
Writeln('Essence Crafted: '+IntToStr(Players[player].Integers[2]));
Writeln('*********************************************');
end;
DrawSmartProggy;
stats_IncVariable('Rune Essence (Crafted)', xpGained / 7);
stats_IncVariable('Runecrafting EXP (Gained)', xpGained);
stats_Commit;
end;

begin
//Setup Smart and other variables
Smart_Server := 1;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
ClearDebug;
SetupSRL;
DeclarePlayers;
LoginPlayer;
ClickNorth(SRL_ANGLE_HIGH);
Players[CurrentPlayer].Integers[0] := GetXPBarTotal;
Players[CurrentPlayer].Integers[1] := 0;
Players[CurrentPlayer].Integers[2] := 0;
MarkTime(Players[CurrentPlayer].Integers[3]);
TeleportsLeft := 0;
loadDTM;
Location := LOC_BANK;
SetupSRLStats(596, stats_Username, stats_Userpass);
stats_InitVariable('Rune Essence (Crafted)', 0);
stats_InitVariable('Runecrafting EXP (Gained)', 0);
if (stats_Username = '') then
begin
stats_Username := 'Anonymous';
stats_Userpass := 'anon1337';
end;
SetupSRLStats(596, stats_Username, Stats_Userpass);
// Main loop
repeat
Antiban;
FindNormalRandoms;
DrawSmartProggy;
Case Location of
LOC_DUEL_ARENA:
if walkDTMPath(AltarPath) then Location := LOC_RUINS else Location := LOC_LOST;
LOC_RUINS:
if EnterRuins then Location := LOC_INSIDE_ALTAR;
LOC_INSIDE_ALTAR:
if WalkDTMPath(InsideAltarPath) then Location := LOC_AT_ALTAR else Location := LOC_LOST;
LOC_AT_ALTAR:
if CraftRunes then Location := LOC_TP_CW else Location := LOC_LOST;
LOC_TP_CW:
if Teleport(False) then
begin
Location := LOC_CASTLE_WARS;
ProgressReport;
end else
begin
Location := LOC_LOST;
end;
LOC_CASTLE_WARS:
if ToCastleWarsChest then Location := LOC_BANK else Location := LOC_LOST;
LOC_BANK:
if Bank then Location := LOC_TP_DA else Location := LOC_LOST;
LOC_TP_DA:
if Teleport(True) then Location := LOC_DUEL_ARENA else Location := LOC_LOST;
LOC_LOST:
begin
writeln('Got lost!!! Atempting to recover.')
if not RecoverFromLost then
begin
end else
begin
writeln('Recoverd from being lost successfully!');
end;
end;
end;
Sleep(RandomRange(500,800));
until (False);
FreDTMs;
end.


Hey dude thanks!

Since op quit this script could you possibly further develop this?

AKCORP

2012-03-20 03:12:16

EDIT: Sorry my bad, I should look before I post :/

Mikka

2012-04-03 10:15:13

[Error] (152:11): Duplicate identifier 'FREEDTMS' at line 151
Compiling failed.

Dunno but I would love to use this script since it has such great reviews. :?

Edit: When you get that error just put in [Error] (152:11): Duplicate identifier 'FREDTMS' at line 151
Compiling failed.

Mikka

2012-04-03 10:33:56

Failed to open bank
DTM 0 not found
DTM 1 not found
DTM 2 not found
DTM 3 not found
DTM 4 not found

ect.. It runs just fine other than when you teleport to castle wars bank, then it just sits at the teleport spot and it says that. Then eventually it will log out, dunno what happened but it does one run then that happens as soon as it teleports there.

AKCORP

2012-04-21 04:43:22

If you don't have a members account, you can always get free membership when you create a new account, new thing Jagex is doing, you can test it with that.

Cheers

pkwa9lawy

2012-04-23 15:46:03

is this up to date? still working or.. i might try it once im home :D

Gushers

2012-06-04 03:33:22

Very nice script, but when I try to compile I get this error: "Duplicate identifier 'FREEDTMS' at line 151" Know how to fix this?

limmuri

2012-06-05 03:46:34

= no working =