SRL Archive - Bugs

Works in SCAR but not Simba?


XcanadamanX

2010-03-10 21:59:18

hey guys i'm absolutely stumped on this one. here is my procedure:
function CountItemDtm(dtm1: Integer): Integer;
var
i, x, y: Integer;
TB: Tbox;
begin
GameTab(tab_Inv);
for i := 1 to 28 do
begin
TB := InvBox(i);
writeln(tostr(TB.X1) + ' ' + tostr(TB.Y1) + ' ' + tostr(TB.x2) + ' ' + tostr(TB.y2));
if ExistsItem(i) then
begin
writeln('item exists');
if FindDtm(dtm1, x, y, TB.x1, TB.y1, TB.x2, TB.y2) then
begin
Inc(Result);
writeln('Found One')
end;
end;
end;
end;

in scar it works perfect…but in simba i get this as the output:
562 213 595 244
item exists
604 213 637 244
item exists
646 213 679 244
item exists
688 213 721 244
item exists
562 249 595 280
item exists
604 249 637 280
item exists
646 249 679 280
item exists
688 249 721 280
item exists
562 285 595 316
item exists
604 285 637 316
item exists
646 285 679 316
item exists
688 285 721 316
item exists
562 321 595 352
item exists
604 321 637 352
item exists
646 321 679 352
item exists
688 321 721 352
item exists
562 357 595 388
item exists
604 357 637 388
item exists
646 357 679 388
item exists
688 357 721 388
item exists
562 393 595 424
item exists
604 393 637 424
item exists
646 393 679 424
item exists
688 393 721 424
item exists
562 429 595 460
item exists
604 429 637 460
item exists
646 429 679 460
item exists
688 429 721 460
item exists
562 213 595 244
item exists
604 213 637 244
item exists
646 213 679 244
item exists
688 213 721 244
item exists
562 249 595 280
item exists
604 249 637 280
item exists
646 249 679 280
item exists
688 249 721 280
item exists
562 285 595 316
item exists
604 285 637 316
item exists
646 285 679 316
item exists
688 285 721 316
item exists
562 321 595 352
item exists
604 321 637 352
item exists
646 321 679 352
item exists
688 321 721 352
item exists
562 357 595 388
item exists
604 357 637 388
item exists
646 357 679 388
item exists
688 357 721 388
item exists
562 393 595 424
item exists
604 393 637 424
item exists
646 393 679 424
item exists
688 393 721 424
item exists
562 429 595 460
item exists
604 429 637 460
item exists
646 429 679 460
item exists
688 429 721 460
item exists
562 213 595 244
item exists
604 213 637 244
item exists
646 213 679 244
item exists
688 213 721 244
item exists
562 249 595 280
item exists
604 249 637 280
item exists
646 249 679 280
item exists
688 249 721 280
item exists
562 285 595 316
item exists
604 285 637 316
item exists
646 285 679 316
item exists
688 285 721 316
item exists
562 321 595 352
item exists
604 321 637 352
item exists
646 321 679 352
item exists
688 321 721 352
item exists
562 357 595 388
item exists
604 357 637 388
item exists
646 357 679 388
item exists
688 357 721 388
item exists
562 393 595 424
item exists
604 393 637 424
item exists
646 393 679 424
item exists
688 393 721 424
item exists
562 429 595 460
item exists
604 429 637 460
item exists
646 429 679 460
item exists
688 429 721 460
item exists
any help? and the dtm is fine since i use the dtm to get the stuff from the bank.

i luffs yeww

2010-03-10 22:44:57

Try just doing this..


function CountItemDtm(dtm1: Integer): Integer;
var
x, y: Integer;
TB: Tbox;
begin
GameTab(tab_Inv);
TB := InvBox(1);
if FindDtm(dtm1, x, y, TB.x1, TB.y1, TB.x2, TB.y2) then writeln('Found One');
end;

Just to see if it's actually finding the DTM.

XcanadamanX

2010-03-10 22:51:24

whats the difference? i check every spot and it still doesnt work

Mr. Doctor

2010-03-10 22:57:24

Simba is still in its beta stage Therefore, increasing the chance of encountering bugs when scripting.

XcanadamanX

2010-03-10 22:59:35

i know that…im just pointing out that i cannot find a dtm in an invbox…

Mr. Doctor

2010-03-10 23:01:03

From: XcanadamanX
i know that…im just pointing out that i cannot find a dtm in an invbox…


It probably is a bug then, contact Wizzup? and tell him. Or one of the other developers.

i luffs yeww

2010-03-10 23:03:11

Did you make the DTM in SCAR or Simba?

Mr. Doctor

2010-03-10 23:06:36

From: i luffs yeww
Did you make the DTM in SCAR or Simba?


Probably Scar. Simba doesn't contain a DTM editor yet.

XcanadamanX

2010-03-10 23:08:26

From: XcanadamanX

any help? and the dtm is fine since i use the dtm to get the stuff from the bank.


please read the last part of my post. the dtm is fine as it works in other parts of my script.

i luffs yeww

2010-03-10 23:23:12

Oh I thought you meant like.. you planned on using it for banking. :p Sorry.

mastaraymond

2010-03-11 10:13:52

More info is needed ;-).. Could you post a screenshot (png/bmp) and the DTM?

Wizzup?

2010-03-11 12:03:01

From: Mr. Doctor
It probably is a bug then, contact Wizzup? and tell him. Or one of the other developers.


That is what he is doing by posting here…

bugger0001

2010-03-11 16:41:51

I must admit I encountered the same problem with my FalBuggySmelter's Simba edition. I used exactly the same method to count the amount of bars I had while smelting and it always thought all the inventory slots were full of bars :p

XcanadamanX

2010-03-11 17:41:51

I cant really post the dtm because it is a dynamic dtm or whatever its called. i can post a screen shot but its only going to be a inv full of ores. should i try with a non-dynamic dtm an see if that makes a difference?

i luffs yeww

2010-03-11 17:50:08

You can. ;) If it's just ores, why do you need a DDTM, anyway? :p All the ores/bars are the same, just different colors.. Which doesn't matter for DTMs.

Wizzup?

2010-03-11 17:56:15

From: XcanadamanX
I cant really post the dtm because it is a dynamic dtm or whatever its called. i can post a screen shot but its only going to be a inv full of ores. should i try with a non-dynamic dtm an see if that makes a difference?


writeln(tdtmtopdtm(yourdtm)); :)

mastaraymond

2010-03-12 11:52:38

Just post the stuff :-).

XcanadamanX

2010-03-12 17:59:57

From: i luffs yeww
You can. ;) If it's just ores, why do you need a DDTM, anyway? :p All the ores/bars are the same, just different colors.. Which doesn't matter for DTMs.


Exactly…how can you tell the difference between ores if you have a generic midpoint? And yes colors do matter with dtms.

From: Wizzup?
writeln(tdtmtopdtm(yourdtm)); :)


(6, [(882, 491), (864, 489), (873, 494), (877, 503), (889, 496), (894, 483)], [1515574, 131072, 131072, 131072, 131072, 131072], [10, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], '')

e: its just weird because it used to work in simba before….

Wizzup?

2010-03-12 18:47:02

There were some changes to the DTM System. Thanks for the writeln, it'll help.

XcanadamanX

2010-04-05 22:10:17

Im still having problems with this…any suggestions?

Awkwardsaw

2010-04-05 22:28:40

if you just need to check if the ore/ bar is there, do a findcolor or a countcolor in that inv spot

i luffs yeww

2010-04-05 23:15:30

I still don't see why you don't just have bmps/color checks..

Wizzup?

2010-04-06 03:54:31

From: XcanadamanX
Exactly…how can you tell the difference between ores if you have a generic midpoint? And yes colors do matter with dtms.



(6, [(882, 491), (864, 489), (873, 494), (877, 503), (889, 496), (894, 483)], [1515574, 131072, 131072, 131072, 131072, 131072], [10, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], '')

e: its just weird because it used to work in simba before….


So there's only one point that you search for that needs a tolerance search?
Being point (882,491) with tolerance of 10. The rest seems to have no tolerance.
But then again, it may still be some ``issues'' in the recent code changes.
Looking through the code I don't directly see what's wrong, perhaps Raymond will. But this certainly has priority. :)

XcanadamanX

2010-04-06 08:57:13

ya only the midpoint has tolerance. the rest are the black outline which is the right color. thanks :)

mastaraymond

2010-04-07 05:33:54

Could you just post the script please? I cannot run any tests =(

XcanadamanX

2010-04-07 08:47:16

ok. i have to leave for school atm but ill post when i get a break.

edit:
{
__
__ __ (_ \
\ \/ /___ __ _ _ __ \/ ___
\ // __/ _` | `_ \ / __|
/ \ (_| (_| | | | | \__ \
/_/\_\___\__,_|_| |_| |___/
__ _ _
/ _\_ __ ___ ___| | |_ ___ _ __
\ \| '_ ` _ \ / _ \ | __/ _ \ '__|
_\ \ | | | | | __/ | || __/ |
\__/_| |_| |_|\___|_|\__\___|_|
____ _ _
/\ /\___ \ | || |
\ \ / / __) || || |_
\ V / / __/ |__ _|
\_/ |_____(_) |_|


NAME : Xcan's Smelter V2.4
WRITER : XcanadamanX (Xcan)
CATEGORY : Smelter
AUTOCOLOR : Yep
CONTACT : rstevenson23@gmail.com
SRL REV. : V4 rev#32
Scar REV. : 3.20d
==========================================================================
Smelts And Banks All Bars In Al Kharid.

==========================================================================
Instructions.
==========================================================================
1. USE Runescape with Low Detail, Very Bright.
2. Set your Screen to 32 bit TRUE color.
3. Set Playernames and Passwords in DeclarePlayers.
4. Set NumberOfPlayers.
5. Position your chars at Al Kharid bank.
6. Make sure your Players have ores/bars.
==========================================================================

Use anything you want in this script in your own personal scripts.
please credit me if you do this so no one thinks your stealing ;)

Valid Bars-> bronze,iron,steel,silver,gold,mithril,adamant,rune.
-> auto -smelts the best bar until it runs out of ores then finds the
next best bar. If a level is gained to go to the next bar,
it will change when it runs out of the ores of the other bar.
(will not make cannonballs in this setting)
Valid Cannonball options-> or-ball -smelts ores then makes cannonballs.
-> st-ball -makes cannonballs from steel bars. }



{$Define SMART} //Comment this if you want to use it with Regular RS

program XcanSmelterCannonBallMaker;
{$i SRL/SRL.Scar}
{$i SRL/SRL/Misc/debug.scar}

Type
TBar = record
Name : string;
Ore1, Ore2, Ore1Amount, Ore2Amount, Spot, Amount : Integer;
Ore1Hue, Ore1Sat, Ore2Hue, Ore2Sat : extended;
end;

Var
Bar,FurnDTM,randomload,x,y,CactusColor,WallColor,sbar,load,loads:integer;
mould,levels,Pbars,Cballs,TotalCballs,TotalBars,Ring:integer;
NoMould,NoRing,logged,Run:boolean;
exp:extended;
WorldNum :String;
BarInfo : TBar;

Const StartPlayer = 0; // Determines who will play first
World = 154; //world number
MSpeed = 15; //speed of the mouse...higher number higher speed, lower number lower speed
MySRLID = ''; // Must be a string!
MySRLPassword = ''; // Must be a string!
RunDir = 's'; // RunDirection when you find a fight.
RunFar = True; //just leave this
RunPercent = 30;
RandomLoads = 20; // how many random loads to do.
OnePlayerWaitTime = 360; //how long to wait in between logins if only one person is active (in secs)
PlayerWaitTime= {3}60; //wait between players
Debug = true; //debug the script?
{
====================================================================== }
VersionNumber = '2.45'; {
====================================================================== }


Procedure DeclarePlayers;
begin
HowManyPlayers:= 3; // Set Number of Players here.
NumberOfPlayers(HowManyPlayers); // Sets the Players Array Length;
CurrentPlayer:= StartPlayer; // CurrentPlayer = Array Index

Players[0].Name :=''; //username
Players[0].Pass :=''; //password
Players[0].Nick :=''; //3-4 consecutive letters of your user name(NOT First letter)
Players[0].Loc :='Bank'; //keep at Bank
Players[0].Strings[0] :='auto'; //type of bar auto,bronze,iron,steel,mithril,adamant,rune,gold,silver,or-ball(ore to cball),st-ball(steel to cball)
Players[0].Booleans[0] := false; //Use Ring Of Forging
Players[0].Strings[1] :='smart'; //run--conservative,full,none,random,smart
Players[0].Pin := ''; //Pin number
Players[0].integers[0]:=15; //how many loads per log in
Players[0].BoxRewards := ['mote', 'ostume', 'XP', 'Gem', 'ithril', 'oal'];
Players[0].Active :=true; //are you going to use this player

Players[1].Name :=''; //username
Players[1].Pass :=''; //password
Players[1].Nick :=''; //3-4 consecutive letters of your user name(NOT First letter)
Players[1].Loc :='Bank'; //keep at bank
Players[1].Strings[0] :='auto'; //type of bar auto,bronze,iron,steel,mithril,adamant,rune,gold,silver,or-ball(ore ot cball),st-ball(steel to cball)
Players[1].Booleans[0] := false; //Use Ring Of Forging
Players[1].Strings[1] :='smart'; //run--conservative,full,none,random,smart
Players[1].Pin := ''; //Pin number
Players[1].integers[0]:=15; //how many loads
Players[1].BoxRewards := ['mote', 'ostume', 'XP', 'Gem', 'ithril', 'oal'];
Players[1].Active :=true;

Players[2].Name :=''; //username
Players[2].Pass :=''; //password
Players[2].Nick :=''; //3-4 consecutive letters of your user name(NOT First letter)
Players[2].Loc :='Bank'; //keep at bank
Players[2].Strings[0] :='auto'; //type of bar auto,bronze,iron,steel,mithril,adamant,rune,gold,silver,or-ball(ore ot cball),st-ball(steel to cball)
Players[2].Booleans[0] := false; //Use Ring Of Forging
Players[2].Strings[1] :='smart'; //run--conservative,full,none,random,smart
Players[2].Pin := ''; //Pin number
Players[2].BoxRewards := ['mote', 'ostume', 'XP', 'Gem', 'ithril', 'oal'];
Players[2].integers[0]:=15; //how many loads
Players[2].Active :=true;{

Players[3].Name :=''; //username
Players[3].Pass :=''; //password
Players[3].Nick :=''; //3-4 consecutive letters of your user name(NOT First letter)
Players[3].Loc :='Bank'; //keep at bank
Players[3].Strings[0] :='auto'; //type of bar auto,bronze,iron,steel,mithril,adamant,rune,gold,silver,or-ball(ore ot cball),st-ball(steel to cball)
Players[3].Booleans[0] := false; //Use Ring Of Forging
Players[3].Strings[1] :='smart'; //run--conservative,full,none,random,smart
Players[3].Pin := ''; //Pin number
Players[3].BoxRewards := ['mote', 'ostume', 'XP', 'Gem', 'ithril', 'oal'];
Players[3].integers[0]:=15; //how many loads
Players[3].Active :=true; }
end;

Function LoadOreDtm(color:integer):Integer;
var MP: TDTMPointDef;
SP: array[0..4] of TDTMPointDef;
DTMSkel: TDTM;
Begin
MP.x:=882;
MP.y:=491;
MP.areasize:=0;
MP.areashape:=0;
MP.color:=color;
MP.tolerance:=10;
SP[0].x:=864;
SP[0].y:=489;
SP[0].areasize:=0;
SP[0].areashape:=0;
SP[0].color:=131072;
SP[0].tolerance:=0;
SP[1].x:=873;
SP[1].y:=494;
SP[1].areasize:=0;
SP[1].areashape:=0;
SP[1].color:=131072;
SP[1].tolerance:=0;
SP[2].x:=877;
SP[2].y:=503;
SP[2].areasize:=0;
SP[2].areashape:=0;
SP[2].color:=131072;
SP[2].tolerance:=0;
SP[3].x:=889;
SP[3].y:=496;
SP[3].areasize:=0;
SP[3].areashape:=0;
SP[3].color:=131072;
SP[3].tolerance:=0;
SP[4].x:=894;
SP[4].y:=483;
SP[4].areasize:=0;
SP[4].areashape:=0;
SP[4].color:=131072;
SP[4].tolerance:=0;
DTMSkel.MainPoint:=MP;
DTMSkel.SubPoints:=SP;
writeln(tdtmtopdtm(DTMSkel));
Result:=AddDTM(DTMSkel);

end;

Procedure XDebug(S:string);
begin
if debug then
writeln(s)
else
Status(s);
end;

Procedure LoadDtms;
Begin
Bar := DTMFromString('78DA637466626078CC80021AAAAA18FE03694' +
'620FE0F048C0140350F19D00013986484F2184D81FC1704D4D802' +
'F96F09A801B9E73D0135DE84ED020012890D95');
mould := DTMFromString('78DA637464626078CC800272535319FE03694' +
'620FE0F048CA640356F19D000231209A4BD816ADE1350E30F54F3' +
'90801A27A09A9B04D49803D53CC0AF0600DF080D32');
If BarInfo.Name = '' then
BarInfo.Name:=Lowercase(Players[CurrentPlayer].Strings[0]);
case BarInfo.Name of
'bronze':
begin
BarInfo.Ore1 := LoadOreDtm(3433391);
BarInfo.Ore2 := LoadOreDtm(5987167);
BarInfo.Ore1Hue := 0.02;
BarInfo.Ore1Sat := 0.18;
BarInfo.Ore2Hue := 0.00;
BarInfo.Ore2Sat := 0.07;
BarInfo.Ore1Amount:=28;
BarInfo.Ore2amount:=1;
BarInfo.Spot := 1;
BarInfo.Amount:= 14;
end;
'iron':
begin
BarInfo.Ore1 := LoadOreDtm(1581110);
BarInfo.Ore1Hue := 0.13;
BarInfo.Ore1Sat := 0.54;
BarInfo.Ore2:=0
BarInfo.Ore2Amount:=0
if (Players[CurrentPlayer].Booleans[0]) then
begin
Ring := DTMFromString('78DA63DCC5C4C050CFC8800C0C141418FE036' +
'990E87F2060DC0354D381AA06220B2381F421A09A2A026AF601D5' +
'941050B305A8A68D809AED84DD03008D110CF3');
end;
BarInfo.Ore1Amount:=28;
BarInfo.Spot := 3;
BarInfo.Amount:= 28;
end;
'steel':
begin
BarInfo.Ore1 := LoadOreDtm(1515574);
BarInfo.Ore2 := LoadOreDtm(1976104);
BarInfo.Ore1Hue := 0.34;
BarInfo.Ore1Sat := 0.90;
BarInfo.Ore2Hue := 0.5;
BarInfo.Ore2Sat := 0.9;
BarInfo.Ore2amount:=2
BarInfo.Ore1Amount:=27
BarInfo.Spot := 5;
BarInfo.Amount:= 10;
end;
'or-ball':
Begin
sbar := DTMFromString('78DA63946660601062400113DBDB19B880342' +
'310FF0702460520839B010D302291401A648E0C01353C40429880' +
'1A652021825F0D00B24D0699');
BarInfo.Ore1 := LoadOreDtm(1844541);
BarInfo.Ore2 := LoadOreDtm(1844517);
BarInfo.Ore1Hue := 0.2;
BarInfo.Ore1Sat := 0.2;
BarInfo.Ore2Hue := 0.0;
BarInfo.Ore2Sat := 0.59;
BarInfo.Spot := 5;
BarInfo.Amount:= 10;
BarInfo.Ore1Amount:=28;
BarInfo.Ore2amount:=2;
end;
'st-ball':
begin
sbar := DTMFromString('78DA63946660601062400113DBDB19B880342' +
'310FF0702460520839B010D302291401A648E0C01353C40429880' +
'1A652021825F0D00B24D0699');;
BarInfo.Ore1Amount := 28;
BarInfo.Ore2amount:=0;
end;
'silver':
begin
BarInfo.Ore1 := LoadOreDtm(10984603);
BarInfo.Ore1Hue := 0.2;
BarInfo.Ore1Sat := 0.2;
BarInfo.Ore2:=0
BarInfo.Ore1Amount:=28;
BarInfo.Ore2amount:=0;
BarInfo.Spot := 4;
BarInfo.Amount:= 28;
end;
'gold':
begin
BarInfo.Ore1 := LoadOreDtm(1746635);
BarInfo.Ore1Hue := 0.2;
BarInfo.Ore1Sat := 0.2;
BarInfo.Ore2:=0
BarInfo.Ore1Amount:=28;
BarInfo.Ore2amount:=0
BarInfo.Spot := 6;
BarInfo.Amount:= 28;
end;
'mithril':
begin
BarInfo.Ore1 := LoadOreDtm(6636869);
BarInfo.Ore2 := LoadOreDtm(1844517);
BarInfo.Ore1Hue := 0.2;
BarInfo.Ore1Sat := 0.2;
BarInfo.Ore2Hue := 0.0;
BarInfo.Ore2Sat := 0.59;
BarInfo.Ore1Amount:=25;
BarInfo.Ore2amount:=4;
BarInfo.Spot := 7;
BarInfo.Amount:= 5;
end;
'adamant':
begin
BarInfo.Ore1 := LoadOreDtm(4015677);
BarInfo.Ore2 := LoadOreDtm(1844517);
BarInfo.Ore1Hue := 0.5;
BarInfo.Ore1Sat := 0.31;
BarInfo.Ore2Hue := 0.0;
BarInfo.Ore2Sat := 0.59;
BarInfo.Ore1Amount:=28;
BarInfo.Ore2amount:=6;
BarInfo.Spot := 8;
BarInfo.Amount:= 5;
end;
'rune':
begin
BarInfo.Ore1 := LoadOreDtm(5130040);
BarInfo.Ore2 := LoadOreDtm(1844517);
BarInfo.Ore1Hue := 0.09;
BarInfo.Ore1Sat := 0.58;
BarInfo.Ore2Hue := 0.0;
BarInfo.Ore2Sat := 0.59;
BarInfo.Ore1Amount:=27;
BarInfo.Ore2amount:=8;
BarInfo.Spot := 9;
BarInfo.Amount:= 5;
end;
'auto': begin end;
else
begin
Writeln('You Entered an Invalid Bar Type...Terminating');
terminatescript;
end;
end;
end;



function FindCactusColor: Integer;
var
GC, a, l, TestColor: integer;
var
P:array of Tpoint;
Begin
//Result:=srl_AutoGetColor('Cactus');
//CactusColor:=Result;
//xdebug('Cactus Color = '+inttostr(result))
GC := 4618594;
Flag;
FindColorsSpiralTolerance(MMCX,MMCY, P, GC, MMX1,MMY1,MMX2,MMY2, 55);
debugTPA(p,'');
l:=GetArrayLength(P);
for a:= 0 to l-1 do
begin
TestColor := GetColor(P[a].x,P[a].y);
if (GetColor(P[a].x,P[a].y + 1)=TestColor-1708041) then
begin
Result := TestColor;
CactusColor:=Result;
xdebug('Cactus Color = ' + IntToStr(TestColor));
Exit;
end;
end;
xdebug('Could not find Cactus Color!');
TerminateScript;
Result := 0;
end;

Function InPin2(pin:String):Boolean;
Var i,x,y,tmpmousespeed:integer;
begin
if (PinScreen) and (players[currentplayer].pin <> '') then
begin
writeln('Found PinScreen');
mmouse(322,203,20,20);
for i:=0 to 3 do
begin
wait(200+random(100));
if not(ClickText(pin[i + 1], upchars, 1, 1, 512, 336, True)) then
begin
GetMousePos(x,y)
Mouse(x,y,5,5,true);
end;
wait(100+random(100))
tmpmousespeed := mousespeed;
repeat
If Random(10) <= 1 then
begin
mousespeed := 7;
IdleTime(200, 100, 0.2);
mousespeed := tmpmousespeed;
end;
if i=3 then
begin
repeat
wait(20)
until bankscreen
break;
end;
until Getcolor(434 + (i * 16),38) = 1930687
end;
end;
if (bankscreen) then result:=true;
end;

function XChooseOptionMulti(var num:integer; Text: TStringArray): Boolean;
var
B: TBox;
TPA, TextTPA: TPointArray;
aTPA: T2DPointArray;
I, H, HH, ii, L: Integer;
Occurances: TPointArray;

begin
Result := False;
GetClientDimensions(B.X2, B.Y2);
B.X1 := 0;
B.Y1 := 0;

FindColors(TPA, 4016722, B.X1, B.Y1, B.X2-1, B.Y2-1);
If Length(TPA) < 10 Then
Exit;
B.X2 := 0;
B.Y2 := 0;
aTPA := SplitTPAEx(TPA, 20, 20);
SortATPASize(aTPA, True);
B := GetTPABounds(aTPA[0]);

TPA := [];
FindColorsTolerance(TPA, 9812166, B.X1, B.Y1, B.X2, B.Y2, 3);
aTPA := SplitTPAEx(TPA, 7, 1);
SortATPAFromFirstPoint(aTPA, Point(B.x1, B.y1));

H := High(Text);
L := High(aTPA);

// debugatpa(atpa);
For I :=0 To H do
begin
TextTPA := LoadTextTPA(Text[i], UpChars, HH);
for ii := 0 to L do
If FindTextTPAInTPA(HH, TextTPA, aTPA[ii], TPA) Then
Begin
Result := True;
num := i;
MouseBox(B.x1 + 5, TPA[0].Y, B.x2 - 5, TPA[0].Y + 5, 1);
Exit;
End;
end;
end;

Function Level:boolean;
begin
Result:= (GetColor(471, 371)= 0) and (GetColor(380, 368)= 0) and (getcolor(207, 371) = 0)
if (result) then
begin
if not(loggedin) then
begin
result := false;
exit;
end;
xdebug('******** LEVEL UP ********');
WriteFileString(TheFile, '******** LEVEL UP ********' + Chr(13))
inc(Players[currentplayer].level[16]);
levels:=levels+1;
ReportVars[4]:=ReportVars[4]+1;
end;
end;

Function FindRing2:boolean;
Begin
If IsChatBoxTextAnyLine('Your Ring',0) then
result:= true;
end;

Function Findlevel: Boolean;
Var
i: Integer;

Begin
For I := 1 To 2 Do
Begin
Case I Of
1:If Level then
Result := True;
2:If FindRing2 then
begin
NoRing := true;
Result := True;
end;
end;
end;
End;

function XRadialWalk(TheColor: Integer; StartRadial, EndRadial: Integer; Radius:
Integer; Xmod, Ymod, Xoff, Yoff: Integer): Boolean;
var
point1:TPointArray;
i:integer;
begin
if (StartRadial = EndRadial) then
begin
xdebug('WARNING: Using LinearRalk, StarRadial, and EndRadial are the same');
if LinearRoadWalk(TheColor, StartRadial, Radius, XMod, YMod) then
Result := True;
end else
if (RadialWalkEx(Point1, MMCX, MMCY, thecolor, 0, startradial, endradial, radius)) then
for i := 0 to High(Point1) do
if MFNF(Point1[i].x + XOff, Point1[i].y + Yoff, Xmod, Ymod) then
begin
Result := True;
Break;
end;
end;

Procedure FindMould;
Begin
gametab(tab_Inv)
wait(250);
nomould:= Not(FindDtm(mould,x,y,MIX1,MIY1,MIX2,MIY2));
xdebug('Mould = ' + booltostr(not(nomould)));
end;

Procedure FindRing;
Begin
if (Players[currentplayer].Booleans[0]) then
begin
Gametab(5)
if FindDtm(Ring,x,y,MIX1,MIY1,MIX2,MIY2) then
NoRing:=False
else
NoRing:=True;
gametab(4)
end;
xdebug('Ring = ' + booltostr(noring));
end;

Function FindT:boolean;
Begin
repeat
if not Loggedin then Exit;
wait(600+random(200));
Until (FindText(x, y, 'amount', UpChars, MCX1, MCY1, MCX2, MCY2));
result:=true
End;

Function FindBankBooth:Boolean; Forward;
Procedure MyOpenBank; Forward;
Procedure InBank; Forward;

Function LoadBar:boolean;
Var z, TempCTS: integer;
Bars : array of string;
Levels : array of Integer;
Begin
TempCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
While not Bankscreen do
wait(100);
If lowercase(Players[currentplayer].strings[0]) = 'auto' then
begin
Bars := ['rune','adamant','mithril','gold','silver','steel','iron','bronze'];
Levels := [85,70,50,40,30,20,15,1];
For z := 0 to 7 do
begin
If Players[currentplayer].level[16] >= levels[z] then
begin
BarInfo.Name := Bars[z];
LoadDTMs;
SetColorspeed2Modifiers(BarInfo.Ore1Hue,BarInfo.Ore1Sat)
If FindDTM(BarInfo.Ore1,x,y,24,84,MSX2,MSY2) then
Begin
SetColorspeed2Modifiers(BarInfo.Ore2Hue,BarInfo.Ore2Sat)
If FindDTM(BarInfo.Ore2,x,y,24,84,MSX2,MSY2) then
begin
writeln('Found ' + Capitalize(Bars[z]) + ' Ores')
result:=True;
break;
end;
end;
end;
end;
end else
begin
LoadDTMs;
end;
SetColorspeed2Modifiers(0.2,0.2);
ColorToleranceSpeed(TempCTS);
if result = false then
writeln('Didn''t Find Any Ores');
end;

Procedure WithdrawOres(opt1,opt2:string;amount1,amount2:integer;UseTheRing:boolean);
var num1,tmpCTS:integer;
Begin
if (not(Loggedin)) then exit;
if (NoMould) then
if (BarInfo.Name = 'st-ball') or (BarInfo.Name = 'or-ball') then
if FindDtm(mould,x,y,24, 84,MSX2,MSY2) then
begin
Mouse(x,y,4,4,true)
NoMould:=False;
end else
begin
XDebug('Didnt Find Mould...')
closebank;
Logout;
exit;
end;
if(Players[CurrentPlayer].Booleans[0]) then
if (NoRing) then
if BarInfo.Name = 'iron' then
begin
if FindDtm(Ring,x,y,24, 84,MSX2,MSY2) then
begin
Mouse(x,y,4,4,true)
closebank;
while (bankscreen) do
wait(100);
wait(1000);
gametab(tab_Inv)
wait(1000);
if FindDtm(Ring,x,y,MIX1,MIY1,MIX2,MIY2) then
begin
Mouse(x,y,4,4,true);
NoRing:=False;
end;
MyOpenBank;
end else
begin
XDebug('Didnt Find Ring...')
closebank;
Logout;
exit;
end;
end;
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorspeed2Modifiers(BarInfo.Ore1Hue,BarInfo.Ore1Sat)
if BarInfo.Ore2 = 0 then
Begin
if FindDTM(BarInfo.Ore1,x,y,24, 84,MSX2,MSY2) then
Begin
repeat
wait(50);
Mouse(x,y,3,3,false);
wait(10);
Until(ChooseOption('All'))
end else
Begin
If LoadBar then
begin
InBank;
Exit;
end;
XDebug('Didnt Find Ores...Logging Out');
Players[currentplayer].strings[2]:= 'NMO';
closebank;
Logout;
ColorToleranceSpeed(tmpCTS);
exit;
end;
end else
begin
if FindDTM(BarInfo.Ore1,x,y,24, 84,MSX2,MSY2) then
Begin
repeat
Mouse(x,y,3,3,false);
wait(10);
Until(XChooseOptionMulti(num1,['-'+inttostr(amount1),opt1]))
if (opt1='X') and (num1 = 1) then
begin
if FindT then
TypeSend(inttostr(amount1));
end;
wait(500);
SetColorspeed2Modifiers(BarInfo.Ore2Hue,BarInfo.Ore2Sat)
If FindDTM(BarInfo.Ore2,x,y,24, 84,MSX2,MSY2) then
Begin
// writeln(getamount(x,y))
if GetAmount(x,y) >= BarInfo.Ore2Amount then
begin
repeat
Mouse(x,y,3,3,false);
wait(50);
Until(XChooseOptionMulti(num1,[opt2]))
if (opt2='X') then
begin
if FindT then
TypeSend(inttostr(amount2));
end;
end else
Begin
XDebug('Didnt Find Enough Ores...Logging Out');
Players[currentplayer].strings[2]:= 'NMO';
closebank;
Logout;
ColorToleranceSpeed(tmpCTS);
exit;
end;
end else
Begin
If LoadBar then
begin
DepositAll;
InBank;
Exit;
end;
XDebug('Didnt Find Ores...Logging Out');
Players[currentplayer].strings[2]:= 'NMO';
closebank;
Logout;
ColorToleranceSpeed(tmpCTS);
exit;
end;
end else
Begin
If LoadBar then
begin
DepositAll;
InBank;
Exit;
end;
XDebug('Didnt Find Ores...Logging Out')
Players[currentplayer].strings[2]:= 'NMO';
closebank;
Logout;
ColorToleranceSpeed(tmpCTS);
exit;
end;
end;
SetColorspeed2Modifiers(0.2,0.2);
ColorToleranceSpeed(tmpCTS);
end;


Procedure InBank;
Begin
if (not(Loggedin)) then exit;
if (not(bankscreen)) then exit;
wait(100)
If lowercase(BarInfo.Name) = 'auto' then
LoadBar;
Case BarInfo.Name of
'bronze':WithdrawOres('X','All T',14,14,false);
'iron','silver','gold':WithdrawOres('All','',0,0,Players[CurrentPlayer].Booleans[0]);
'steel':WithdrawOres('X','All',9,18,false);
'or-ball':WithdrawOres('X','All',9,0,false);
'st-ball':WithdrawOres('All','',0,0,false);
'mithril':WithdrawOres('5','20',5,20,false);
'adamant':WithdrawOres('X','All',4,0,false);
'rune':WithdrawOres('X','All',3,24,false);
End;
End;

Function Amount1:boolean;
begin
if (FindText(x,y,'Enter amount:',UpChars,MCX1,MCY1,MCX2,MCY2)=true) then
result:=true;
end;

function CountItemDtm(dtm1: Integer): Integer;
var
i, x, y: Integer;
TB: Tbox;
begin
GameTab(tab_Inv);
for i := 1 to 28 do
begin
TB := InvBox(i);
writeln(tostr(TB.X1) + ' ' + tostr(TB.Y1) + ' ' + tostr(TB.x2) + ' ' + tostr(TB.y2));
if ExistsItem(i) then
begin
writeln('item exists');
if FindDtm(dtm1, x, y, TB.x1, TB.y1, TB.x2, TB.y2) then
begin
Inc(Result);
writeln('Found One')
end;
end;
end;
end;

Function OreCount(num :integer):integer;
var TmpCTS : integer;
Begin
TmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
case num of
1 : Begin
SetColorspeed2Modifiers(BarInfo.Ore1Hue,BarInfo.Ore1Sat)
result:=CountItemDtm(BarInfo.Ore1);
end;
2 : Begin
SetColorspeed2Modifiers(BarInfo.Ore2Hue,BarInfo.Ore2Sat)
result:=CountItemDtm(BarInfo.Ore2);
end;
end;
ColorToleranceSpeed(TmpCTS);
end;

Function BarCount:integer;
Begin
result:=CountItemDtm(Bar);
end;

Function FNIRWait(Time:integer):Boolean;
var
t: Integer;
begin
for T := 1 to Time do
begin
Wait(200 + Random(50));
Result := FindNonInventoryRandoms
end;
end;

function HoverSmithing:boolean;
var timer,x,y:integer;
begin
GameTab(tab_Stats);
If Getcolor(731, 246) <> 5532018 then
begin
MMouse(723, 231, 5, 5);
getmousepos(x,y);
holdmouse(x,y,1);
timer := getsystemtime;
While (Getcolor(731, 246) <> 5532018) or (getsystemtime - timer > 2000) do
wait(20);
releasemouse(x,y,1);
end;
MMouse(687, 274, 10, 10);
if (FNIRWait(15 + Random(15))) then
result:=true;
GameTab(tab_inv);
end;

Function BarScreen:boolean;
begin
result:=(GetColor(37, 373)=10264383)
end;

Function BallScreen:boolean;
begin
result:=(GetColor(32, 358)=10264383)
end;

Function FindAll(num:integer):boolean;
var i :integer;
Begin
if not(loggedin) then exit;
while (barscreen) do
wait(100);
XDebug('Waiting...');
case num of
1:While (OreCount(1) > 0) do
begin
case i+1 of
1: begin
If Findlevel then
begin
Result:=True;
break;
end;
end;
2: Begin
If FindNormalRandoms then
begin
Result:= True;
break;
end;
end;
3: Begin
If random(100) > 80 then
IdleTime(400, 400, 0.5);
wait(10);
end;
4: Begin
If Random(100) >89 then
If HoverSmithing then
begin
result:=true;
break;
end;
End;
5: Begin
if Findfight then
begin
RunAway(RunDir,true,1,2000)
result:=true;
break;
end;
end;
6: Begin
If not(Loggedin) then
Begin
Result:=True;
Break;
end;
end;
end;
wait(300);
i:=i+1;
if i>6 then i:=0;
if BarInfo.Ore2 <> 0 then
if (OreCount(2) = 0) or (OreCount(2) < BarInfo.Ore2Amount) then
break;
end;
2:While (BarCount > 0) do
begin
case i+1 of
1: begin
If Findlevel then
begin
Result:=True;
break;
end;
end;
2: Begin
If FindNormalRandoms then
begin
Result:= True;
break;
end;
end;
3: Begin
If Random(100) >85 then
If HoverSmithing then
begin
result:=true;
break;
end;
IdleTime(400, 400, 0.5);
End;
4: Begin
If FindNormalRandoms then
begin
Result:= True;
break;
end;
end;
5: Begin
if random(100) > 89 then
begin
GameTab(Random(16)+21)
wait(1000 + random(4000))
gametab(tab_Inv)
IdleTime(400, 400, 0.5);
end;
end;
6: Begin
If random(100) > 70 then
IdleTime(400, 400, 0.5);
wait(10)
end;
7: Begin
Wait(1000)
end;
8: Begin
If random(100) > 94 then
begin
if random(10) >5 then
begin
KeyDown(VK_RIGHT)
FNIRWait(4+random(20))
KeyUp(VK_RIGHT)
makecompass('n')
end else
begin
KeyDown(VK_LEFT)
FNIRWait(4+random(20))
KeyUp(VK_LEFT)
makecompass('n')
;
end;
end;
end;
end;
if (not(loggedin)) then exit;
wait(200)
i:=i+1;
if i>8 then i:=0
end;
3:While (FlagDistance > 12) do
begin
//writeln(inttostr(flagdistance));
If FindNormalRandoms then
begin
Result:= True;
Break;
end;
if (not(loggedin)) then exit;
wait(500);
end;
end;
end;

procedure RunControl(Run: Boolean); //by Wizzup?
begin
Wait(10 + Random(20));
if Run then
KeyDown(17)
else
KeyUp(17);
Wait(10 + Random(20));
end;

Procedure SmartRun(ROn:boolean);
var color:string;
Begin
if ROn then
begin
if GetMMLevels('run',color) > (RunPercent+random(20)) then
begin
RunControl(True);
Run:=true;
end;
end else
begin
if Run = true then
begin
RunControl(false)
end;
Run:=False;
end;
end;

Procedure FindBank2;

var
bx, by, Bank: Integer;
WhichAngle: Extended;

Begin
Bank := DTMFromString('78DA634C6662600862C0003A8C0C0C40C4F01' +
'F081823816A7C50E5FFFC6162506680A80101B09A504C3592E86A' +
'22895013885F0D0015830FF8');
FindNormalRandoms;
if FindDtmRotated(Bank, bx, by, MMX1, MMY1, MMCX, MMY2, Radians(-30), Radians(30), 0.1,
WhichAngle) then
Begin
Mouse(bx + 2, by, 0, 0, True);
XDebug('Found DTM');
wait(500);
If FindAll(3) then
FindBank2;
end else
begin
FindNormalRandoms;
XDebug('Didnt Find DTM...looking for symbol');
wait(1000);
if FindSymbol(x, y, 'bank') then
begin
Mouse(x, y, 2, 2, true)
end
else
begin
logout;
exit;
end;
if FindAll(3) then findbank2;
wait(500);
if FindDtmRotated(Bank, x, y, MMX1, MMY1, MMX2, MMY2, -1.0, 1.0, 0.05,
WhichAngle) then
Mouse(x, y, 0, 0, true);
Wait(RandomRange(100,1000));
if lowercase(players[currentplayer].strings[1])='smart' then SmartRun(false);
if lowercase(players[currentplayer].strings[1])='conservative' then
RunControl(False);
If FindAll(3) then FindBank2;
FreeDtm(bank)
end;
wait(1500);
end;

Function MinATPASize(ATPA:T2DPointArray; Size:integer) : T2DPointArray;
var x, y: integer;
ATPATemp : T2DPointArray;
Begin
for x := 0 to high(ATPA) do
if high(ATPA[x]) > Size then
begin
Inc(y)
SetLength(ATPATemp,y)
SetLength(ATPATemp[y-1],high(ATPA[x]))
ATPATemp[y-1] := ATPA[x]
end;
Result := ATPATemp;
end;

Function FindBankBooth:boolean;
var i, x, TempCTS:integer;
Points : TPointArray;
ATPA : T2DPointArray;
MidPt :TPoint;
Begin
TempCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorspeed2Modifiers(0.05,1.99);
FindColorsTolerance(Points,6719128, MSX1, MSY1, MSX2, MSY2, 8)
if length(Points) > 100 then
begin
SortTPAFrom(Points,Point(MSX1,MSCY));
ATPA:=TPAtoATPAEX(Points,30,30)
ATPA:=MinATPASize(ATPA,50);
SortATPAFromFirstPoint(ATPA,Point(MSCX,MSCY));
DebugATPAbounds(ATPA);
i := High(ATPA)
for x := 0 to i do
begin
writeln(inttostr(x));
MidPt := MiddleTpa(ATPA[x]);
MMouse(MidPt.x,MidPt.y,0,0);
wait(100);
If IsUpText('ank') then
begin
result:=True
if findnormalrandoms then
result := false;
break;
end;
end;
end;
ColorToleranceSpeed(TempCTS);
end;

procedure MyOpenBank;
var Time,num:integer;
begin
If (not(Loggedin)) then exit;
FindNormalRandoms;
XDebug('Opening bank...');
if not (BankScreen) then
repeat
If (not(Loggedin)) then Break;
FindNormalRandoms;
if FindBankBooth() then
begin
getmousepos(x,y)
Wait(250);
Mouse(x,y,0,0,false);
wait(100);
if XChooseOptionMulti(num,['uick','se-q','ank']) then
begin
FFlag(0);
Time:=GetsystemTime;
repeat
Wait(500);
If (not(Loggedin)) then break;
if FindNormalRandoms then break;
InPin2(Players[CurrentPlayer].Pin);
until (BankScreen) or (GetsystemTime - time > 5000);
end;
end;
wait(500);
until (BankScreen);
writeln('exiting Bank procedure');
end;

function FindFurnace: Boolean;
var
arP: TPointArray;
aTPA: T2DPointArray;
tmpCTS: Integer;
fx,fy:integer;
label
Uptext;
begin
result := false;
tmpCTS := GetColorToleranceSpeed;
SetColorspeed2Modifiers(0.10,2.24)
ColorToleranceSpeed(2);
FindColorsTolerance(arP, 3822797, MSX1, MSY1, MSCX, MSY2, 11);
aTPA:=SplitTPA(arP,2);
if length(Atpa) > 0 then
begin
SortATPASize(aTPA,True);
DebugATPA(aTPA,'');
MiddleTPAEX(aTPA[0],x,y);
MMouse(x, y, 5, 5);
Wait(50 + Random(100));
Uptext:
if (IsUpText('urn')) then
begin;
Result := True;
GetMousePos(fx, fy);
Mouse(fx,fy,0,0,true)
SetColorspeed2Modifiers(0.2,0.2);
ColorToleranceSpeed(tmpCTS);
exit;
end
else if (isuptext('alk here')) then
begin
Getmousepos(x,y);
MMouse(x-15,y,2,2);
GoTo Uptext;
end
else if(IsUpText('ttack') or IsUpText('evel') or Isuptext('alk-to')) Then
begin
Mouse(fx,fy,0,0,false);
wait(200);
if OptionsExist(['melt'],true) then
begin
GetMousePos(x,y);
Mouse(x,y,0,0,true);
result := true;
SetColorspeed2Modifiers(0.2,0.2);
ColorToleranceSpeed(tmpCTS);
end;
end;
end;
end;

Procedure InFurnace; Forward;
//Procedure SaveRandomScreeny; Forward;

Procedure PickBar(spot,amount:integer);
var a,b,time:integer;
Begin
if (not(Loggedin)) then exit;
XDebug('Finding Furnace...');
time := Getsystemtime;
Repeat
if (GetsystemTime - time > 15000) then
begin
Xdebug('Couldn''t Find Furnace. Logging Out.')
//SaveRandomScreeny;
logout;
wait(2000);
end;
if (not(Loggedin)) then Break;
wait(250)
FindNormalRandoms;
until (FindFurnace)
if (not(Loggedin)) then exit;
XDebug('Found Furnace');
wait(100);
Time := getsystemtime;
while not(barscreen) do
begin
wait(200);
if (not(Loggedin)) then break;
if FindNormalRandoms then InFurnace;
if (GetsystemTime - time > 10000) then
begin
Infurnace;
exit;
end;
end;
if (not(Loggedin)) then exit;
XDebug('Found Bar Screen');
a:=((spot*50)+5);
b:=415;
wait(100);
if ((amount = 5) or (amount = 10)) then
begin
repeat
Mouse(a,b,0,0,false);
wait(100);
until ChooseOption(inttostr(amount))
exit;
end;
repeat
Mouse(a,b,0,0,false);
wait(200);
until (ChooseOption('melt X'))
FindT;
TypeSend(inttostr(amount));
wait(500);
end;

Procedure InFurnace;
Begin
PickBar(BarInfo.Spot,BarInfo.Amount)
if (FindAll(1)) then
begin
If not(loggedin) then exit;
Infurnace;
end;
end;

Procedure InFurnaceCannon;
var bars:integer;
Begin
Pickbar(5,10);
if (FindAll(1)) then
begin
If not(loggedin) then exit;
InFurnaceCannon;
end;
bars:=Barcount ;
ReportVars[1]:=ReportVars[1]+bars;
TotalBars:=TotalBars+bars;
Players[currentplayer].integers[1]:=Players[currentplayer].integers[1]+bars;
ReportVars[13]:=ReportVars[13]+bars;
end;

Procedure MakeCannonBalls;
var z : integer;
Begin
if (not(loggedin)) then exit;
if FindDtm(mould,x,y,MIX1,MIY1,MIX2,MIY2) then
begin
Repeat
if FindDtm(sbar,x,y,MIX1,MIY1,MIX2,MIY2) then
begin
if (not(loggedin)) then break;
Mouse(x,y,4,4,true);
wait(10);
Z := GetSystemTime;
if FindFurnace then
begin
repeat
wait(100);
until (ballscreen or (GetSystemTime - Z >= 10000))
end;
end else
begin
XDebug('Didnt Find Steel Bars...')
break;
end;
until (ballscreen)
repeat
if ballscreen then
begin
Mouse(254,395,4,4,false);
wait(100);
end else
MakeCannonballs;
until ChooseOption('All')
if (FindAll(2)) then
begin
MakeCannonBalls;
end;
end else
begin
XDebug('Didnt Find Mould...')
NoMould:=True;
exit;
end;
end;

Function FlagFound(x,y:integer): boolean;
Begin
wait(10)
if (FlagPresent) then
result:= (GetColor(x-2,y-10) = 255)
else
result:= true;
end;

Function FindClosestAPTASize(ATPA:T2DPointArray; MinSize:Integer) : T2DPointArray;
var ATPATemp : T2DPointArray;
MidPt : Tpoint;
Begin
ATPATemp:=MinATPASize(ATPA,MinSize);
SortATPAFrom(ATPATemp,Point(MMCX,MMCY));
MidPt := MiddleTPA(ATPATemp[0])
SortATPAFromFirstPoint(ATPATemp,Point(MidPt.x - 10,MidPt.y - 30));
Result := ATPATemp;
DebugATPABounds(ATPATemp);
end;

Function FindCactusMiddle(T:TpointArray):TpointArray;
Var Tpnt: T2DpointArray;
begin
if high(T) > 0 then
begin
TPnt:=FindClosestAPTASize(SplitTpa(T,1),55);
if high(Tpnt) > 0 then
begin
Setlength(Result,2);
Result[0]:=MiddleTpa(Tpnt[0]);
Result[1]:=MiddleTpa(Tpnt[1]);
end
else
exit;
end;
end;

Procedure ToCactus;
begin
XDebug('Walking to Furnace')
if (not(loggedin)) then exit;
if lowercase(players[currentplayer].strings[1])='smart' then SmartRun(true);
wait(100);
if (not(loggedin)) then exit;
XRadialWalk(CactusColor,100,20,65,1,-4,(-15+random(10)),(-15-random(15)));
if lowercase(players[currentplayer].strings[1])='smart' then SmartRun(false);
if FindAll(3) then ToCactus;
FindnormalRandoms;
wait(100);
end;

Procedure ToFurn;
var x,y,dist,a,x0,y0:integer;
theta1,theta : extended;
T,Points:TpointArray;
begin
if (not(loggedin)) then exit;
if lowercase(players[currentplayer].strings[1])='smart' then SmartRun(true);
If FindColorsSpiralTolerance(MMCX,MMCY,T,Cactuscolor,MMX1,MMY1,MMX2 - 30,MMY2 - 50,0)then
begin
xdebug('Found cactus''');
Points:=FindCactusMiddle(t)
if high(points) > 0 then
begin
dist:=Distance(Points[0].x,Points[0].y,Points[1].x,Points[1].y);
a := floor((dist * Sin(radians(64.1))) div sin(radians(77.46)))
y0 := Points[0].y;
x0 := Points[0].x - 7;
theta := -1 * degrees(arctan2(Points[1].y - Points[0].y, Points[0].x-Points[1].x));
theta1 := 90 - theta - 38.46;
x := x0 + floor(a*Sin(radians(theta1)));
y := y0 - floor(a*Cos(radians(theta1)));
writeln(dist);
writeln(theta);
writeln(theta1);
writeln(x);
writeln(y);
Mouse(x-random(8),y,0,0,true);
end else
begin
FindBank2;
exit;
end;
end else
begin
xdebug('didnt find cactus');
FindBank2;
ToCactus;
ToFurn;
end;
Wait(RandomRange(100,1000));
if lowercase(players[currentplayer].strings[1])='smart' then SmartRun(false);
if FindAll(3) then
toFurn;
wait(750);
Players[currentplayer].Loc:='Furnace';
end;

Procedure Vars;
var bars:integer;
Begin
Players[currentplayer].integers[1]:=Players[currentplayer].integers[1]+BarCount;
bars:=Barcount;
Pbars:=bars;
ReportVars[1]:=ReportVars[1]+bars;
TotalBars:=TotalBars+bars;
Case lowercase(BarInfo.Name) of
'bronze':Begin
Players[CurrentPlayer].Integers[3] := Players[CurrentPlayer].Integers[3] + bars
ReportVars[10]:=ReportVars[10]+bars;
End;
'iron':Begin
Players[CurrentPlayer].Integers[4] := Players[CurrentPlayer].Integers[4] + bars
ReportVars[11]:=ReportVars[11]+bars;
End;
'silver':Begin
Players[CurrentPlayer].Integers[5] := Players[CurrentPlayer].Integers[5] + bars
ReportVars[12]:=ReportVars[12]+bars;
End;
'steel':Begin
Players[CurrentPlayer].Integers[6] := Players[CurrentPlayer].Integers[6] + bars
ReportVars[13]:=ReportVars[13]+bars;
End;
'gold':Begin
Players[CurrentPlayer].Integers[7] := Players[CurrentPlayer].Integers[7] + bars
ReportVars[14]:=ReportVars[14]+bars;
End;
'mithril':Begin
Players[CurrentPlayer].Integers[8] := Players[CurrentPlayer].Integers[8] + bars
ReportVars[15]:=ReportVars[15]+bars;
End;
'adamant':Begin
Players[CurrentPlayer].Integers[9] := Players[CurrentPlayer].Integers[9] + bars
ReportVars[16]:=ReportVars[16]+bars;
End;
'rune':Begin
Players[CurrentPlayer].Integers[10] := Players[CurrentPlayer].Integers[10] + bars
ReportVars[17]:=ReportVars[17]+bars;
End;
end;
if (lowercase(players[currentplayer].strings[0])='st-ball') then
begin
Players[currentplayer].integers[2]:=Players[currentplayer].integers[2]+108;
ReportVars[18]:=ReportVars[18]+108;
CBalls:=Cballs+108;
TotalCballs:=TotalCballs+108;
end;
if (lowercase(players[currentplayer].strings[0])='or-ball') then
begin
Players[currentplayer].integers[2]:=Players[currentplayer].integers[2]+36
Players[currentplayer].integers[11]:=Players[currentplayer].integers[11]+36
ReportVars[18]:=ReportVars[18]+36;
CBalls:=Cballs+36;
TotalCballs:=TotalCballs+36;
end;
end;

Procedure ToBank;
begin
if (not(Loggedin)) then exit;
XDebug('Walking to Bank...');
FindNormalRandoms;
level;
if lowercase(players[currentplayer].strings[1])='smart' then SmartRun(true);
if lowercase(players[currentplayer].strings[1])='conservative' then
RunControl(true);
if not(XRadialWalk(CactusColor,200,160,65,0,0,-5-random(10),(-12-random(10)))) then
begin
wait(1000)
XDebug('Couldn''t Find with RW');
if FindColor(x,y,cactuscolor,MMX1, 80,MMCX, MMX2) then
mouse(x,y,4,4,true)
else
begin
wait(1000);
if (not(loggedin)) then
Begin
LoginPlayer;
MakeCompass('w');
ToBank;
end;
XDebug('Couldn''t Find with FindColor...Blind Clicking');
mouse(583, 92,4,4,true);
end;
end;
wait(randomRange(100,1000));
if lowercase(players[currentplayer].strings[1])='smart' then SmartRun(false);
if FindAll(3) then
ToBank;
wait(500);
if (not(loggedin)) then exit;
if lowercase(players[currentplayer].strings[1])='smart' then SmartRun(true);
FindBank2;
Players[currentplayer].Loc:='Bank'
end;

Procedure DepositQuick;
var InvItems : boolean;
I : integer;
begin
for I := 1 to 28 do
if ExistsItem(i) then
begin
InvItems := true;
break;
end;
if InvItems then
MouseBox(381, 298,410, 318,1);
end;

Procedure Bank;
Begin
//if (not(loggedin)) then exit;
if (not(Players[currentplayer].Booleans[0])) then
if not(BarInfo.Name = 'iron') then
if not(BarInfo.Name = 'gold') then
if not(BarInfo.Name = 'silver') then
if (invcount <> 0 ) then
if (InvCount = BarInfo.Ore1Amount) then exit;
MyopenBank;
fixbank;
if (BarInfo.Name = 'st-ball') or (BarInfo.Name = 'or-ball') then
Deposit(2,28,true)
else if (BarInfo.Name = 'steel') or (BarInfo.Name = 'rune') then
Deposit(1,27,true)
else
begin
case random(100) of
0..60: Deposit(1,28,true);
61..99: DepositQuick;
end;
end;
Players[currentplayer].Banked:=Players[currentplayer].Banked +1;
Banks:=Banks+1
end;

function AdvProg(num : integer; maxlength : integer) : string;
begin
result := Replicate(' ',maxlength-length(inttostr(num)));
end;

Function xp(i:integer):extended;
Begin
Case i of
3:Result:=6.2;
4:Result:=12.5;
5:Result:=13.7;
6:Result:=17.5;
7:Result:=22.5;
8:Result:=30;
9:Result:=37.5;
10:Result:=50;
11:Result:=17.5;
end;
end;

procedure ArrayToDebug(s: array of string); //creds to Abyssal
var
i: Integer;
begin
for i:= 0 to (GetArrayLength(s) - 1) do
begin
if s[i] <> '' then
writeln(s[i]);
end;
end;

Procedure Report;
Var ProgressText:array of string;
PActive, PBar, Spaces, Spaces2, Side1, Side2: String;
I, X, K, SpaceNumber, SpaceNumber2: Integer;
seconds, minutes, hours: extended;
Begin
//ChangeReportWidth(280);
//ClearReport;
Seconds := GetTimeRunning div 1000;
Minutes := Seconds div 60;
Hours := Minutes div 60;
SetArrayLength(ProgressText,(13+Howmanyplayers));
ProgressText[0]:=' _________________________________________________________ ';
ProgressText[1]:='/ Xcan''s Smelter/CannonballMaker \';
ProgressText[2]:='| V2.45 |';
ProgressText[3]:='|---------------------------------------------------------|';
ProgressText[4]:='|'+ Padr('Ran For: ' + TimeRunning + '.',57)+'|';
ProgressText[5]:='|'+Padr('Finished: '+inttostr(load)+' load(s).',57)+'|';
If totalbars > 0 then
ProgressText[6]:='|'+Padr('Made: '+inttostr(totalbars)+' bars.',57)+'|';
If TotalCballs > 0 then
ProgressText[7]:='|'+Padr('Made: '+inttostr(TotalCballs)+' cannonballs.',57)+'|';
For I := 0 to HowManyPlayers-1 do
begin
For X := 3 to 11 do
exp:=exp+(Xp(x)*Players[i].integers[x]);
exp:=exp+(Players[i].integers[2]*(25.5 div 4))
end;
ProgressText[8]:='|'+Padr('Gained: '+IntToStr(Round(exp))+' exp.',57)+'|';
If Levels > 0 then
ProgressText[9]:='|'+Padr('Gained: '+inttostr(levels)+' level(s).',57)+'|';
ProgressText[10]:='|'+Padr('Bars/Hr: ' +inttostr(round(totalbars/hours))+' , Xp/Hr: '+Inttostr(round(Exp/hours)) + ' , CBalls/Hr: ' +inttostr(round(totalCballs/hours)),57) + '|';
ProgressText[11]:='|_________________________________________________________|';
Side1:='|'
Side2:='|'
for I := 0 to HowManyPlayers-1 do
begin
if Players[I].Active then
PActive:='True, '
else
begin
if Players[i].strings[2] = 'NMO' then
PActive:='N.M.O, '
else
PActive:='False, ';
end;
If (Lowercase(Players[I].Strings[0]) = 'or-ball') or
(Lowercase(Players[I].Strings[0]) = 'st-ball')then
PBar:= (inttostr(Players[I].Integers[2]) + ' CBalls')
else
PBar:= (Inttostr(Players[I].Integers[1]) + ' Bars');
SpaceNumber := 12 - Length(Players[I].Name);
for K := 0 to SpaceNumber do
Spaces := Spaces + ' ';
SpaceNumber2 := 13 - (Length(PBar) + length(Inttostr(Players[I].Banked)))
for K := 0 to SpaceNumber2 do
Spaces2 := Spaces2 + ' ';
ProgressText[12+I]:=Side1 + IntToStr(I)+': '+Players[I].Name + Spaces +
'= ' + PActive + IntToStr(Players[I].Banked) + ' Bank[s],'+
' Smelted ' +(PBar) + Spaces2 + Side2;
Spaces := '';
Spaces2:= '';
end;
ProgressText[12+Howmanyplayers]:='\_________________________________________________________/';
ArrayToDebug(ProgressText)
If Xp(currentplayer) > 0 then
ReportVars[1]:=ReportVars[1]+Round(xp(currentplayer)*(pbars))
else
ReportVars[1]:=ReportVars[1]+Round(((9*17.5)+(Cballs*(6.375))));
SRLRandomsReport;
exp:=0
end;

{Procedure Intro;
begin
UseFindMod := false;
ChangeReportWidth(280);
ClearReport;
AddToReport(' __ ');
AddToReport(' __ __ (_ \');
AddToReport(' \ \/ /___ __ _ _ __ \/ ___ ');
AddToReport(' \ // __/ _` | `_ \ / __| ');
AddToReport(' / \ (_| (_| | | | | \__ \');
AddToReport(' /_/\_\___\__,_|_| |_| |___/');
wait(1000)
ClearReport;
AddToReport(' __ _ _ ');
AddToReport(' / _\ ___ _ __(_)_ __ | |_ ___ ');
AddToReport(' \ \ / __| ''__| | ''_ \| __/ __|');
AddToReport(' _\ \ (__| | | | |_) | |_\__ \ ');
AddToReport(' \__/\___|_| |_| .__/ \__|___/');
AddToReport(' |_| ');
wait(1000);
ClearReport;
AddToReport(' Brings You:');
Wait(1000);
ClearReport;
AddToReport(' Xcan''s Smelter/CannonballMaker');
AddToReport(' V'+Versionnumber)
Wait(1000);
AddToReport('');
AddToReport('');
AddToReport('');
AddToReport('Please POST All Progress Reports');
end;}


Procedure Runs;
begin
case lowercase(players[currentplayer].strings[1]) of
'random':Begin
Case Random(3) of
0:begin
players[currentplayer].strings[1]:='full';
Xdebug('Run = Full')
end;
1:begin
players[currentplayer].strings[1]:='conservative';
Xdebug('Run = Conservative')
end;
2:begin
players[currentplayer].strings[1]:='';
Xdebug('Run = None')
end;
end;
end;
end;
end;

Procedure Chats;
Begin
{SetChat('on',1);
SetChat('off',2);
SetChat('off',3);
SetChat('off',4);
SetChat('on',1); //double just to make sure
SetChat('off',2);
SetChat('off',3);
SetChat('off',4);}
Runs;
if lowercase(players[currentplayer].strings[1])='full' then
setrun(true)
else
setrun(false);
GetAllLevels;
gametab(tab_Inv);
setangle(true);
end;

procedure ScriptTerminate;
begin
FreeDtm(Bar);
FreeDtm(FurnDtm);
FreeDtm(BarInfo.Ore1);
FreeDtm(BarInfo.Ore2);
FreeSRLBitmaps;
Report;
xdebug('Script Ended')
end;

Procedure GetWorld;
Begin
gametab(tab_Friends);
WorldNum := GettextatEX(703, 207,100,smallChars,false,true,0,3,3381759,20,false,tr_ALLCHARS)
WorldNum := trim(WorldNum);
writeln('In world ' + WorldNum)
end;

Procedure ChangingWorld;
var player :integer;
Begin
if players[currentplayer].active = true then
begin
player := (CurrentPlayer + 1) mod Length(Players);
if (lowercase(Players[player].strings[0]) = 'or-ball') or (lowercase(Players[player].strings[0]) = 'st-ball') then
begin
writeln('Checking if Members World...');
if ReadINI('World' + WorldNum,'Type',Apppath + 'Includes\SRL\SRL\Misc\worlds.ini') = 'Free' then
begin
writeln('Changing to Members World...');
repeat
wait(1000);
until (SelectWorld(RandomWorld(True,False)))
end;
end
else
begin
writeln('Checking if Free World...');
if ReadINI('World' + WorldNum,'Type',Apppath + 'Includes\SRL\SRL\Misc\worlds.ini') = 'Members' then
begin
writeln('Changing to Free World...');
repeat
wait(1000);
until (SelectWorld(RandomWorld(False,False)))
end;
end;
end;
end;

{Procedure SaveRandomScreeny;
Begin
TakeScreenshot(ScriptPath+ TrimOthers(TimeRunning))
end;}

Procedure Main;
Begin
repeat
Randomload:=Random(randomloads);
repeat
if Players[currentplayer].Loc='Bank' then
begin
if lowercase(Players[currentplayer].strings[0]) = 'iron' then
if Players[currentplayer].integers[1] mod 140 = 0 then
FindRing;
Bank;
InBank;
Report;
ToCactus;
ToFurn;
end;
if Players[currentplayer].Loc='Furnace' then
begin
Case BarInfo.Name of
'bronze','iron','silver','gold','steel','mithril','adamant','rune':
begin
InFurnace;
end;
'st-ball':
Begin
MakeCannonBalls;
end;
'or-ball':
Begin
InFurnaceCannon;
MakeCannonBalls;
end;
end;
Vars;
ToBank;
Load:=Load+1;
Loads:=Loads+1;
ReportVars[0]:=ReportVars[0]+1;
end;
if (not(loggedin)) then
begin
logged:=false;
Logout;
break;
end
else
logged:=true;
until (Loads=(Players[currentplayer].integers[0]+randomload))
If Logged=true then
begin
Bank;
CloseBank;
Logout;
if PlayersActive=1 then
begin
Xdebug('Taking a Break for ' + inttostr(OnePlayerWaitTime/60) + ' minutes...');
wait(OnePlayerWaitTime*1000);
end
else
begin
Xdebug('Taking a Break for ' + inttostr(PlayerWaitTime/60) + ' minutes...');
wait(PlayerWaitTime*1000);
end;
Report;
end;
FreeDtm(BarInfo.Ore1);
Loads:=0;
if BarInfo.Ore2 > 0 then FreeDtm(BarInfo.Ore2);
Nextplayer(logged);
BarInfo.name := '';
logged:=true;
LoadDtms;
FindCactusColor;
FindRing;
FindMould;
Chats;
until(AllPlayersInactive)
end;

begin

Smart_Server:=world;
Smart_Members:=False
Smart_Signed:=True;
Smart_SuperDetail:=False;
SetupSrl;
//Intro;
Mousespeed:=Mspeed;
SRLID:=MySRLID;
SRLPassword:=MYSRLPASSWORD;
SRL_Procs[srl_OnLogOut] := @GetWorld;
SRL_Procs[srl_OnNextPlayer] := @ChangingWorld;
//SRL_Procs[srl_OnFindRandom]:= @SaveRandomScreeny;
DeclarePlayers;
LoginPlayer;
FindCactusColor;
LoadDtms;
FindMould;
FindRing;
Chats;
Main;
end.

If you need a character to test let me know.

edit: i did some testing (when i shouldve been studying), It seems as it can find the dtm in the whole inventory…but not in the inv boxes. I looked at the coords and they should be fine to find them in the inv boxes…

mastaraymond

2010-04-13 13:39:33

Yay! Finally found the bug, it was really little and pretty nasty! But I found it :). Should be fixed in the next version :). Thanks

XcanadamanX

2010-04-13 17:36:42

Yay!!! :)