levunit
2015-01-01 06:18:31
How Long have You Played Runescape?
10 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
Java, C++, MIPS, HTML, JS
Are you a member of any other communities?
Zybez, and loads of other botting sites I haven't been to in a long time.
Tell us about yourself…
Please show us one (or multiple) of your scripts.
10 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
Java, C++, MIPS, HTML, JS
Are you a member of any other communities?
Zybez, and loads of other botting sites I haven't been to in a long time.
Tell us about yourself…
From: levunit
I've been around the forum for a while, I know I don't post much, but I usually do a lot of reading ^^. I'm currently a Computer Science major that enjoys playing and making scripts to use with Simba with RuneScape. I have also been attempting to make my own updater for OSRS hooks, and it's going decently. Whenever I'm not programming, I'm usually at school, or at the gym. I spend a lot of time trying to learn new things, but always end up half-completing them. That's my life in a few sentences, lol.
Please show us one (or multiple) of your scripts.
[SIMBA]program FaladorDruidKiller;
{$DEFINE SMART8}
{$I SRL-OSR/SRL.Simba}
{$I SRL-OSR/SRL/Reflection/Reflection.simba}
Const
Your_Login = ''; {Username}
Your_Pass = ''; {Password}
Your_Pin = '0000'; {Just leave alone if you have no pin number}
checkforPlayers = True; {Want to be alerted via popup in corner when other players near? True/False}
howMany = 1; {How many players minimum before alerting?}
TeleTabs = False; {False if using runes to teleport, True if using tele tabs.}
{----READ INSTRUCTIONS BELOW----}
{How to run this script}
{1. Fill in the information above}
{2. Make sure your character is either at the bank or the druids.}
{3. Have runes for teleporting in the last 3 inventory slots. Teletabs in the last slot if using.}
{4. Hit run!}
{Other notes}
{The script picks up all herbs, you'd have to comment out the IDs you don't want.}
{It does not change attack styles, so have the style you want already on.}
{It also does not have food support. Sorry pures.}
{-----------------------------------------------------------------------------------------}
{-------------------------------------Dont touch------------------------------------------}
{---------------------------------------Below---------------------------------------------}
{---Script Constants, don't touch---}
DO_BANKING = 1;
TELEPORT = 2;
KILL = 3;
WALKING_LOOP = 4;
{-----------------------------------}
var
TabID: integer;
LootIDs: TIntegerArray;
AfterClimbed: TPoint;
DruidArea, BankArea, WallArea, TrapdoorArea, DownTrapArea, TeleArea: TPointArray;
ToWallPath, ToTrapdoorPath, ToDruidsPath, ToBankPath: TPointArray;
procedure setVars;
begin
TabID := 8009;
LootIDs := [203, 205, 207, 209, 211, 213, 215, 217, 199, 201, 2485, 3049, 3051];
AfterClimbed := Point(2934, 3355);
DruidArea := [Point(2927, 9841), Point(2926, 9856), Point(2940, 9855), Point(2940, 9841)];
BankArea := [Point(2941, 3372), Point(2942, 3366), Point(2950, 3366), Point(2950, 3372)];
WallArea := [Point(2935, 3359), Point(2935, 3353), Point(2941, 3353), Point(2941, 3359)];
TrapdoorArea := [Point(2880, 3399), Point(2880, 3392), Point(2888, 3392), Point(2888, 3399)];
DownTrapArea := [Point(2882, 9799), Point(2882, 9795), Point(2886, 9795), Point(2886, 9799)];
TeleArea := [Point(2961, 3372), Point(2969, 3372), Point(2969, 3382), Point(2962, 3382)];
ToWallPath := [Point(2940, 3363), Point(2938, 3354)];
ToTrapdoorPath := [Point(2923, 3362), Point(2915, 3372), Point(2904, 3379), Point(2893, 3386), Point(2886, 3395)];
ToDruidsPath := [Point(2884, 9810), Point(2885, 9826), Point(2884, 9840), Point(2897, 9848), Point(2911, 9849), Point(2924, 9845), Point(2928, 9843), Point(2933, 9847)];
ToBankPath := [Point(2952, 3376), Point(2945, 3369)];
end;
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := Your_Login;
Pass := Your_Pass;
Pin := Your_Pin;
Active := True;
end;
end;
procedure Termina(reason: String);
begin
writeln('Terminated script: ' + reason);
Logout;
TerminateScript;
end;
procedure doObjectOffset(xTile, yTile, xOffset, yOffset, objID: integer; uptext, option: String);
var
tp, tpp: tpoint;
chest : TRSObject;
begin
tp.x := xTile;
tp.y := yTile;
chest := R_GetObjectAt(OBJ_GAME, tp);
if (chest.id = objID) then
begin
if R_DistanceFromTile(chest.Tile) >= 4 then
begin
R_WalkToTileMM(chest.Tile);
while R_IsWalking do wait(10);
end;
tpp := R_tiletoms(chest.tile);
if not (PointInBox(tpp, IntToBox(MSX1, MSY1, MSX2, MSY2))) then
begin //not sure if this really works either
R_RotateCameraToTile(chest.Tile); //ive never seen the camera turn to tile
tpp := R_tiletoms(chest.tile); //if the tile was a tile offscreen
end; //thats why i need lilcheck
Mmouse(Tpp.x + xOffset, Tpp.y + yOffset, 5, 5);
if R_WaitUptext(uptext, 200) then
begin
if R_IsUpText(option) then
ClickMouse2(Mouse_left)
else
begin
ClickMouse2(Mouse_right)
wait(200 + random(100));
R_ChooseOption(option);
end;
end;
while (R_IsWalking or R_isAnimating) do wait(10);
wait(200 + random(50));
end;
end;
procedure doObject(xTile, yTile, objID: integer; uptext, option: String);
begin
doObjectOffset(xTile, yTile, 0, 0, objID, uptext, option);
end;
function clickNPC(Name, Option: String): boolean;
var
mnpc: TNPC;
Tp : Tpoint;
begin
if R_FindNpc(Name, mnpc) then
begin
if ((not (mnpc.Animation = -1)) or (mnpc.incombat)) then
exit;
if (r_distancefromtile(mnpc.tile) >= 6) then
begin
R_WalkToTileMM(mnpc.Tile);
while R_IsWalking do wait(10);
end;
Tp := R_TileToMS(mnpc.Tile);
Mmouse(Tp.x, Tp.y, 5, 5);
if R_isUptext(Option) then
ClickMouse2(Mouse_Left)
else
begin
ClickMouse2(Mouse_right);
if not r_chooseoption(Option) then
exit;
end;
result := DidRedClick;
wait(800 + random(150));
while R_IsWalking do
wait(100 + random(250));
end;
end;
procedure fastDeposit(fromD, toD: integer);
var
I, pX, pY: integer;
IB: TBox;
begin
for I := fromD to toD do
begin
IB := InvBox(I);
GaussBox(pX, pY, IB.X1, IB.Y1, IB.X2, IB.Y2);
MMouse(pX, pY, 5, 5);
sleep(50 + random(25));
if (R_iSuptext('Deposit')) then
clickmouse2(mouse_Left);
wait(150 + random(50));
end;
end;
procedure lilcheck; //just a check in the bank if r_walktotilemm has too much
var //deviation from the tile i originally want
myt: TPoint; //because fally bank is so small
begin
while r_iswalking do wait(10);
myt := r_getTileGlobal;
if (myt.y > 3369) then
r_walktotilems(Point(2945, 3369));
end;
procedure doBanking;
begin
doObject(2945, 3367, 24101, 'Bank Bank booth', 'Bank Bank booth');
//begin
if (PinScreen) then InPin(Players[0].Pin);
if (not TeleTabs) then
fastDeposit(1, 25)
else
fastDeposit(1, 27)
//end;
end;
procedure teleportCast;
var
x, y, teleDTM: integer;
begin
if (not TeleTabs) then
begin
teleDTM := DTMFromString('m1gAAAHic42JgYChgY2CoBuJSIM4G4iwgzgfiCiCuYYPIFwOxOBMDgwgQ8wOxEBBLAbECEMsBsSRUXAaIGRgYCeKqqp8MxABJokyDYAQAAOQIB9c=');
gametab(tab_Magic);
if FindDTM(teleDTM, x, y, 554, 291, 582, 317) and (GetCurrentTab = tab_Magic) then
begin
Mouse(x, y, 3, 3, mouse_left);
wait(2500 + random(250));
FreeDTM(teleDTM);
end else
Termina('Teleport DTM not found. Maybe out of runes?');
end else
begin
gametab(tab_Inv);
if (R_InventoryContainsCount([TabID]) > 0) then
begin
R_ClickItemBy(TabID, 'Break');
wait(1500 + random(250));
end else
Termina('No tabs left.');
end;
end;
function getWalkingState: integer;
begin //in bank
if r_inpolygon(BankArea) then
begin
Result := 1;
exit;
end; //near small wall
if r_inpolygon(WallArea) then
begin
Result := 2;
exit;
end; //successfully climbed wall, walk to trapdoor
if R_OnTile(AfterClimbed) then
begin
Result := 3;
exit;
end; //climb down trap door
if r_inpolygon(TrapdoorArea) or (r_distancefromtile(Point(2884, 3396)) < 10) then
begin
Result := 4;
exit;
end; //check if down trapdoor, walk to druids
if r_inpolygon(DownTrapArea) then
begin
Result := 5;
exit;
end; //just teleported, walk to bank
if r_inpolygon(TeleArea) then
begin
Result := 6;
exit;
end;
Result := 7; //otherwise we must be losted somewhere in between
end;
procedure walking(State: integer);
begin
case(State) of
1: R_walkPath(ToWallPath);
2: doObjectOffset(2935, 3355, 20, 0, 24222, 'Climb-over', 'Climb-over');
3: R_walkPath(ToTrapdoorPath);
4: begin doObject(2884, 3397, 16680, 'Climb-down', 'Climb-down'); wait(1500 + random(500)); end;
5: R_walkPath(ToDruidsPath);
6: begin
R_walkPath(ToBankPath);
lilcheck;
end;
7: Termina('Lost while walking.');
end;
while r_iswalking do wait(10);
end;
procedure checkplayers(howMany: integer);
begin
if (countDots('white') >= howMany) and (checkforPlayers) then
begin
writeln('Players found!');
showballoonhint('Player found!', 'Player FOUND!', 3000, bfInfo);
//this just alerts me, so I can hop worlds manually as I'm normally at the computer when I bot
end;
end;
procedure checkrun;
begin
if (R_GetRunEnergy > randomrange(30, 55)) and (not R_IsRunOn) then
begin
mousebox(567, 131, 589, 146, mouse_left);
end;
end;
procedure pickup(IDs: TIntegerArray);
var
items: TGroundItemArray;
Tp : Tpoint;
i: integer;
begin
if r_invfull then exit;
items := R_GetGroundItemsDistance(9);
for i := 0 to High(items) do
begin
if (inlocalarray(IDs, items[i].ID)) then
begin
Tp := R_TileToMS(items[i].Tile);
Mmouse(Tp.x, Tp.y , 4, 4);
if R_WaitUptext('Take', 400) then
begin
ClickMouse2(Mouse_right);
r_chooseoption('erb'); //it only picks up herbs
while R_iswalking do wait(random(250));
end;
end;
end;
end;
procedure getID;
var
mnpc: TNPC;
tim: integer;
begin
mnpc := R_InteractingNpc;
marktime(tim);
if (mnpc.HitPoints > 0) then
repeat
wait(random(100));
until(mnpc.HitPoints = 0) or (TimeFromMark(tim) > 45000);
end;
procedure KILLthem;
begin
checkplayers(howMany);
if (not R_IsValidTNPC(R_InteractingNpc)) then
begin
if clickNPC('Chaos druid', 'Attack') then
getId;
end;
checkrun;
pickup(LootIDs);
end;
function getState: integer;
begin
if r_inpolygon(BankArea) or (r_distancefromtile(Point(2945, 3370)) < 10) then
begin
if (R_InvFull) then
Result := DO_BANKING
else
Result := WALKING_LOOP;
Exit;
end;
if (r_inpolygon(DruidArea) or (r_distancefromtile(Point(2934, 9847)) < 15)) then
begin
if (R_InvFull) then
Result := TELEPORT
else
Result := KILL;
Exit;
end;
RESULT := WALKING_LOOP;
end;
procedure loop;
begin
case(getState) of
DO_BANKING: doBanking;
TELEPORT: teleportCast;
KILL: KILLthem;
WALKING_LOOP: walking(getWalkingState);
end;
end;
begin
setupsrl;
SetupReflection;
mousespeed := 14;
setVars;
DeclarePlayers;
LoginPlayer;
SetAngle(0);
checkrun;
repeat
loop;
until(false);
end.program SummerGarden;
{$DEFINE SMART8}
{$I SRL-OSR/SRL.Simba}
{$I SRL-OSR/SRL/Reflection/Reflection.simba}
//Need to have added the NPC orientation hook and multiplier to the list of hooks
//As well as added orientation the the NPC include
Const
LEFT = 90;
RIGHT = 270;
UP = 180;
DOWN = 0;
procedure doObjectOffset(xTile, yTile, xOffset, yOffset, objID: integer; uptext, option: String);
var
tp, tpp: tpoint;
chest : TRSObject;
begin
tp.x := xTile;
tp.y := yTile;
chest := R_GetObjectAt(OBJ_GAME, tp);
if (chest.id = objID) then
begin
if R_DistanceFromTile(chest.Tile) >= 4 then
begin
R_WalkToTileMM(chest.Tile);
while R_IsWalking do wait(10);
end;
tpp := R_tiletoms(chest.tile);
if not (PointInBox(tpp, IntToBox(MSX1, MSY1, MSX2, MSY2))) then
begin
R_RotateCameraToTile(chest.Tile);
tpp := R_tiletoms(chest.tile);
end;
Mmouse(Tpp.x + xOffset, Tpp.y + yOffset, 5, 5);
if R_WaitUptext(uptext, 200) then
begin
if R_IsUpText(option) then
ClickMouse2(Mouse_left)
else
begin
ClickMouse2(Mouse_right)
wait(200 + random(100));
R_ChooseOption(option);
end;
end;
while (R_IsWalking or R_isAnimating) do wait(10);
wait(200 + random(50));
end;
end;
function clickNPC(Name, Option: String): boolean;
var
mnpc: TNPC;
Tp : Tpoint;
begin
if R_FindNpc(Name, mnpc) then
begin
if (not (mnpc.Animation = -1)) then
exit;
if (r_distancefromtile(mnpc.tile) >= 6) then
begin
R_WalkToTileMM(mnpc.Tile);
while R_IsWalking do wait(10);
end;
Tp := R_TileToMS(mnpc.Tile);
Mmouse(Tp.x, Tp.y, 5, 5);
if R_isUptext(Option) then
ClickMouse2(Mouse_Left)
else
begin
ClickMouse2(Mouse_right);
if not r_chooseoption(Option) then
exit;
end;
result := DidRedClick;
wait(800 + random(150));
while R_IsWalking do
wait(100 + random(250));
end;
end;
function getNPCsOnLineWithBounds(LinePoint, XorY, b1, b2: integer): TNPCArray;
var
npcs, temp: TNPCArray;
h, i, npcPoint, npcPoint2: integer;
begin
npcs := r_getNPCs('Summer Elemental');
h := High(npcs);
Setlength(Result, h + 1);
Setlength(temp, h + 1);
if (h <= 0) then
exit;
for i := 0 to h do
begin
case(XorY) of
1: begin npcPoint := npcs[i].Tile.x; npcPoint2 := npcs[i].Tile.y; end;
2: begin npcPoint2 := npcs[i].Tile.x; npcPoint := npcs[i].Tile.y; end;
end;
if ((npcPoint = LinePoint) and ((npcPoint2 <= b1) and (npcPoint2 >= b2))) then
begin
temp[i] := npcs[i];
//writeln('added an elemental');
end;
end;
Result := temp;
end;
function isPassable2(thenpc: TNPCArray; orient, PassPoint, PassPoint2: integer; xOry: boolean): boolean;
var
i, h: integer;
begin
h := High(thenpc);
for i := 0 to h do
begin
if (thenpc[i].Name = 'Summer Elemental') then
begin
if (xOry) then
begin
case(orient) of
LEFT: Result := ((thenpc[i].Orientation = orient) and ((thenpc[i].tile.x <= PassPoint) and (thenpc[i].tile.x >= PassPoint2)));
RIGHT: Result := ((thenpc[i].Orientation = orient) and ((thenpc[i].tile.x >= PassPoint) and (thenpc[i].tile.x <= PassPoint2)));
end;
end else
begin
case(orient) of
UP: Result := ((thenpc[i].Orientation = orient) and ((thenpc[i].tile.y >= PassPoint) and (thenpc[i].tile.y <= PassPoint2)));
DOWN: Result := ((thenpc[i].Orientation = orient) and ((thenpc[i].tile.y <= PassPoint) and (thenpc[i].tile.y >= PassPoint2)));
end;
end;
exit;
end;
end;
end;
function pass(SafeTile: TPoint): boolean;
begin
R_WalkToTileMS(SafeTile);
while R_IsWalking do wait(1);
Result := R_OnTile(SafeTile);
end;
procedure openGate;
var
TPA: TPointArray;
chestATPA: T2DPointArray;
I: integer;
TP: Tpoint;
begin
FindColorsTolerance(TPA, 4550804, MSX1, MSY1, MSX2, MSY2, 10);
chestATPA := TPAtoATPAEx(TPA, 10, 10);
SortATPAFrom(chestATPA, Point(MSCX, MSCY));
for I := 0 to high(chestATPA) do
begin
TP := MiddleTPA(chestATPA[I]);
MMouse(TP.x, TP.y, 5, 5);
wait(200 + random(150));
if R_SelectOption('Open') then
exit;
end;
end;
procedure squeezeEm;
begin //squirk id
if (R_InventoryContainsCount([10846]) = 2) then
begin
R_ClickItemBy(234, 'Use Pestle');
wait(400 + random(100));
R_ClickItemBy(10846, '-> Summer');
wait(400 + random(100));
end;
end;
procedure checkrun;
begin
if (R_GetRunEnergy < 10) then
begin
writeln('waiting for run now'); //wait for run because cant make stamina potions
repeat
wait(1000 + random(150));
until(r_getrunenergy >= 50);
writeln('got enough run');
if (not R_IsRunOn) then
mousebox(567, 131, 589, 146, mouse_left);
end;
end;
function getStep: integer;
begin
if (R_OnTile(Point(2910, 5481))) then
begin
Result := 1;
exit;
end;
if (R_OnTile(Point(2908, 5482))) then
begin
Result := 2;
exit;
end;
if (R_OnTile(Point(2906, 5486))) then
begin
Result := 3;
exit;
end;
if (R_OnTile(Point(2906, 5492))) then
begin
Result := 4;
exit;
end;
if (R_OnTile(Point(2909, 5490))) then
begin
Result := 5;
exit;
end;
if (R_OnTile(Point(2911, 5485))) then
begin
Result := 6;
exit;
end;
if (R_OnTile(Point(2913, 5482))) then
begin
Result := 7;
exit;
end;
if (R_OnTile(Point(2919, 5484))) then
begin
Result := 8;
exit;
end;
if (R_OnTile(Point(2924, 5487))) then
begin
Result := 9;
exit;
end;
if (R_OnTile(Point(2918, 5491))) then
begin
Result := 10;
exit;
end;
if (R_OnTile(Point(2911, 5470)) or r_OnTile(Point(2910, 5478)) or r_OnTile(Point(2912, 5474))) then
begin
if (r_invfull) then
Result := 12
else if (R_InventoryContainsCount([10850]) = 25) then
Result := 15
else
Result := 11;
exit;
end;
if (R_OnTile(Point(2906, 5490))) then
begin
Result := 13;
exit;
end;
if (R_OnTile(Point(2909, 5487))) then
begin
Result := 14;
exit;
end;
if (R_OnTile(Point(3321, 3141)) and (R_InventoryContainsCount([10850]) = 25)) then
begin
Result := 16;
exit;
end;
end;
procedure step(which: integer);
var
npcs, npcs2, npcs3: TNPCArray;
door: TRSObject;
path: TPointArray;
begin
checkrun;
case(which) of
1: pass(point(2908, 5482));
2: begin
npcs := getNPCsOnLineWithBounds(2907, 1, 5488, 5483);
if (isPassable2(npcs, UP, 5483, 5483, false)) then
pass(Point(2906, 5486));
end;
3: begin
npcs := getNPCsOnLineWithBounds(2907, 1, 5488, 5483);
if (isPassable2(npcs, DOWN, 5485, 5485, false)) then
begin
pass(Point(2906, 5490));
pass(Point(2906, 5492));
end;
end;
4: begin
npcs := getNPCsOnLineWithBounds(2907, 1, 5495, 5490);
if (isPassable2(npcs, DOWN, 5492, 5492, false)) then
pass(Point(2909, 5490));
end;
5: begin
npcs := getNPCsOnLineWithBounds(2910, 1, 5493, 5487);
if (isPassable2(npcs, UP, 5490, 5490, false)) then
begin
pass(Point(2909, 5487));
pass(Point(2911, 5485));
end;
end;
6: begin
npcs := getNPCsOnLineWithBounds(5485, 2, 2915, 2912);
npcs2 := getNPCsOnLineWithBounds(5483, 2, 2918, 2915);
if (isPassable2(npcs, RIGHT, 2912, 2915, true)
or isPassable2(npcs2, RIGHT, 2915, 2918, true)) then
pass(Point(2913, 5482));
end;
7: begin
npcs := getNPCsOnLineWithBounds(2912, 1, 5485, 5483);
npcs2 := getNPCsOnLineWithBounds(5483, 2, 2918, 2915);
if (isPassable2(npcs, UP, 5483, 5485, false)
or isPassable2(npcs2, RIGHT, 2915, 2918, true)) then
pass(Point(2919, 5484));
end;
8: begin
npcs := getNPCsOnLineWithBounds(5486, 2, 2923, 2921);
if (isPassable2(npcs, RIGHT, 2922, 2922, true)) then
pass(Point(2924, 5487));
end;
9: begin
npcs := getNPCsOnLineWithBounds(2923, 1, 5490, 5486);
npcs2 := getNPCsOnLineWithBounds(2923, 1, 5495, 5491);
npcs3 := getNPCsOnLineWithBounds(5491, 2, 2923, 2921);
if (isPassable2(npcs, DOWN, 5487, 5487, false)
and (isPassable2(npcs2, UP, 5491, 5494, false) or isPassable2(npcs3, RIGHT, 2922, 2923, true))) then
pass(Point(2918, 5491));
end;
10: doObjectOffset(2915, 5492, 10, 10, 12943, 'Pick-Fruit', 'Pick-Fruit');
11: begin
r_walktotileMM(Point(2913, 5483));
while (R_IsWalking or R_isAnimating) do wait(10);
if not (r_ontile(Point(2910, 5480))) then
pass(Point(2910, 5480));
openGate;
while (R_IsWalking or R_isAnimating) do wait(10);
wait(2000 + random(200));
end;
12: squeezeEm;
13: pass(Point(2906, 5492));
14: pass(Point(2911, 5485));
15: doObjectOffset(2911, 5472, 0, 0, 12941, 'Drink-from', 'Drink-from');
16: begin
//this is really ugly but surprisingly works decent
//failsafes to be added when this starts working as good as it should lol
door := R_GetObjectAt(OBJ_BOUNDARY, Point(3321, 3142));
Path := [Point(3321, 3142), Point(3307, 3139), Point(3306, 3125), Point(3308, 3120)];
if (door.ID = 7122) then
begin
R_InteractTile(Point(3321, 3142), 'Open');
wait(200 + random(50));
end;
R_walkPath(Path);
while (R_IsWalking or R_isAnimating) do wait(10);
//if at bank
doObjectOffset(3309, 3120, 0, 0, 2693, 'Use Bank', 'Use Bank');
wait(2000 + random(500));
//if bank open
R_ClickItemBy(10850, 'All');
R_WalkPathMMEx(Path, True);
while (R_IsWalking or R_isAnimating) do wait(10);
if (r_distancefromtile(Point(3321, 3142)) >= 5) then
r_walktotileMM(Point(3321, 3142));
if not (r_ontile(Point(3321, 3142))) then
pass(Point(3321, 3142));
door := R_GetObjectAt(OBJ_BOUNDARY, Point(3321, 3142));
//look for open door id first
if (door.ID = 7122) then
begin
R_InteractTile(Point(3321, 3142), 'Open');
wait(200 + random(50));
end;
pass(Point(3320, 3139));
//if in house area
repeat
R_InteractTile(Point(3319, 3137), 'Search');
wait(3300 + random(500));
until((R_InventoryContainsCount([1920]) = 25));
wait(200 + random(50));
clickNPC('Apprentice', 'Teleport');
wait(3000 + random(500));
if (not R_IsRunOn) then
mousebox(567, 131, 589, 146, mouse_left);
end;
end;
end;
begin
setupsrl;
SetupReflection;
mousespeed := 14;
repeat
step(getStep);
until(false);
end.program YanilleIronMiner;
{$DEFINE SMART}
{$DEFINE SEWalker}
{$i AeroLib/AeroLib.Simba}
//I just started making this yesterday, as I looked at other available examples of
//AeroLib in action, so forgive me if any code looks similar to currently released scripts.
//I know it's not fully complete, but I wanted to show that I can use color too.
Const
Iron_Color = 988974;
Iron_Tol = 4;
Iron_Hue = 0.05;
Iron_Sat = 0.83;
type State = (MINESTUFF, WALK_TO_MINE, WALK_TO_BANK, OPENBANK, BANKING, LOST);
var
x, y, oreDTM: integer;
BankWalkDTMs, MineWalkDTMs: TIntegerArray;
procedure setUp;
begin
//DTM walking isnt done yet, but should be easy enough as I just need to make the DTMS
setLength(BankWalkDTMs, 4);
setLength(MineWalkDTMs, 3);
BankWalkDTMs[0] := 0;
BankWalkDTMs[1] := 0;
BankWalkDTMs[2] := 0;
BankWalkDTMs[3] := 0;
MineWalkDTMs[0] := 0;
MineWalkDTMs[1] := 0;
MineWalkDTMs[2] := 0;
oreDTM := DTMFromString('mFQEAAHiclc1BCkBgGITh+Q+gbN3CPSxYUGShyMIJKFLKgqLkwrxlZflNPbObxpNUOqlBixoFUiSIECNHhQwdVnYTdpy4ceHAhhk9BoxYEAY+7Uwe2sr28PnlBbKqGMY=');
end;
procedure freeThem();
var
i: integer;
begin
FreeDTM(oreDTM);
for i := 0 to 3 do
begin
FreeDTM(BankWalkDTMs[i]);
end;
for i := 0 to 2 do
begin
FreeDTM(MineWalkDTMs[i]);
end;
end;
function mineRock(): Boolean;
var
p: Tpoint;
obj_iron: TMSObject;
begin
Result := false;
obj_iron.create('IronRock', ['ine I', 'ron'], [createCol(Iron_Color, Iron_Tol, Iron_Hue, Iron_Sat)], [createCol(10000, 10, 0.10, 1.07)]);
if obj_iron.Find(10, Point(MSCX, MSCY), p) then
begin
case random(20) of
0..10 : brakeMMouse(p, 10, 10, True);
11..15: missMouse(p, 10, 10);
16..20: humanMMouse(p, 10, 10);
end;
if waitUpTextMulti(['ine I', 'ron'], randomRange(150,300)) then
begin
fastClick(MOUSE_LEFT);
exit(didRedClick());
end else
begin
fastClick(MOUSE_RIGHT);
if not waitOptionMulti(['ine I', 'ron'], randomRange(150,300)) then
Exit;
Result := chooseOptionMulti(['ine I', 'ron']);
end;
end;
end;
function mineRockTPA(): Boolean;
var
curTol, I: integer;
p: Tpoint;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
curTol := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Iron_Hue, Iron_Sat);
FindColorsTolerance(TPA, Iron_Color, MSX1, MSY1, MSX2, MSY2, Iron_Tol);
ColorToleranceSpeed(curTol);
if (length(TPA) <= 0) then
exit;
ATPA := TPAtoATPAEx(TPA, 20, 20);
SortATPAFrom(ATPA, Point(MSCX, MSCY));
if (length(ATPA) <= 0) then
exit;
for I := 0 to high(ATPA) do
begin
if (length(ATPA[I]) >= 15) then
begin
p := MiddleTPA(ATPA[I]);
if (pointInBox(p, intToBox(MSX1, MSY1, MSX2, MSY2))) then
begin
HumanMMouse(p, random(5), random(5));
if (waitUpText('ine', 120)) then
begin
case random(0, 14) of
0..13: fastClick(MOUSE_LEFT);
14: begin
fastClick(MOUSE_RIGHT);
wait(random(30, 120));
waitOption('Mine', 350);
end;
end;
end else
begin
fastClick(MOUSE_RIGHT);
if (optionExistsMulti(['ine', 'Iron'])) then
waitOption('Mine', 350);
end;
wait(100 + random(50));
Result := didredclick();
exit;
end;
end;
end;
end;
function isMining(): Boolean;
begin
Result := (AveragePixelShift(IntToBox(206, 137, 309, 230), 250, 500) > 300);
end;
procedure doMining();
var
fcount: integer;
begin
fcount := 0;
writeln('1');
if (isMining() or isPlayerWalking()) then exit;
repeat
writeln('2');
//if (isMining() or isPlayerWalking()) then exit;
if (not mineRock()) then
if (not mineRockTPA()) then
begin
writeln('3');
Inc(fcount);
wait(1500 + random(500)); //maybe the rocks are all mined?
end;
wait(1500 + random(250));
until(isMining() or isPlayerWalking() or (fcount > 10));
if (fcount > 10) then
begin
logoutPlayer;
writeln('Logged out while mining.');
TerminateScript;
end;
end;
function atBank(): boolean;
begin
Result := (foundsymbol('bank') or foundsymbol('minigame'));
//or findDTM or bank area
end;
function atMine(): boolean;
begin
Result := (percentColorMM(2046038, 5) > 10); //works pretty good
//or findDTM or mining area
end;
function walkToPoint(Color, Tol: integer; SortPoint: Tpoint): boolean;
var
i, x, y: Integer;
TPA: TPointArray;
begin
Result := False;
FindColorsTolerance(TPA, Color, MMX1, MMY1, MMX2, MMY2, Tol);
if (length(TPA) <= 0) then
exit;
SortTPAFrom(TPA, SortPoint);
for i := 0 to High(TPA) do
begin
x := TPA[i].x;
y := TPA[i].y;
humanMMouse(Point(x, y), 1, 1);
Wait(200 + random(50));
fastClick(MOUSE_LEFT);
Wait(200 + random(50));
FFlag(3);
exit(flagPresent() or isPlayerWalking());
end;
end;
function walkToDTM(which: integer): boolean;
var
x, y, tdtm: integer;
begin
Result := False;
tdtm := which;
if FindDTM(tdtm, x, y, MMX1, MMY1, MMX2, MMY2) then
begin
humanMMouse(Point(x, y), 1, 1);
Wait(200 + random(50));
fastClick(MOUSE_LEFT);
FFlag(0);
Result := True;
end;
end;
procedure walkToBank;
var
i, h: Integer;
Colors, Tols: TIntegerArray;
SortPoints: TPointArray;
begin
Colors := [2046038, 929081, 929081, 5228778];
Tols := [10, 5, 5, 10];
SortPoints := [Point(681, 37), Point(708, 98), Point(696, 89), Point(670, 67)];
h := high(Colors);
for i := 0 to h do
begin
if (not walkToPoint(Colors[i], Tols[i], SortPoints[i])) then
if (not walkToDTM(BankWalkDTMs[i])) then
if (not radialWalk(Colors[i], 20, 110, 65, 1, 1)) then
begin
logoutPlayer;
writeln('Logged out while walking.');
TerminateScript;
end;
end;
end;
procedure walkToMine;
var
i, h: Integer;
Colors, Tols: TIntegerArray;
SortPoints: TPointArray;
begin
Colors := [241, 929081, 929081];
Tols := [5, 5, 5];
SortPoints := [Point(577, 96), Point(588, 40), Point(631, 132)];
h := high(Colors);
for i := 0 to h do
begin
if (not walkToPoint(Colors[i], Tols[i], SortPoints[i])) then
if (not walkToDTM(MineWalkDTMs[i])) then
if (not radialWalk(Colors[i], 180, 350, 65, 1, 1)) then
begin
logoutPlayer;
writeln('Logged out while walking.');
TerminateScript;
end;
end;
end;
procedure openBox;
var
TPA, TPA2: TPointArray;
ATPA, ATPA2: T2DPointArray;
I, J: integer;
TP, tp2: Tpoint;
begin
while isPlayerWalking do wait(1);
FindColorsTolerance(TPA2, 5002071, MSX1, MSY1, MSX2, MSY2, 15); //grey part
FindColorsTolerance(TPA, 208451, MSX1, MSY1, MSX2, MSY2, 5); //brown part
if (length(TPA) <= 0) or (length(TPA2) <= 0) then
exit;
ATPA := TPAtoATPA(TPA, 30);
atpa2 := TPAtoATPAEx(TPA, 30, 30);
SortATPASize(ATPA, True);
SortATPASize(ATPA2, True);
for I := 0 to high(ATPA) do
begin
if length(ATPA[I]) > 150 then
continue;
TP := MiddleTPA(ATPA[I]);
for j := 0 to high(ATPA2) do
begin
if length(ATPA[J]) > 150 then
continue;
TP2 := MiddleTPA(ATPA2[j]);
if (Distance(tp.x, tp.y, tp2.x, tp2.y) < 15) then
begin
HumanMMouse(tp2, random(5), random(5));
wait(100+ random(50));
if (waitUpText('Deposit', 120)) then
begin
case random(10) of
0..6 : missMouse(tp2, 0, 0);
7..10 : humanMMouse(tp2, 0, 0);
end;
fastClick(MOUSE_LEFT);
waitFunc(@isPlayerWalking, 10, 2000);
exit;
end;
end;
end;
end;
end;
procedure depositOres();
begin
while isPlayerWalking do wait(1);
if (isInterfaceOpen()) then
begin
HumanMMouse(Point(147, 91), random(10), random(10));
wait(100+ random(50));
if (waitUpText('Deposit', 120)) then
begin
fastClick(MOUSE_RIGHT);
if (optionExistsMulti(['Deposit', 'Iron'])) then
waitOption('All', 350);
end;
end;
end;
//inspired by Flight's Catherby Cooker, credits to him for this little getState finesse
function getState(): State;
begin
result := LOST;
if not isLoggedIn() then
Exit;
if (isInvFull()) then
begin
if atBank() then
begin
if (not isInterfaceOpen()) then
exit(OPENBANK);
exit(BANKING);
end;
if (atMine()) then
exit(WALK_TO_BANK);
exit(LOST);
end;
if (not isInvFull()) then
begin
if (atMine()) then
exit(MINESTUFF);
if (atBank()) then
exit(WALK_TO_MINE);
exit(LOST);
end;
end;
procedure loop();
var
curState : State;
begin
if not isLoggedIn() then
Exit;
curState := getState();
case curState of
MINESTUFF : doMining();
WALK_TO_MINE : walktoMine();
WALK_TO_BANK : walkToBank();
OPENBANK : openBox();
BANKING : depositOres();
LOST:
begin
logoutPlayer;
writeln('Logged out while walking.');
TerminateScript;
end;
end;
end;
begin
initAL();
mouseSpeed := 20;
setUp();
repeat
loop();
until(false);
FreeThem();
end.