Since I won long ago; i think I should post the script I entered with, IDK if it still works:
program NecklaceMaker;
{$i srl/srl/misc/smart.scar} //For smart use
{$i SRL/SRL.scar} //This needs to be in all scripts
{$i srl/srl/misc/paintsmart.scar}
{$i SRL\SRL\MISC\Stats.simba}
{$i SPS/SPS.simba} //For the children
{ Al-Khard Competetion Necklace Maker
AUTHOR: Kanah
Makes any type of necklace in Al-Kharid until a level goal, load goal,
or it runs out of items. It will use gold bars or gold ore, it will use
cut or uncut gems.
INSTRUCTIONS:
* Start in Al-Kharid Bank
* Enter Player information (What item you want to make)
* Choose between loads done and level goal
* Make sure items are visible in bank
* SPS wasn't working during the developement of this script so set variable
USESPS to false (unless it's been fixed recently) in const section
* Also had problems with FFlag so using IsMoving instead, it makes it slow
Necklaces that can be made:
'gold necklace'
'saphire necklace' (I could get ahold of any uncut saphire so it wont cut saphires)
'emerald necklace'
'ruby necklace'
'diamond necklace'
Wow Features:
1. Makes all types of necklaces
2. Faster bank finding due to my own function
3. TPA walking backup
4. Works at any compass setting
Features not included but should have been
1. Complete the AI (This revsion force you to start in a certain
area and can't recover from a mistake ) See my other scripts like the potmaker
if you dont know what i mean (DetermineAction)
2. SRL stats
3. Object DTM walking
}
procedure DeclarePlayers;
var
i: integer;
begin
HowManyPlayers := 2;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
i := 0;
Players[i].Name := '';
Players[i].Pass := '';
Players[i].Nick := '';
Players[i].Active := True;
Players[i].Pin := '';
Players[i].Banked := 0; //Load counter
Players[i].Integers := [10,0,0,53];//[Loads to do, Crafting XP, Current Crafting level, Crafting Level Goal];
Players[i].Strings := ['gold necklace'];//[item name]
Players[i].Booleans := [false];//[Level Goal]
//Additional players, remember to increment HowManyPlayers
Inc(i);
Players[i].Name := '';
Players[i].Pass := '';
Players[i].Nick := '';
Players[i].Active := false;
Players[i].Pin := '';
Players[i].Banked := 0;
Players[i].Integers := [20,0,0,0];//[Loads to do, Crafting XP, Current Crafting level, Crafting Level Goal];
Players[i].Strings := ['beef','best'];//[item name]
Players[i].Booleans := [false];//[Level Goal]
end;
Const
EXTRALIVES = 2;
{------- SRL Stats ---------}
SRLStats_User = '';
SRLStats_Password = '';
{-----Breaking Settings-----}
TAKEBREAKS = True; // Take breaks?
HOWOFTEN = 60; // How often to break in minutes
HOWOFTENRANDOM = 10; // Added randomness to how often you break
HOWLONG = 20; // How long to break for in minutes
HOWLONGRANDOM= 8; // Added randomness in break length
{---- AntiBan Settings ------}
CHANCE = 1.5; //this is the percent chance of taking a random action so 1.1 means 1.1% chance
ENABLEWORLDSWITCH = false;
MRAND = 2; //This is the randomness used in the Mouse and MMouse function calls
TIMEOUT = 3*60;//Fail safe max time spent on a single task in seconds
{--- problems ----}
SPSWALKING = false;
type
ItemInfo =
Record
name: string; //Primary item name
amount: integer; //amount I should try to withdraw
alternate: string; //This allows me to either have gold or gold ore
end;
procedure AntiBan;
//This proc preforms a random action
var
RandomNum, WorldNum, LoopCount: Integer;
Angle: Extended;
begin
//R8 angle taken out due to compass functions failing
//Angle := rs_GetCompassAngleDegrees;
RandomNum := Random(1000);
if ( RandomNum < (CHANCE*10) ) then
begin
RandomNum := Random(11);
Case RandomNum of
0: begin //Do a world switch
if ( ENABLEWORLDSWITCH ) then
begin
Writeln('Trying to switch worlds');
ExitToLobby;
Wait(300+random(1500));
WorldNum := RandomWorld(false,false);
LobbyTab(2);
SelectWorld(WorldNum);
writeln('Picking world '+ tostr(WorldNum));
wait(300+random(300));
LogInPlayer;
LogInPlayer; //FailSafe
end;
end;
1: begin //Click in a random direction
writeln('Trying a random click');
Mouse(Random(MSX2),Random(MSY2),0,0,false);
end;
2: begin //move change the camera angle
Writeln('Trying Random camera angle');
SetAngle(false);
wait(random(2000));
SetAngle(true);
end;
3: begin //Investigate a stat
Writeln('Trying investigate stat');
HoverSkill('Random', False);
wait(random(3000)+200);
GameTab(25);
end;
4: begin //Sit down and rest for a minute
Writeln('Sitting down and resting');
SetRest;
wait(random(10000));
end;
5: begin //Check out your equipment
Writeln('Trying to check Equipment');
GameTab(26);
wait(random(3000));
GameTab(25);
end;
6: begin //Move the mouse around randomly
Writeln('Moving mouse randomly');
RandomNum := random(15);
for LoopCount := 0 to RandomNum do
begin
MoveMouse(Random(MSX2),Random(MSY2));
wait(300+random(200));
end;
end;
7: begin //Do nothing for a minute
Writeln('Doing nothing for a bit');
wait(random(15000)+200);
end;
8: begin //Move mouse in star pattern on screen
//DrawStar;
end;
9: begin //Change Camera Orentation
Writeln('Trying to play with camera');
writeln('skipping this due to make compass failing all the time');
exit;
if ( Random(2) > 0 ) then
begin
SetAngle(false);
MakeCompass('rand');
wait(3000+random(3000));
end;
MakeCompass('rand');
wait(3000+random(3000));
//Return to the starting position
SetAngle(true);
MakeCompass(Angle);
end;
10: begin //Check friends list to see who's on
Writeln('Trying to investiage friends list');
GameTab(30);
wait(3000+random(3000));
GameTab(25);
end;
11: begin //report abuse on some random name but then chicken out and abort
end;
end;
end;
end;
procedure AntiRandoms;
begin
try
FindNormalRandoms;
except
writeln('Find normal randoms had a problem!!');
end;
end;
function DealWithLevelUp: Boolean;
//Borrowed from the potmaker
var
x,y: integer;
begin
//Check to see if I level'd
{if ( FindColorTolerance(x,y,16711680,MCX1,MCY1,MCX2,MCY2,2) ) then
begin
Mouse(x,y,MRAND,MRAND,true);
end;}
Result := ClickToContinue;
end;
function FindObjWithDTMRotated(var x,y,DTM: integer;Text: string): Boolean;
//This function finds an object using a dtm instead of a color
// to find an object, Modified to adjust for screen angle change
var
Locs: TPointArray;
i,L: integer;
Angle: Extended;
aFound: T2DExtendedArray;
begin
Angle := -1*rs_GetCompassAngleRadians;
result := false;
//if (FindDTMs(DTM,Locs,MSX1,MSY1,MSX2,MSY2)) then
if (FindDTMsRotatedSE(DTM,Locs,MSX1,MSY1,MSX2,MSY2,Angle - pi/180,Angle+pi/180,pi/720,aFound)) then
begin
writeln('Found some object DTMs');
L := Length(Locs);
writeln('There are '+tostr(L)+' Points to check');
//I should group the points
RAaSTPA(Locs,70);
L := Length(Locs);
writeln('There are '+tostr(L)+' Points to check after reduction');
//Now for all the points, mouse over and check the text
for i:= 0 to (L-1) do
begin
MMouse(Locs[i].x,Locs[i].y,MRAND,MRAND);
if WaitUpText(Text,350) then
begin
Result := true;
x := Locs[i].x;
y := Locs[i].y;
break;
end;
end;
end else
begin
writeln('Failed to find any DTMs for the object');
end;
end;
function FindObjWithDTM(var x,y,DTM: integer;Text: string): Boolean;
//This function finds an object using a dtm instead of a color
// to find an object, took it from my miller script
var
Locs: TPointArray;
i,L: integer;
begin
result := false;
if (FindDTMs(DTM,Locs,MSX1,MSY1,MSX2,MSY2)) then
begin
writeln('Found some object DTMs');
L := Length(Locs);
writeln('There are '+tostr(L)+' Points to check');
//I should group the points
RAaSTPA(Locs,70);
L := Length(Locs);
writeln('There are '+tostr(L)+' Points to check after reduction');
//Now for all the points, mouse over and check the text
for i:= 0 to (L-1) do
begin
MMouse(Locs[i].x,Locs[i].y,MRAND,MRAND);
if WaitUpText(Text,350) then
begin
Result := true;
x := Locs[i].x;
y := Locs[i].y;
break;
end;
end;
end else
begin
writeln('Failed to find any DTMs for the object');
end;
end;
function GetItemDTM(name: string): string;
//This fuction returns the string representation of the needed DTM
begin
Result := '';
Case name of
'gold ore': Result := 'mAAEAAHic42FgYMhlYmAoB+IsIC4F4jwgLgbiCiCuAuJaIE4D4kKoGAcjAwMrEAsCMS8QCyGx2YCYGYj/A839DcT/gHhdlwRDSoAFQ4ynMcP6bgmgCBNeLA4kkTEhwEgEZkbCyAAA7voN0A==';
'gold bar': Result := 'm6wAAAHic42ZgYHBkYmCwB2J3IHYGYg8gtgFiFyD2AmJ/IA4EYlsgZmdkYOABYk4gZgJiZiAWAmIRIOaDirNA5RY3iTMk+fEyXFouC2aDaKAMViwOJNExLsCIhGEmMGLBzKjaAFzCCnk=';
'gold necklace': Result := 'm1gAAAHic42JgYLBlYmBwBGIbJgjbFYh9gNgXyncHYgcgfgNU+wqIXwLxRyB+DcRPgfg+ED8G4utAfAuIF/eKM3RXCDPMbRcD8phwYnEgCcP4ACMBzAzFCAAAPoUPow==';
'saphire necklace': Result := 'mwQAAAHic42RgYLBlYmCwAmIHKO0IxG5A7A/E7kBsA8RvgOqeA/FrIP4Axa+A+AEQXwfi+0AsJNrEMLtNjKEyQ5Bh40xJoAgTBhYHksgYG2DEg5mhGA4A5LMPLA==';
'emerald necklace': Result := 'm1gAAAHic42JgYLBhYmBwAmJrKLYFYkcgdgdiHyD2ZIKoec0Awc+B+B0QfwTiD0D8EoifAvF1IL4PxMIdYgyT6kQYZjSLMqyfLgkUYcKKxYEkMsYFGAlgZihGAACgWRCT';
'ruby necklace': Result := 'm1gAAAHicfcqxDUBgGIThD51WBAOY0AQaE4gplAok6IjCAkSjEAkRI3g7f4FLnisuZ4pIqYs0KJCjQoceNVoM2PkeOLHiwoYFM0ZMyHxPosCSNHYlCW0W/ZVDq76i/TAUT25hXBWY';
'diamond necklace': Result := 'mwQAAAHic42RgYLBlYmCwAmInILZmgvA9gdgPiD2A2A6I+RgZGASAmB+IuYBYFIh5gJgNiP8BzWAA0isXLWS4cvoUQ3+1CENvlQhQkAkDiwNJZIwNMOLBzFAMBwBPHArP';
'oven': Result := 'mwQAAAHic42RgYLgHxLyMDAyJQBwOxAeB/F1A7A9kdwNxFxBPB/KFgfQTIH0KiPOAeDsQlwDxPAaIuK62NkOkpzVDXFwOg4ONOYOpsTGDhZkZw5bJFQzHF7UyxMRkMYgD1WHDulAMYrMAMSMBDAcAv0QUVg==';
'bank booth': Result := 'mwQAAAHic42RgYHgExPaMDAwOQOwIxM5AfAco9hiK7YD8k0D6IhDvAGIWIF8BiD8D2UuBuAWI+4D41+VlDDUti1Dw2xPzwOIg7OenxKALVCeOhnXRMCsQMxLAcAAA+vAcMg==';
//Uncut versions
'uncut sapphire': Result := '';
'uncut emerald': Result := 'm1gAAAHic42JgYHBiYmCwB2IPIHYHYgco7QPFzkBsAcRPgWpfAfEbBgj7AxS/A+LHQHwbiO8CMV+6AAN/hiADTzgfA5cXD1CECSsWB5LIGBdgJICZoRgBAIJCDiY=';
'uncut ruby': Result := 'm6wAAAHic42ZgYHBkYmBwAGI3IHZHYvtAsQcQWwOxORA/Aap/DcRvgfg5EH+AYhAfJHcXiG8D8WMgDhfiYQgQ4GZw4uVksOPhBIow4cTiQBIZ4wOMBDAzEkYCAPwHDv0=';
'uncut diamond': Result := 'm6wAAAHic42ZgYHBkYmCwBWIXIPYAYnso7QPF7kBsA8TmQPwMqP41EL8B4hdA/AGKXwHxYyC+C8S3oezJvb0MOzZsYGiqrWFIT04CijDhxOJAEhnjA4wEMDMSRgIAkk4T2Q==';
//Cut versions
'sapphire': Result := 'm6wAAAHichcpBCkBQAIThwdJCsnAWJaIkcREnsXMCV2MhsqBcwb/SS2Tqm5oaV1JmSzFyFKiQokSDGgkirPx3HNgw4zT2hBELum5QEPby/PYm2a9C+ukr1g/HYOQCQiYRdg==';
'emerald': Result := 'mAAEAAHicjctNCkBQFIbh45qSobIIm7qFIknJ6iyFgZAB2YKXbpIiXz3np9NxRCRVIjlKJMgQoUCNCjG0mQd+ekyYsWDDavbj1mFEi7AJTq72ri6iXvnUp69YP9g39+z1XRSr';
'ruby': Result := 'm1gAAAHic42JgYJjOxMAwCYhnAPEcIJ4M5c8F4gVAPB/KfwxU+xyIXwDxIyB+DcTvofQTIL4PxHeBeG1KAhiHCPKAcaooH1CUCQOLA0l0jA0wEsDMUIwAAB+zE98=';
'diamond': Result := 'm6wAAAHic42ZgYNjPxMCwC4j3AfFRID4M5YPoE0B8CohPAvFuIH4KVP8SiF8D8QsgfgzE74H4LRC/gvLvAvE9IF40ezbDwlkzGSZ0dTG4OTszVJaUAEWZsGJxIImOcQFGIjAzFCMBAJNmGmc=';
end;
end;
procedure GetItemList(var Items: Array of ItemInfo);
//This function returns the list of items I should withdraw
var
name: string;
i: integer;
begin
name := Players[CurrentPlayer].Strings[0];
writeln('looking up list for '+name);
if (name = 'gold necklace') then
begin
writeln('here');
SetLength(Items,1);
Items[0].name := 'gold bar';
Items[0].amount := 28;
Items[0].alternate := 'gold ore';
end else
begin
//Cut up name so i can get the gem name
i := pos(' ',name);
Delete(name,i,length(name));
//Now I can set up the Item list
SetLength(Items,2);
Items[0].name := 'gold bar';
Items[0].amount := 14;
Items[0].alternate := 'gold ore';
Items[1].name := name;
Items[1].amount := 14;
Items[1].alternate := 'uncut '+name;
end;
end;
function ValidateGetIngredients(Count:TIntegerArray): Boolean;
//This function returns true if all values in Count > 0
var
i,len: Integer;
begin
//Get the length
len := length(Count);
//Loop through em
Result := true;
for i := 0 to (len-1) do
begin
writeln('Count '+tostr(i)+' is '+tostr(Count[i]));
if (Count[i] = 0) then
Result := false;
end;
end;
function CraftScreen: Boolean;
//This determines if the craft screen is up
var
TPA: TPointArray;
len: integer;
begin
FindColorsTolerance(TPA,3358279,MSX1,MSY1,MSX2,MSY2,4);
len := length(TPA);
Result := (len >100000);
end;
function IsItemSelected(x,y:integer): Boolean;
//Checks for the white outline
var
i: integer;
begin
i := CoordsToItem(x,y);
Result := ItemActivated(i);
end;
function ClickItem: Boolean;
//Finds the yellow color and clicks the farthest right
var
ItemTP: TPoint;
YellowTPA: TPointArray;
YellowATPA: T2DPointArray;
begin
if not(FindColorsTolerance(YellowTPA,2145497,MSX1,MSY1,MSX2,MSY2,43)) then
exit;
SplitTPAWrap(YellowTPA,3,YellowATPA);
SortATPAFromFirstPointX(YellowATPA,IntToPoint(MSX2,MSCY));
ItemTP := MiddleTPA(YellowATPA[0]);
Mouse(ItemTP.x,ItemTP.y,MRAND,MRAND,false);
wait(500);
Result := true;
end;
function OpenAKBank: Boolean;
//This function attempts to open the bank faster then the SRL functions
var
len,leni, i,q,
BoothColor,BoothTol: Integer;
BoothTP: TPoint;
BoothTPA, probBank: TPointArray;
BoothATPA,TempATPA: T2DPointArray;
begin
BoothColor := 10735604;
BoothTol := 11;
if (BankScreen) then
begin
Result := true;
exit;
end;
if (FindColorsTolerance(BoothTPA,BoothColor,MSX1,MSY1,MSX2,MSY2,BoothTol)) then
begin
//SMART_DrawDotsEx(true,BoothTPA,clRed);
SplitTPAWrap(BoothTPA,1,BoothATPA);
//DrawDotsMulti(true,BoothATPA);
len := length(BoothATPA);
Setlength(TempATPA,len);
for i := 0 to (len-1) do
begin
leni := length(BoothATPA[i]);
if (leni > 40) and (leni < 200) then
begin
//writeln('length :'+tostr(leni));
TempATPA[q] := CopyTPA(BoothATPA[i]);
Inc(q);
end;
end;
//wait(1000);
SetLength(TempATPA,q);
SetLength(BoothATPA,q);
len := q;
if (len = 0) then
exit;
BoothATPA := CopyATPA(TempATPA);
//DrawDotsMulti(true,BoothATPA);
//wait(2000);
MergeATPAWrap(BoothATPA,BoothTPA);
SplitTPAWrap(BoothTPA,15,BoothATPA);
//DrawDotsMulti(true,BoothATPA);
//Assuming the biggest group is the correct group
SortATPASize(BoothATPA,true);
BoothTPA := CopyTPA(BoothATPA[0]);
SplitTPAWrap(BoothTPA,1,BoothATPA);
len := length(BoothATPA);
Setlength(probBank,len);
for i := 0 to (len-1) do
probBank[i] := MiddleTPA(BoothATPA[i]);
for i := 0 to (len-1) do
begin
MMouse(probBank[i].x,probBank[i].y,MRAND,MRAND);
if (WaitUpTextMulti(['ank','ooth','nk bo'],300)) then
begin
GetMousePos(BoothTP.x,BoothTP.y);
Mouse(BoothTP.x,BoothTP.y,0,0,false);
ChooseOption('qui');
while(IsMoving) do
wait(50);
if not(WaitFunc(@BankScreen,100,1500)) then
begin
if (WaitFunc(@PinScreen,100,1500)) then
begin
InPin(Players[CurrentPlayer].pin);
end;
end;
break;
end;
end;
end else
writeln('Failed to find booth colors');
Result := BankScreen;
end;
function FindOven(var x,y: integer): Boolean;
//This uses 2 methods to find the furnace:
// 1. Uses a dtm
// 2. Finds the black oven blob
var
OvenDTM: Integer;
begin
//Method 1
OvenDTM := DTMFromString(GetItemDTM('oven'));
if (FindObjWithDTMRotated(x,y,OvenDTM,'urn')) then
begin
writeln('Found furnace with dtm method');
Result := true;
end;
FreeDTM(OvenDTM);
if not(Result) then
begin
Result := FindObj(x,y,'urn',2631722,23);
if (Result) then
writeln('Found furnace with color method');
end;
end;
function CutGems: Boolean;
//This function cuts any uncut gems in the inventory
var
name: string;
i,cutDTM,uncutDTM,x,y,count1,count2: integer;
begin
name := Players[CurrentPlayer].Strings[0];
i := pos(' ',name);
Delete(name,i,length(name));
if (GetItemDTM(name) = '') then
exit;
cutDTM := DTMFromString(GetItemDTM(name));
if not(GetItemDTM('uncut '+name) = '') then
begin
uncutDTM := DTMFromString(GetItemDTM('uncut '+name));
if (FindDTM(uncutDTM,x,y,MIX1,MIY1,MIX2,MIY2)) then
begin
Mouse(x,y,MRAND,MRAND,false);
wait(100+random(200));
ChooseOption('raft');
i := 0;
while not(FindDTM(cutDTM,x,y,MCX1,MCY1,MCX2,MCY2))and (i <50) do
begin
wait(10);
Inc(i);
end;
if (i <> 50) then
begin
Mouse(x,y,MRAND,MRAND,true);
end;
end;
Repeat
count1 := CountItems('dtm',uncutDTM,[]);
if (count1 = 0) then
break;
wait(2000+random(400));
count2 := CountItems('dtm',uncutDTM,[]);
until (count1 = count2) or (count2 = 0)
FreeDTM(uncutDTM);
end;
Result := (CountItems('dtm',cutDTM,[])>0);
FreeDTM(cutDTM);
end;
function HandleBreaks( var BreakTimer, FirstBreakTime: Integer): Boolean;
//This function handles all breaking except the initial time setup
// it is required the BreakTimer has be initialized with a MarkTime before calling
// BreakTimer is the time Marker, FirstBreakTime is the settings for when to break
var
x,y: integer;
num: integer;
Font: String;
color,TextSpacing: integer;
Clock: TIntegerArray;
begin
Result := false;
Clock := [0,0,0];
if (TAKEBREAKS) then
begin
//Do the things required for taking a break
if ( TimeFromMark(BreakTimer) >= FirstBreakTime ) then
begin
//Time to logout and take this break
//Set my BreakTimer
MarkTime(BreakTimer);
FirstBreakTime := (HOWLONG + random(HOWLONGRANDOM))*60*1000;
//Time to logout
while (LoggedIn) do
Logout;
TextSpacing := 20;
color := 592381;
Font := 'SmallChars';
//Here I wait
while ( TimeFromMark(BreakTimer) < FirstBreakTime) do
begin
wait(1000);
x := MIX1;
y := MIY1;
ConvertTime(GetTimeRunning,Clock[0],Clock[1],Clock[2]);
ClearRSCanvas(SMART_Canvas.canvas);
Smart_DrawText(x,y,Font,'=========== kanah AK necklace maker =============',color);
y:=y+TextSpacing;
Smart_DrawText(x,y,Font,'Time Running ' +tostr(Clock[0])+':'+tostr(Clock[1])+':'+tostr(Clock[2]),color);
y:=y+TextSpacing;
Smart_DrawText(x,y,Font,'Taking a Break',color);
//Now time to set up time remaining in break
num := FirstBreakTime - TimeFromMark(BreakTimer);
if ( num < 0 ) then
num := 0;
Clock[0] := floor(num/(1000*60*60));//Hours
Clock[1] := floor((num-(Clock[0]*1000*60*60))/(1000*60));//Minutes
Clock[2] := floor((num-(Clock[0]*1000*60*60)-(Clock[1]*1000*60))/1000);//Seconds
y:=y+TextSpacing;
Smart_DrawText(x,y,Font,'Time Remaining in break ' +tostr(Clock[0])+':'+tostr(Clock[1])+':'+tostr(Clock[2]),color);
end;
//Log back in
while not(LoggedIn) do
LoginPlayer;
//Tell the program how to procede from here
Result := true;
MarkTime(BreakTimer);
FirstBreakTime := (HOWOFTEN + random(HOWOFTENRANDOM))*60*1000;
end;
end;
end;
procedure ProgressReport(Action: Integer);
//This prints out the current activity and time running
var
Clock: TIntegerArray;
ActionText: TStringArray;
x,y, TextSpacing, color: integer;
Font: String;
RandomFact: string;
begin
ActionText := ['Deposit items','Withdraw items','Walking to furnace',
'Making necklaces','Walking to bank'];
Clock := [0,0,0];
ConvertTime(GetTimeRunning,Clock[0],Clock[1],Clock[2]);
writeln('==== Kanah AK Necklace maker ====');
Writeln('Time Running ' +tostr(Clock[0])+':'+tostr(Clock[1])+':'+tostr(Clock[2]));
writeln('Current action: '+ActionText[Action]);
if (Players[CurrentPlayer].Booleans[0]) then
begin
writeln('Level Goal: '+tostr(Players[CurrentPlayer].Integers[2])+' / '+tostr(Players[CurrentPlayer].Integers[3]));
end else
writeln('Trips completed: '+tostr(Players[CurrentPlayer].Banked)+' / '+tostr(Players[CurrentPlayer].Integers[0]));
writeln('=======================================');
TextSpacing := 20;
x := (MSX1+MSX2)/2;//MIX1;
y := 5;//MIY1;
color := 592381;
Font := 'UpChars';
//Here it draws on the screen
ClearRSCanvas(SMART_Canvas.canvas);
Smart_DrawText(x,y,Font,'==== Kanah AK Necklace maker ====',color);
IncEx(y,TextSpacing);
Smart_DrawText(x,y,Font,'Time Running ' +tostr(Clock[0])+':'+tostr(Clock[1])+':'+tostr(Clock[2]),color);
IncEx(y,TextSpacing);
Smart_DrawText(x,y,Font,'Current Action: '+ActionText[Action],color);
IncEx(y,TextSpacing);
if (Players[CurrentPlayer].Booleans[0]) then
begin
Smart_DrawText(x,y,Font,'Level Goal: '+tostr(Players[CurrentPlayer].Integers[2])+' / '+tostr(Players[CurrentPlayer].Integers[3]),color);
end else
Smart_DrawText(x,y,Font,'Trips completed: '+tostr(Players[CurrentPlayer].Banked)+' / '+tostr(Players[CurrentPlayer].Integers[0]),color);
IncEx(y,TextSpacing);
end;
{*******************************************************************************
function TPAWalk(ColorInfo: TExtendedArray; Target: TPoint; Dist: Integer): Boolean;
By: Kanah
Description: Finds color based on colorinfo ( [color,Tolerance] or [color,Tolerance,HueMod,SatMod]
then finds the closest point to Target; if the distance between target and closest point
is less than dist then it walks there. All this is done on the minimap
The target point is also rotated to compensate for any deviation in compass
angle from north so Target should be defined for a north compass angle.
ColorInfo - [Color,Tolerance] or [color,Tolerance,HueMod,SatMod]
Target - The approximate place to click
Dist - the max distance from Target that would constitute a click there
*******************************************************************************}
function TPAWalk(ColorInfo: TExtendedArray; Target: TPoint; Dist: Integer): Boolean;// [url]http://paste.villavu.com/show/1533/[/url]
var
len,tmpCTS: integer;
ColorTPA: TPointArray;
Angle: Extended;
begin
CountItems
len := length(ColorInfo);
Result := false;
Angle := -1*rs_GetCompassAngleRadians;
Target := RotatePoint(Target,Angle,MMCX,MMCY);
//Decide which option we're using
if (len = 4) then
begin
//Set up the HueMod and SatMod
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(ColorInfo[2], ColorInfo[3]);
end else if (len <> 2) then
begin
writeln('Wrong length for ColorInfo');
exit;
end;
//Perform the color finding
if (FindColorsTolerance(ColorTPA,Round(ColorInfo[0]),MMX1,MMY1,MMX2,MMY2,Round(ColorInfo[1]))) then
begin
//Sort from the Target
//SMART_DrawDots(ColorTPA);
SortTPAFrom(ColorTPA,Target);
//Check the distance
if (Distance(ColorTPA[0].x,ColorTPA[0].y,Target.x,Target.y)<dist) then
begin
//Now lets walk there
Mouse(ColorTPA[0].x,ColorTPA[0].y,2,2,true);
FFlag(5);
wait(random(300));
Result := true;
end else
writeln('Color not found in correct location on Minimap');
end else
writeln('Failed to find color on minimap');
if (len = 4) then
begin
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;
end;
function WalkBackup(ToBank: Boolean): Boolean;
//This uses TPA walk as a back up just in case SPS is failing
var
i,len: integer;
MouseTPA: TPointArray;
Colors: TIntegerArray;
GoalTP,myTP: TPoint;
begin
if (ToBank) then
begin
Colors := [6324617,6324617,6983092];
MouseTPA := [IntToPoint(644,108),IntToPoint(626,116),IntToPoint(599,106)];
GoalTP := IntToPoint(4915, 3995);
end else
begin
Colors := [6324617,6324617,12632256];
MouseTPA := [IntToPoint(662,62),IntToPoint(647,39),IntToPoint(601,83)];
GoalTP := IntToPoint(4915, 3995);
end;
len := length(Colors);
for i := 0 to (len-1) do
begin
myTP := SPS_GetMyPos;
if (Distance(myTP.x,myTP.y,GoalTP.x,GoalTP.y) <30) then
break;
TPAWalk([Colors[i],35],MouseTPA[i],20);
while(IsMoving) do
wait(10);
end;
myTP := SPS_GetMyPos;
Result := (Distance(myTP.x,myTP.y,GoalTP.x,GoalTP.y) <30);
Result := true;
end;
//What i need to do / Core functions
// 1. withdraw items
// 2. Walk to furnace
// 3. Make items
// 4. Walk back
// 5. Deposit everything
function WithdrawItems: Boolean;
//This function gets the items out of the bank
var
Items: Array of ItemInfo;
ItemDTM,x,y,
i,len: integer;
count: TIntegerArray;
ItemTP: TPoint;
begin
//if not(OpenBankNPC) then
if not(OpenAKBank) then
begin
writeln('Failed to open bank');
exit;
end;
WaitFunc(@BankScreen,100,3000);
wait(1000);
//Now get the item list to search for
GetItemList(Items);
len := length(Items);
writeln(len);
SetLength(count,len);
for i := 0 to (len-1) do
begin
writeln('Looking for item: '+Items[i].name);
ItemDTM := DTMFromString(GetItemDTM(Items[i].name));
if (FindDTM(ItemDTM,x,y,MSX1,MSY1,MSX2,MSY2)) then
begin
ItemTP := MSTPointToBankPoint(IntToPoint(x,y));
Withdraw(ItemTP.x,ItemTP.y,Items[i].amount);
wait(900+random(100));
end else
writeln('Failed to find '+Items[i].name);
count[i] := CountItems('dtm',ItemDTM,[]);
FreeDTM(ItemDTM);
if (count[i] = Items[i].amount) then
continue;
if (Items[i].alternate = '') then
continue;
//Look for the alternate item
writeln('Looking for alternate item '+Items[i].alternate);
ItemDTM := DTMFromString(GetItemDTM(Items[i].alternate));
if (FindDTM(ItemDTM,x,y,MSX1,MSY1,MSX2,MSY2)) then
begin
ItemTP := MSTPointToBankPoint(IntToPoint(x,y));
Withdraw(ItemTP.x,ItemTP.y,(Items[i].amount-count[i]));
wait(900+random(100));
end else
writeln('Failed to find '+Items[i].alternate);
IncEx(count[i],CountItems('dtm',ItemDTM,[]));
FreeDTM(ItemDTM);
end;
CloseBank;
Result := ValidateGetIngredients(count);
end;
function Walk(ToBank: Boolean): Boolean;
//This function walks back and forth
var
myPath: TPointArray;
GoalTP,myTP: TPoint;
begin
if not(SPSWALKING) then
begin
Result := WalkBackup(ToBank);
end;
myPath := [Point(4915, 3995), Point(4938, 3994), Point(4941, 3979), Point(4945, 3961), Point(4950, 3946), Point(4964, 3931), Point(4972, 3922), Point(4962, 3917), Point(4946, 3917), Point(4934, 3917)];
if (ToBank) then
InvertTPA(myPath);
GoalTP := myPath[high(myPath)];
myTP := SPS_GetMyPos;
Result := Distance(GoalTP.x,GoalTP.y,myTP.x,myTP.y) < 20;
if (Result) then
exit;
writeln('Trying to walk path');
Result := SPS_WalkPath(myPath);
while (IsMoving) do
wait(100);
myTP := SPS_GetMyPos;
Result := Distance(GoalTP.x,GoalTP.y,myTP.x,myTP.y) < 20;
end;
function Make: Boolean;
//This function makes the item
var
x,y,i,q,OvenDTM,count1,count2,NecklaceDTM,
GoldOreDTM,GoldBarDTM: integer;
begin
//First I need to get rid of any gold ore I have
GoldOreDTM := DTMFromString(GetItemDTM('gold ore'));
GoldBarDTM := DTMFromString(GetItemDTM('gold bar'));
OvenDTM := DTMFromString(GetItemDTM('oven'));
//Deal with any uncut gems
CutGems;
if (FindDTM(GoldOreDTM,x,y,MIX1,MIY1,MIX2,MIY2)) then
begin
//Click the item
for i := 0 to 3 do
begin
Mouse(x,y,MRAND,MRAND,true);
wait(100+random(200));
if (IsItemSelected(x,y)) then
break;
end;
//Click the oven
//if (FindObjWithDTM(x,y,OvenDTM,'urna')) then
if (FindOven(x,y)) then
begin
GetMousePos(x,y);
Mouse(x,y,0,0,true);
wait(1000+random(600));
end else
begin
writeln('Failed to find oven');
FreeDTM(GoldOreDTM);
FreeDTM(GoldBarDTM);
FreeDTM(OvenDTM);
exit;
end;
//Click the gold symbol
if (FindDTM(GoldBarDTM,x,y,MCX1,MCY1,MCX2,MCY2)) then
begin
Mouse(x,y,MRAND,MRAND,true);
Repeat
count1 := CountItems('dtm',GoldOreDTM,[]);
ClickToContinue;
wait(2000+random(600));
count2 := CountItems('dtm',GoldOreDTM,[]);
until (count1 = count2) or (count2 = 0)
end else
writeln('Failed to find gold in chat');
end;
//Now make the actual necklace
if (FindDTM(GoldBarDTM,x,y,MIX1,MIY1,MIX2,MIY2)) then
begin
//Click the item
for i := 0 to 3 do
begin
Mouse(x,y,MRAND,MRAND,true);
wait(100+random(200));
if (IsItemSelected(x,y)) then
break;
end;
//Click the oven
//if (FindObjWithDTM(x,y,OvenDTM,'urna')) then
if (FindOven(x,y)) then
begin
GetMousePos(x,y);
Mouse(x,y,0,0,true);
waitfunc(@CraftScreen,100,3000);
wait(1000+random(500));
end else
begin
writeln('Failed to find oven');
FreeDTM(GoldOreDTM);
FreeDTM(GoldBarDTM);
FreeDTM(OvenDTM);
exit;
end;
//Click the necklace
//NecklaceDTM := DTMFromString(GetItemDTM(Players[CurrentPlayer].Strings[0]));
if (ClickItem) then
begin
writeln('Trying to click necklace');
//Mouse(x,y,MRAND,MRAND,false);
wait(random(300));
ChooseOption('All');
Repeat
count1 := CountItems('dtm',GoldBarDTM,[]);
if DealWithLevelUp then
Inc(Players[CurrentPlayer].Integers[2]);
wait(2500+random(600));
count2 := CountItems('dtm',GoldBarDTM,[]);
until (count1 = count2) or (count2 = 0)
end else
writeln('failed to find necklace symbol');
//FreeDTM(NecklaceDTM);
end;
NecklaceDTM := DTMFromString(GetItemDTM(Players[CurrentPlayer].Strings[0]));
Result := (CountItems('dtm',NecklaceDTM,[]) >0);
FreeDTM(NecklaceDTM);
FreeDTM(GoldOreDTM);
FreeDTM(GoldBarDTM);
FreeDTM(OvenDTM);
end;
function DepositItems: Boolean;
begin
writeln('Trying to deposit all items');
//if (OpenBankNPC) then
if (OpenAKBank) then
begin
wait(500);
WaitFunc(@BankScreen,100,3000);
DepositAll;
end else
writeln('Failed to open bank');
Result := WaitFunc(@InvEmpty,100,3000);
end;
var
Action: integer;
WhereAmI: TPoint;
BreakTimer, FirstBreakTime: Integer;
begin
//These actions must be done first
Smart_Server := 5;
Smart_Members := False;
Smart_Signed := True;
//Smart_SuperDetail = False;
ClearDebug;
SetupSRL;
SMART_SetupDebug;
SPS_Setup(RUNESCAPE_SURFACE,['12_9']);
DeclarePlayers;
while (PlayersActive > 0) do
begin
if not(Players[CurrentPlayer].Active) then
begin
Inc(CurrentPlayer);
Continue;
end;
if not(LoggedIn) then
LogInPlayer;
//set up break things
MarkTime(BreakTimer);
FirstBreakTime := (HOWOFTEN + random(HOWOFTENRANDOM))*60*1000;
Players[CurrentPlayer].Integers[2] := GetSkillLevel(SKILL_CRAFTING);
Action := 0;
while (LoggedIn) do
begin
RunEnergy(70);
SetAngle(true);
//MakeCompass('rand');
case Action of
0: begin
if (DepositItems) then
Inc(Action)
else
break;
end;
1: begin
if (WithdrawItems) then
Inc(Action)
else
break;
end;
2: begin
if (Walk(false)) then
Inc(Action)
else
break;
end;
3: begin
if (Make) then
begin
Inc(Action);
Inc(Players[CurrentPlayer].Banked);
end else
break;
end;
4: begin
if (Walk(true)) then
Action := 0
else
break;
end;
end;
ProgressReport(Action);
AntiRandoms;
AntiBan;
HandleBreaks(BreakTimer,FirstBreakTime);
//Check for Completetion
if ((Players[CurrentPlayer].Banked = Players[CurrentPlayer].Integers[0]) and not(Players[CurrentPlayer].Booleans[0])) then
begin
Players[CurrentPlayer].Active := false;
break;
end;
if ((Players[CurrentPlayer].Integers[2] >= Players[CurrentPlayer].Integers[3]) and (Players[CurrentPlayer].Booleans[0])) then
begin
Players[CurrentPlayer].Active := false;
break;
end;
end;
Logout;
Logout;
Players[CurrentPlayer].Active := false;
Inc(CurrentPlayer);
end; //*)
end.
Code is also attached as a file.