SRL Archive - Archive

Spartan 117 - SRL Member Application


Spartan 117

2014-01-21 01:21:56

How Long have You Played Runescape?
8 Year(s)


Are you affilated in anyway with Jagex LTD?
No

Were you Referred to SRL?



What is your general programming knowledge?
I know pascal, C, Java, and some Objective-C


Are you a member of any other communities?
I am a member at powerbot, and tribot, however I am not active in either due to high ban rates


Tell us about yourself…
From: Spartan 117
I came to SRL when the bot nuke happened (yeah, I was one of those guys). And at first I was only a leecher. But after some time of reading through comments and using scripts I began to feel the sense of community and decided I wanted to belong here. I attempted scripting, sucked at it, and gave up. I quit runescape for a long time. However, my interest in programming increased. I began developing apps for the iPhone (that I never published). And became the teacher of our school computer science team for competitions (None of our teachers knew how to program). Now I am at Texas Tech and am majoring in computer engineering. My hobbies are sports, video games and programming. I have had the same girlfriend for 5 years now (had to keep the one that didn't mind me being a nerd). SRL really sparked my interest in what I am planning on doing for the rest of my life.



Please show us one (or multiple) of your scripts.
program WaterfiendKiller;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I SPS/lib/SPS-RS3.Simba}
//Type taken from Sg5
type TLoot = record
name: TStringArray;
color, tol: Integer;
sat, hue: extended;
end;

//Used to detect items on the ground
//Taken from Sg5
function SetupLoot : array of TLoot;
begin
Setlength(result, 4);
//Green Charm
Result[0].name := ['reen', 'en ch'];
Result[0].color := 10209713;
Result[0].tol := 10;
//Mithril Arrow
Result[1].name := ['ithr', 'il ar'];
Result[1].color := 1595007;
Result[1].tol := 10;
//Crimson Charm
Result[2].name := ['rim', 'on ch'];
Result[2].color := 3760527;
Result[2].tol := 5;
//Water Rune
Result[3].name := ['ater', 'er ru'];
Result[3].color := 12699859;
Result[3].tol := 15;
end;

const
// COLORS THAT MAY NEED FIXING
FIEND_COLOR = 7756849;


var
closeDTM, combatDTM, monkDTM, pot1DTM, pot2DTM, pot3DTM, pot4DTM, prayDTM, pray2DTM: Integer;
eatPercent, drinkPercent, cycles, fails: Integer;
basic, threshold, ultimate: array of Integer;
useUltimate, usePrayerPot, usePrayer, loot, onLoot: boolean;
pathtobank, leave, pathtotele, pathFromNorth, pathFromMessUp, pathFromEast: TPointArray;
p2: tpoint;

procedure declarePlayers;
begin
{*************************************************************************************}
{********************* FILL OUT THESE OPTIONS ***********************************}
eatPercent := 70; //at what health percent do you want to eat at?
drinkPercent := 40; //what prayer percent do you want to drink a pot at?
basic := [1,2,3,4,5]; //Which actionbar slots do you have a basic ability in?
threshold := [6,7]; //Which actionbar slots do you have a threshold ability in?
ultimate := [8]; //Which actionbar slots do you have an ultimate ability in?
useUltimate := false; //Do you want to use your ultimate abiliies?
usePrayer := true; //Do you want to Pray? **ONLY SUPPORTS PROTECT FROM MISSLE**
usePrayerPot := true; //Do you want to drink prayer pots?
loot := true; //Do you want to loots? **SIGNIFICANTLY DECREASES XP/HR
{********************* END OF OPTIONS ***********************************}
{********************* FILL IN USE DATA ***********************************}
setLength(players, 1);
with players[0] do
begin
loginName := ''; //User name here
password := ''; //Password here
isActive := true;
isMember := true;
world := 84;
end;
currentPlayer := 0;
end;


procedure loadDTMs;
begin
combatDTM := DTMFromString('mbQAAAHicY2VgYFBkZWBQB2I5IJYEYiUgPgoUPwDEJ4H4MBCfBeLuiniGQg8VhuYAC4YwezWGUAcNBi6gODpmxILBAACLhwmX');
monkDTM := DTMFromString('mggAAAHicY2NgYNjHxsBwEogPAPFmIN4PxLuAWIWJgUEViPWhtDyU7etqDdTFhIG5gCQ2zIgDQwAAu/cGrg==');
pot1DTM := DTMFromString('mbQAAAHicY2VgYDjAxsCwC4iPAPEJIN4OxLOZGBgmAfEEIJ4LxNOBuGD1LKBqJhTMBSTRMSMWDAYA1E8I0A==');
pot2DTM := DTMFromString('mbQAAAHicY2VgYHBmY2BwB2JbILYCYg8g3sfEwLANiLcA8W4gPgTEJusbgaqZUDAXkETHjFgwGAAAB/AGvw==');
pot3DTM := DTMFromString('mbQAAAHicY2VgYHjNxsDwFIjfAvEHIH4AxDOZGBgmAnEPEM8D4tlAbLqxBaiaCQVzAUl0zIgFgwEAD5MJUw==');
pot4DTM := DTMFromString('mbQAAAHicY2VgYHBiY2BwA2JbILYAYi8gZmMCSkAxJxDzArHZllaEIBRzAUl0zIgFgwEA+V0DPw==');
prayDTM := DTMFromString('mbQAAAHicY2VgYJBlZWDQAGJJIFYFYjEgdmBkYPABYlsgtgRidyBe5K/G8PPHD4bn778wHAvXBGMuoH50zIgFgwEAw+sLkw==');
pray2DTM := DTMFromString('mQwAAAHicY2ZgYNBlYWBQBmJNIL7EyMBwAojPAfHhdhOGTTv2MSwuNmHgAqqDYUYkDAQAPe0IBQ==');
closeDTM := DTMFromString('mggAAAHicY2NgYKhmZWAoAeI6IC5HojcwQPBmIF4DxSD2z53ODMFszAyfZnAx/DufBcYgNlALVsyIA0MAAG7mESc=');

end;

procedure freeTheDTMs;
begin
freeDTM(combatDTM);
freeDTM(monkDTM);
freeDTM(pot1DTM);
freeDTM(pot2DTM);
freeDTM(pot3DTM);
freeDTM(pot4DTM);
freeDTM(prayDTM);
freeDTM(pray2DTM);
freeDTM(closeDTM);
end;


{Finds an objext with color of objColor and mouseText.
Return 0 if it left clicks
Returns 1 if it simply moves to the object
Returns 2 if it fails to find object}
function objectFinder(objColor: Integer; mouseText: array of string; needClosest, leftClick: boolean) : integer;
var
x, y, CTS, i: integer;
TPA: TPointArray;
obj: Array of TPointArray;
begin
if (not isLoggedIn) then Exit;

result := 2;

findColorsTolerance(TPA, objColor, mainscreen.getBounds(), 5);
obj := TPAToATPA(TPA, 50);
if length(obj) > 0 then
begin
if needClosest then
sortATPAfromMidPoint(obj, mainscreen.playerPoint); //finds the closest obj
for i := 0 to high(obj) do
begin
mouse(MiddleTPA(obj[0]).x + randomrange(-1,1), MiddleTPA(obj[i]).y + randomrange(-1,1), MOUSE_MOVE);
if leftClick then
begin
if isMouseOverText(mouseText, randomrange(160,185)) then
begin
fastclick(MOUSE_LEFT);
result := 0;
break;
end;
end else
begin
fastclick(MOUSE_RIGHT);
chooseOption.select(mouseText);
break;
end;
end;
Writeln('ObjectFinder result: ' + toString(result));
end;
end;
//Returns true if not moving
function notMoving : boolean;
begin
if not isLoggedIn then Exit;

result := false;

if not minimap.isPlayerMoving() then
result := true;
end;

//Returns an ATPA of all loot stacks on the ground
//Based looslely off of Sg5's looter
function findLoot(lootitems:Array of TLoot) : Array of TPointArray;
var
i, a, h,r, dist: integer;
TPA: TPointArray;
atpa, loots: Array of TPointArray;
begin
if not isLoggedIn then Exit;

for i := 3 to high(lootitems) do
begin
findColorsTolerance(TPA, lootitems[i].color, mainScreen.getBounds(), lootitems[i].tol);
atpa := TPAtoATPA(TPA, 10);
for a := 0 to high(atpa) do
begin
dist := round(sqrt(((atpa[a][0].x - 286)*(atpa[a][0].x - 286)) + ((atpa[a][0].y - 195)*(atpa[a][0].y - 195))));
writeln(dist);
if dist > 35 then
begin
h := length(loots);
setlength(loots, length(loots) + length(atpa));
loots[h] := atpa[a];
end;
end;
end;
result:= loots;
if length(loots) > 0 then
begin
smartImage.drawCircle(middleTPA(loots[0]), 10, false, 472);
end;
wait(randomrange(500,750));
writeln('There are ' + tostring(length(result)) + ' loot stacks');
end;

//Returns true if lootstacks are found on ground
function lootVisible : boolean;
begin
if not isLoggedIn then Exit;

result := false;

if length(findLoot(setuploot)) > 0 then
result := true;

end;

//Takes loot in a prioritized manner
procedure takeLoot;
var
i: Integer;
atpa: array of TPointArray;
begin
if not isLoggedIn then Exit;

atpa := findloot(setuploot);

for i := 0 to high(atpa) do
begin
smartImage.clear();
Mouse(middleTPA(atpa[0]), MOUSE_MOVE);
wait(randomrange(50, 100));
fastclick(MOUSE_RIGHT);
writeln('grabbing loot');
wait(randomrange(150, 250));
if chooseOption.optionsExist(['Take Crimson']) then
begin
chooseOption.select(['Take Crimson']);
wait(randomrange(1500, 2000));
onLoot := true;
Exit;
end else
if chooseOption.optionsExist(['row']) then
begin
chooseOption.select(['Take Mithril a']);
wait(randomrange(1500, 2000));
onLoot := true;
Exit;
end else
if chooseOption.optionsExist(['reen']) then
begin
chooseOption.select(['Take Green']);
wait(randomrange(1500, 2000));
onLoot := true;
Exit;
end else
if chooseOption.optionsExist(['lue']) then
begin
chooseOption.select(['Take Blu']);
wait(randomrange(1500, 2000));
onLoot := true;
Exit;
end else
if chooseOption.optionsExist(['old']) then
begin
chooseOption.select(['Take Gold']);
wait(randomrange(1500, 2000));
onLoot := true;
Exit;
end else
if chooseOption.optionsExist(['orb']) then
begin
chooseOption.select(['Take Water o']);
wait(randomrange(1500, 2000));
onLoot := true;
Exit;
end else
if chooseOption.optionsExist(['lood']) then
begin
chooseOption.select(['lood', 'une']);
wait(randomrange(1500, 2000));
onLoot := true;
Exit;
end else
if chooseOption.optionsExist(['ithril', 'ore']) then
begin
chooseOption.select(['ithr', 'l or', 'ore']);
wait(randomrange(350, 500));
onLoot := true;
Exit;
end else
if chooseOption.optionsExist(['key']) then
begin
chooseOption.select(['key']);
wait(randomrange(350, 500));
onLoot := true;
Exit;
end else
if chooseOption.optionsExist(['ivy']) then
begin
chooseOption.select(['ivy']);
wait(randomrange(350, 500));
onLoot := true;
Exit;
end else
if chooseOption.optionsExist(['ater ru']) then
begin
chooseOption.select(['Take Water rune']);
wait(randomrange(1500, 2000));
onLoot := true;
Exit;
end else
if chooseOption.optionsExist(['ru', 'rune']) then
begin
chooseOption.select(['ru', 'rune']);
wait(randomrange(350, 500));
onLoot := true;
Exit;
end else
if chooseOption.optionsExist(['ancel']) then
begin
chooseOption.select(['ancel']);
wait(randomrange(350, 500));
Exit;
end else
Exit;

end;
end;

//Returns true in the inv is full
function invFull : boolean;
begin
if not isLoggedIn then Exit;

result := false;

if tabBackpack.isFull then
result := true;
end;

//Takes the rest of the loot in a stack once the player is on a stack
procedure keepTaking;
var
p: TPoint;
allItems: TStringArray;
begin
p.x := 288 + randomrange(-1,1);
p.y := 199 + randomrange(-1,1);
setLength(allItems, 12);
allItems := ['rimson', 'row', 'reen', 'lue', 'old', 'orb', 'lood', 'ater ru', 'ru', 'rune', 'ithril o', 'ore'];
repeat
Mouse(p, MOUSE_MOVE);
wait(randomrange(150, 250));
fastClick(MOUSE_RIGHT);
wait(randomrange(160, 180));
if chooseOption.optionsExist(['rimson']) then
begin
chooseOption.select(['rimson', 'arm']);
wait(randomrange(1500, 2000));
end else
if chooseOption.optionsExist(['row']) then
begin
chooseOption.select(['ithril r', 'row']);
wait(randomrange(350, 500));
end else
if chooseOption.optionsExist(['reen']) then
begin
chooseOption.select(['reen', 'arm']);
wait(randomrange(350, 500));
end else
if chooseOption.optionsExist(['lue']) then
begin
chooseOption.select(['lue', 'arm']);
wait(randomrange(350, 500));
end else
if chooseOption.optionsExist(['old']) then
begin
chooseOption.select(['old', 'arm']);
wait(randomrange(350, 500));
end else
if chooseOption.optionsExist(['orb']) then
begin
chooseOption.select(['orb']);
wait(randomrange(350, 500));
end else
if chooseOption.optionsExist(['lood']) then
begin
chooseOption.select(['lood', 'une']);
wait(randomrange(350, 500));
end else
if chooseOption.optionsExist(['ithril o', 'ore']) then
begin
chooseOption.select(['ithr', 'l or', 'ore']);
wait(randomrange(350, 500));
end else
if chooseOption.optionsExist(['key']) then
begin
chooseOption.select(['key']);
wait(randomrange(350, 500));
end else
if chooseOption.optionsExist(['ivy']) then
begin
chooseOption.select(['ivy']);
wait(randomrange(350, 500));
end else
if chooseOption.optionsExist(['ater ru']) then
begin
chooseOption.select(['r ru', 'rune']);
wait(randomrange(350, 500));
end else
if chooseOption.optionsExist(['ru', 'rune']) then
begin
chooseOption.select(['ru', 'rune']);
wait(randomrange(350, 500));
end else
if not chooseOption.optionsExist(allItems) then
begin
chooseOption.select(['ancel']);
wait(randomrange(350, 500));
Break;
end;

until(false);
onLoot := false;

end;

{Attacks a waterfiend then waits for a random time in the specified time range}
function attackFiend(waitMin, waitMax: Integer) : boolean;
begin
if not isLoggedIn then Exit;

result := false;

if (objectFinder(7756849, ['attack', 'fiend'], true, false) = 1) then
begin
wait(randomrange(waitMin, waitMax));
result := true;
end;
end;

function isInCombat : boolean;
var
x, y: Integer;
begin
if not isLoggedIn then Exit;

result := false;

if findDTM(combatDTM, x, y, mainScreen.getBounds()) then
result := true;

if findDTM(combatDTM, x, y, ActionBar.getBounds()) then
result := true;

if findDTM(combatDTM, x, y, chatBox.getBounds()) then
result := true;

if result = true then
writeln('We are fighting');
if result = false then
writeln('Not currently in combat');
end;

//Returns true if monkFish are in the inventory
function haveFood : boolean;
begin
if not isLoggedIn then Exit;

result := false;

if tabBackPack.countDTM(monkDTM) > 0 then
result := true;
end;

//Returns true if any PPots are found in inventory
function havePots : boolean;
begin
if not isLoggedIn then Exit;

result := false;

if ((tabBackPack.countDTM(pot1DTM) > 0) or
(tabBackPack.countDTM(pot2DTM) > 0) or
(tabBackPack.countDTM(pot3DTM) > 0) or
(tabBackPack.countDTM(pot4DTM) > 0)) then
result := true;

end;

//Returns true if health is below specified eating percent
function lowHealth : boolean;
begin
if not isLoggedIn then Exit;

result := false;

if (actionBar.getHPPercent() < eatPercent) then
result := true;

end;

//Eats a monkfish!
procedure eatFood;
begin
if not isLoggedIn then Exit;

tabBackpack.clickDTM(monkDTM, MOUSE_LEFT, '', randomrange(300, 350), false);
end;

//Drinks a PPot in a priortized manner of emptiest first
procedure drinkPot;
var
x, y: integer;
begin
if not isLoggedIn then Exit;
if findDTM(pot1DTM, x, y, tabBackpack.getBounds()) then
begin
tabBackpack.clickDTM(pot1DTM, MOUSE_LEFT, '', randomrange(300, 350), false);
writeln('Drinking dose of potion');
Exit;
end;
if findDTM(pot2DTM, x, y, tabBackpack.getBounds()) then
begin
tabBackpack.clickDTM(pot2DTM, MOUSE_LEFT, '', randomrange(300, 350), false);
writeln('Drinking dose of potion');
Exit;
end;
if findDTM(pot3DTM, x, y, tabBackpack.getBounds()) then
begin
tabBackpack.clickDTM(pot3DTM, MOUSE_LEFT, '', randomrange(300, 350), false);
writeln('Drinking dose of potion');
Exit;
end;
if findDTM(pot4DTM, x, y, tabBackpack.getBounds()) then
begin
tabBackpack.clickDTM(pot4DTM, MOUSE_LEFT, '', randomrange(300, 350), false);
writeln('Drinking dose of potion');
Exit;
end;
end;

//Checks if a certain slot's ability is ready (easier than typing out every time)
function abilityReady(slot: integer): boolean;
begin
if not isLoggedIn then Exit;

result := false;

if actionBar.getAbilityCooldown(slot) = 1 then
result := true;
end;

//Returns the actionbar slot that is best to use
function chooseAbility : integer;
var
i: Integer;
begin
if not isLoggedIn then Exit;

if ((actionBar.getAdrenalinePercent() < 50) or (not (abilityready(threshold[0]) or abilityready(threshold[1])))) then
begin
for i := 0 to high(basic) do
begin
if abilityready(basic[i]) then
begin
result := basic[i];
wait(randomrange(50, 75));
break;
end;
end;
Exit;
end;
if (actionBar.getAdrenalinePercent() >= 50) then
begin
for i := 0 to high(threshold) do
begin
if abilityready(threshold[i]) then
begin
result := threshold[i];
wait(randomrange(50, 75));
break;
end;
end;
Exit;
end;
if useUltimate then
begin
if (actionBar.getAdrenalinePercent() = 100) then
begin
for i := 0 to high(ultimate) do
begin
if abilityready(ultimate[i]) then
begin
result := ultimate[i];
wait(randomrange(50, 75));
break;
end;
end;
Exit;
end;
end;
end;

//Uses the ability given by chooseAbility
procedure useAbility;
var
slott: Integer;
begin
if not isLoggedIn then Exit;
slott := chooseAbility;
actionbar.clickSlot(slott);
wait(randomrange(200, 250));
writeln('Used ability in slot: ' + toString(slott));
end;

//Uses DTM on mainScreen to see if Protect from Missles is active
function isPraying : boolean;
var
x, y: Integer;
begin
if not isLoggedIn then Exit;

result := false;

if findDTM(prayDTM, x, y, mainScreen.getBounds()) then
result := true;
if findDTM(pray2DTM, x, y, mainScreen.getBounds()) then
result := true;

writeln(result);
end;

//Clicks slot 10 (where protect from Missles is)
procedure clickPrayer;
begin
if not isLoggedIn then Exit;

actionBar.clickSlot(10);
end;

//Returns true if player needs to drink PPot
function lowPrayer : boolean;
begin
if not isLoggedIn then Exit;

result := false;

if (actionBar.getPrayerPercent() < drinkPercent) then
result := true;

end;

//Returns true if the player has the ability to turn on prayer
function havePrayer : boolean;
begin
if not isLoggedIn then Exit;

result := false;

if usePrayerPot and havePots then
result := true;

if (actionbar.getPrayerPercent > 0) then
result := true;
end;

//Finds the bank and clicks on it using custom object finder
procedure clickBank;
begin
if not isLoggedIn then Exit;

objectfinder(10158079, ['ank', 'ooth'], true, true);
wait(randomrange(100, 150));
end;

//Quick way to write deposit all
procedure depositAll;
begin
if not isLoggedIn then Exit;

bankScreen.quickDeposit(QUICK_DEPOSIT_INVENTORY);
end;

//Withdraws items needed
procedure withDrawItems;
begin
bankScreen.withdraw(10, 3, ['rayer', 'potion']);
wait(randomrange(250, 350));
bankScreen.withdraw(9, 10, ['onk', 'fish']);
wait(randomrange(250, 350));
bankScreen.withdraw(9, 10, ['onk', 'fish']);
end;

//walks to a fiary ring
function caveWalkOut : boolean;
var
x, y, i: integer;
TPA: TPointArray;
obj: Array of TPointArray;
p: TPoint;
begin
if (not isLoggedIn) then Exit;

result := False;
p.x := 687;
p.y := 103;

findColorsTolerance(TPA, 1600233, minimap.getBounds(), 5);
obj := TPAToATPA(TPA, 50);
sortATPAfromMidPoint(obj, p);
if length(obj) > 0 then
begin
mouse(MiddleTPA(obj[0]).x + randomrange(-5,5), MiddleTPA(obj[0]).y + randomrange(-5,5), MOUSE_MOVE);
wait(randomrange(160, 180));
fastclick(MOUSE_LEFT);
result :=true;
end;
end;

//walks to obleisk on minimap
function walkToObelisk : boolean;
var
x, y, i: integer;
TPA: TPointArray;
obj: Array of TPointArray;
p: TPoint;
begin
if (not isLoggedIn) then Exit;

result := False;
p.x := 687;
p.y := 103;

findColorsTolerance(TPA, 1068133, minimap.getBounds(), 5);
obj := TPAToATPA(TPA, 50);
sortATPAfromMidPoint(obj, p);
if length(obj) > 0 then
begin
smartImage.drawCircle(MiddleTPA(obj[0]), 8, true, 1777498);
mouse(MiddleTPA(obj[0]).x + randomrange(-1,1), MiddleTPA(obj[0]).y + randomrange(-1,1), MOUSE_MOVE);
wait(randomrange(160, 180));
fastclick(MOUSE_LEFT);
result :=true;
smartImage.clear();
end;
end;

//walks in between bank and obelisk with some randomness
function walkCloseToBank : boolean;
var
TPA: TPointArray;
obj: Array of TPointArray;
p: TPoint;
begin
if (not isLoggedIn) then Exit;

result := False;
p.x := 687;
p.y := 103;

findColorsTolerance(TPA, 472, minimap.getBounds(), 5);
obj := TPAToATPA(TPA, 50);
sortATPAfromMidPoint(obj, p);
if length(obj) > 0 then
begin
smartImage.drawCircle(point(MiddleTPA(obj[0]).x - randomrange(33,35), MiddleTPA(obj[0]).y + randomrange(13,15)), 8, true, 1777498);
mouse(MiddleTPA(obj[0]).x - randomrange(25,35), MiddleTPA(obj[0]).y + randomrange(7,15), MOUSE_MOVE);
wait(randomrange(160, 180));
fastclick(MOUSE_LEFT);
result :=true;
smartImage.clear();
end;
end;

//Walks to random bank booth using minimap
function walkToBank : boolean;
var
TPA: TPointArray;
obj: Array of TPointArray;
p: TPoint;
begin
if (not isLoggedIn) then Exit;

result := False;
p.x := 687;
p.y := 103;

findColorsTolerance(TPA, 2740983, minimap.getBounds(), 5);
obj := TPAToATPA(TPA, 50);
sortATPAfromMidPoint(obj, p);
if length(obj) > 0 then
begin
smartImage.drawCircle(MiddleTPA(obj[0]), 8, true, 1777498);
mouse(MiddleTPA(obj[0]).x - randomrange(10,13), MiddleTPA(obj[0]).y + randomrange(15,10), MOUSE_MOVE);
wait(randomrange(160, 180));
fastclick(MOUSE_LEFT);
result :=true;
smartImage.clear();
end;
end;

//Returns true if you are near a fairy ring
function nearRing : boolean;
var
dist: Integer;
TPA: TPointArray;
obj: Array of TPointArray;
p: TPoint;
begin
if (not isLoggedIn) then Exit;
dist := 100;
result := False;
p.x := 687;
p.y := 103;
findColorsTolerance(TPA, 1600233, minimap.getBounds(), 5);
obj := TPAToATPA(TPA, 50);
sortATPAfromMidPoint(obj, p);
if length(obj) > 0 then
dist := round(sqrt((p.x - MiddleTPA(obj[0]).x)*(p.x - MiddleTPA(obj[0]).x) + (p.y - MiddleTPA(obj[0]).y)*(p.y - MiddleTPA(obj[0]).y)));
if dist < 20 then
result := true;
end;

//Returns true if the fairy ring is not on minimap while in the cave
//Used as a failsafe for exiting when low health
function inBadCave : boolean;
var
TPA: TPointArray;
obj: Array of TPointArray;
p: TPoint;
begin
if not isLoggedIn then Exit;

result := true;

findColorsTolerance(TPA, 1600233, minimap.getBounds(), 5);
obj := TPAToATPA(TPA, 50);
if length(obj) > 0 then
result := false;

end;

//Returns true if player is near obelisk on minimap
function nearObelisk : boolean;
var
dist: Integer;
TPA: TPointArray;
obj: Array of TPointArray;
p: TPoint;
begin
if (not isLoggedIn) then Exit;
dist := 100;
result := False;
p.x := 687;
p.y := 103;
findColorsTolerance(TPA, 1068133, minimap.getBounds(), 5);
obj := TPAToATPA(TPA, 50);
sortATPAfromMidPoint(obj, p);
if length(obj) > 0 then
dist := round(sqrt((p.x - MiddleTPA(obj[0]).x)*(p.x - MiddleTPA(obj[0]).x) + (p.y - MiddleTPA(obj[0]).y)*(p.y - MiddleTPA(obj[0]).y)));
if dist < 20 then
result := true;
end;

//Walks to where the fairy ring is visible on minimap in cave
procedure walkGoodCave;
var
clickBox: TBox;
pt: TPoint;
x, y, i: Integer;
TPA: tpointArray;
obj: array of tpointarray;
begin
if (not isLoggedIn) then Exit;

clickbox := intToBox(582, 67, 612, 135);
pt := clickbox.getMiddle();

Mouse(point(pt.x + randomrange(-8, 8), pt.y + randomrange(-8,8)), MOUSE_MOVE);
wait(randomrange(50, 100));
fastclick(MOUSE_LEFT);

end;

//Returns true if you are in the bank
function nearBank : boolean;
var
dist: Integer;
TPA: TPointArray;
obj: Array of TPointArray;
p: TPoint;
begin
if (not isLoggedIn) then Exit;
dist := 100;
result := False;
p.x := 687;
p.y := 103;
findColorsTolerance(TPA, 2740983, minimap.getBounds(), 5);
obj := TPAToATPA(TPA, 50);
sortATPAfromMidPoint(obj, p);
if length(obj) > 0 then
dist := round(sqrt((p.x - MiddleTPA(obj[0]).x)*(p.x - MiddleTPA(obj[0]).x) + (p.y - MiddleTPA(obj[0]).y)*(p.y - MiddleTPA(obj[0]).y)));
if dist < 15 then
result := true;
end;

//Walks in between obelisk and bank
function walkCloseObelisk : boolean;
var
TPA: TPointArray;
obj: Array of TPointArray;
p: TPoint;
begin
if (not isLoggedIn) then Exit;

result := False;
p.x := 687;
p.y := 103;

findColorsTolerance(TPA, 1244922, minimap.getBounds(), 5);
obj := TPAToATPA(TPA, 50);
sortATPAfromMidPoint(obj, p);
if length(obj) > 0 then
begin
smartImage.drawCircle(middleTPA(obj[0]), 5, true, 472);
smartImage.drawCircle(point(MiddleTPA(obj[0]).x - randomrange(13,17),MiddleTPA(obj[0]).y + randomrange(22,27)), 5, true, 472);
mouse(MiddleTPA(obj[0]).x - randomrange(13,17), MiddleTPA(obj[0]).y + randomrange(22,27), MOUSE_MOVE);
wait(randomrange(160, 180));
fastclick(MOUSE_LEFT);
result :=true;
smartImage.clear();
end;
end;

//Returns true if you are in a certain area between teh obelisk and bank
function nearCloseToObelisk : boolean;
var
dist: Integer;
TPA: TPointArray;
obj: Array of TPointArray;
p: TPoint;
begin
if (not isLoggedIn) then Exit;
dist := 100;
result := False;
p.x := 687;
p.y := 103;
findColorsTolerance(TPA, 1244922, minimap.getBounds(), 5);
obj := TPAToATPA(TPA, 50);
sortATPAfromMidPoint(obj, p);
if length(obj) > 0 then
dist := round(sqrt((p.x - (MiddleTPA(obj[0]).x-14))*(p.x - (MiddleTPA(obj[0]).x-14)) + (p.y - (MiddleTPA(obj[0]).y+24))*(p.y - (MiddleTPA(obj[0]).y+24))));
if dist < 15 then
result := true;
end;

//Returns true if you are close to the bank
function nearCloseToBank : boolean;
var
dist: Integer;
TPA: TPointArray;
obj: Array of TPointArray;
p: TPoint;
begin
if (not isLoggedIn) then Exit;
dist := 100;
result := False;
p.x := 687;
p.y := 103;

findColorsTolerance(TPA, 265197, minimap.getBounds(), 15);
obj := TPAToATPA(TPA, 50);
sortATPAfromMidPoint(obj, p);
if length(obj) > 0 then
dist := round(sqrt((p.x - (MiddleTPA(obj[0]).x - 34))*(p.x - (MiddleTPA(obj[0]).x - 34)) + (p.y - (MiddleTPA(obj[0]).y + 14))*(p.y - (MiddleTPA(obj[0]).y + 14))));
if dist < 15 then
result := true;
end;

//Returns true if there are waterfiends visible
//Method of checking to see if your are in cave
function fiendsVisible : boolean;
var
TPA: TPointArray;
obj: Array of TPointArray;
p: TPoint;
begin
if (not isLoggedIn) then Exit;

result := False;
p.x := 687;
p.y := 103;

findColorsTolerance(TPA, 7756849, mainScreen.getBounds(), 5);
obj := TPAToATPA(TPA, 50);
if length(obj) > 0 then
begin
wait(randomrange(160, 180));
result :=true;
smartImage.clear();
end;
end;

//Enters Zanaris
procedure clickRingCave;
begin
if not isLoggedIn then Exit;

if objectFinder(16777163, ['airy', 'ring'], true, false) = 2 then
objectFinder(11071999, ['airy', 'ring'], true, false);
end;

procedure clickRingZanaris;
var
i: Integer;
TPA: TPointArray;
obj: Array of TPointArray;
begin
if (not isLoggedIn) then Exit;


findColorsTolerance(TPA, 16777163, mainscreen.getBounds(), 5);
obj := TPAToATPA(TPA, 250);
sortATPAfromMidPoint(obj, mainscreen.playerPoint);
if length(obj) > 0 then
begin
mouse(MiddleTPA(obj[0]).x + randomrange(-1,1), MiddleTPA(obj[i]).y + randomrange(-1,1), MOUSE_MOVE);
if isMouseOverText(['airy', 'ring'], randomrange(530,695)) then
begin
fastclick(MOUSE_RIGHT);
wait(randomrange(160, 180));
chooseOption.select(['airy', 'ring']);
end;
end;
end;

//Sees if the fairy ring interface is up
function interfaceUp : boolean;
var
p: tpoint;
begin
if not IsLoggedIn then Exit;

result := false;

if findText(p, ['BJQ', 'ungeons'], [smallChars], intToBox(543, 63, 740, 328)) then
result := true;
end;

//Puts in teh proper fairy code NOTE: Must have been used before
procedure enterCave;
var
p: tpoint;
begin
if not isLoggedIn then Exit;

if findText(p, ['BJQ', 'ungeons'], [smallChars], intToBox(543, 63, 740, 328)) then
begin
Mouse(p, MOUSE_MOVE);
wait(randomrange(150, 250));
fastclick(MOUSE_LEFT);
end;

wait(randomrange(1200, 1700));

if findText(p, ['Teleport', 'to this', 'location'], [CharsNPC], intToBox(201, 281, 375, 335)) then
begin
Mouse(p, MOUSE_MOVE);
wait(randomrange(150, 250));
fastclick(MOUSE_LEFT);
end;
end;

//Returns true if the bank is open
//ignore this function
function bankOpen : boolean;
var
x, y: Integer;
begin
if not IsLoggedIn then Exit;

result := false;

if findDTM(closeDTM, x, y, mainScreen.getBounds()) then
result := true;
end;

//Does a reasonable amount of antiban for a combat script
procedure antiban;
var
i: integer;
begin
if not isLoggedIn then
exit;

i := random(1000);
case i of
1..3: randomRClickItem();
20..22: sleepAndMoveMouse(randomrange(1000, 1500));
60..62:
begin
randomCompass(0, 360, true);
minimap.clickCompass();
wait(randomrange(75,100));
randomCameraAngle(MS_ANGLE_HIGH);
end;
120..122: wait(randomrange(3000, 6000));
340..372: smallRandomMouse();
430..432: mouseOffClient(OFF_CLIENT_TOP);
450..452: mouseOffClient(OFF_CLIENT_RANDOM);
660..662: wait(randomrange(800, 2000));
860..870: minimap.setAngle(MM_DIRECTION_NORTH);
end;
end;


//Checks a state using the custom boolean functions
// and performs the logical task it needs to
procedure mainLoop;
begin
cycles := 0;
onLoot := false;
fails := 0;
repeat
if not isLoggedIn then
players[currentplayer].login();

loadDTMs;
antiban;

if fiendsVisible and inBadCave then
begin
walkGoodCave;
fails := 0;
wait(randomrange(6000, 7000));
end

if lowHealth and haveFood and fiendsVisible and not bankScreen.isOpen() then
begin
eatFood;
fails := 0;
wait(randomrange(250, 350));
end

if lowHealth and not haveFood and fiendsVisible and not bankScreen.isOpen() then /////////////////
begin
caveWalkOut;
fails := 0;
wait(randomrange(6000, 7000));
end

if isInCombat and not lowHealth then
begin
useAbility;
fails := 0;
wait(randomrange(250, 350));
end

if invFull then
eatFood;

if lowPrayer and usePrayerPot and havePots then
begin
drinkPot;
fails := 0;
wait(randomrange(350, 550));
end

if not isPraying and usePrayer and havePrayer and fiendsVisible and not bankScreen.isOpen() then //and inDungeon
begin
clickPrayer;
fails := 0;
wait(randomrange(250, 350));
end

if not lowHealth and not isInCombat and not lootVisible and fiendsVisible and not bankScreen.isOpen() then
begin
attackFiend(650, 750);
fails := 0;
wait(randomrange(2000, 2500));
end

if not lowHealth and not isInCombat and fiendsVisible and not bankScreen.isOpen() and lootVisible and loot and (not onLoot) then
begin
takeLoot;
fails := 0;
wait(randomrange(2000, 2750));
end

if onLoot and not isInCombat then
begin
keepTaking;
fails := 0;
wait(randomrange(130,200));
end

if nearBank and haveFood then
begin
walkCloseObelisk;
writeln('walking close to obelisk');
wait(randomrange(6000, 7000));
end


if nearCloseToObelisk and haveFood then
begin
caveWalkOut;
writeln('Walking to ring');
wait(randomrange(6000, 7000));
end

if nearRing and not fiendsVisible and haveFood then
begin
clickRingZanaris;
fails := 0;
wait(randomrange(1500, 1700));
end

if nearRing and not fiendsVisible and not haveFood then
begin
walkToObelisk;
writeln('walking to obelisk');
wait(randomrange(6000, 7000));
end

if nearObelisk and not haveFood then
begin
walkCloseObelisk;
writeln('Walking close to bank');
wait(randomrange(6000, 7000));
end

if nearCloseToObelisk and not haveFood then
begin
walkToBank;
writeln('walking in bank');
wait(randomrange(10000, 12000));
end

if nearBank and not haveFood then
begin
clickBank;
wait(randomrange(2200, 2700));
depositAll;
wait(randomrange(600, 800));
withdrawItems;
wait(randomrange(600, 800));
bankScreen.close();
wait(randomrange(2000, 2200));
end

if interfaceup then
begin
enterCave;
fails := 0;
wait(randomrange(10000, 12000));
end

if lowHealth and not haveFood and fiendsVisible and not bankScreen.isOpen() and nearRing then
begin
clickRingCave;
wait(randomrange(10000, 12000));
end

if fails = 5 then
Break;

cycles := cycles + 1;
writeln('We have been throu the main loop ' + toString(cycles) + ' times.');
freetheDTMs;
until(false);
end;


begin
clearDebug();
smartEnableDrawing := true;
setupSRL;
declarePlayers;
addonterminate('freetheDTMS');
wait(1000);
mainloop;
wait(1000);
end.


//Please keep in mind I had to use some lengthy methods due to colors in Zanaris and in the cave all being so
//similar to each other

//New script
//NOTE: I wrote AutoPlankMake before WaterFiendKiller




program AutoPlankMake;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I SPS/lib/SPS-RS3.Simba}
var //globals
plankDTM, logDTM, planksmade, closeDTM, fails, bankerColor, spellSlot, direction: integer;
clicknext: string;

procedure declarePlayers;
begin
//Fill in these three. The bankerColor might be fine if you are in front of a purple banker.
bankerColor := 4005931; //Take the color of the banker in front of you.
spellSlot := 1; //This number needs to be the slot number plankmake is in on the action bar
direction := MM_DIRECTION_WEST; //Direction your character needs to face
setLength(players, 1);
with players[0] do
begin
loginName := '';
password := '';
isActive := true;
isMember := true;
world := 84;
end;
currentPlayer := 0;
end;



procedure loadDTMs
begin
logDTM := DTMFromString('mbQAAAHicY2VgYEhkZWDwB+J0IA4B4lQg/srIwPALiD8A8Xsoe3lPLFA1ExgH6HGDaS4giY4ZsWAwAAC2hAkS');
plankDTM := DTMFromString('mlwAAAHicY2dgYFjPxMCwAYjXAPEOKHsFEC8D4nBGBoY4IE4BYj8g9gLiKCBOAmIHQxWgbiasmBVI4sKMeDAUAADUsQgW');
closeDTM := DTMFromString('mggAAAHicY2NgYKhmZWAoAeI6IC5HojcwQPBmIF4DxSD2z53ODMFszAyfZnAx/DufBcYgNlALVsyIA0MAAG7mESc=');
end;

procedure freetheDTMS;
begin
freeDTM(plankDTM);
freeDTM(logDTM);
freeDTM(closeDTM);
end;

//failsafe to logout after inactivity/unsolvable screwups
procedure failExit;
begin
if (not isLoggedIn) then Exit;

wait(randomrange(1500,3000));
players[currentPlayer].exitToLobby();
wait(randomrange(500, 1000));
terminateScript;
end;

procedure antiban;
var
i: integer;
begin
if not isLoggedIn then
exit;

i := random(2000);
case i of
1..3: randomRClickItem();
20..22: sleepAndMoveMouse(randomrange(1000, 1500));
60..62: randomCompass(0, 360, true);
120..122: randomCameraAngle(MS_ANGLE_HIGH);
340..342: smallRandomMouse();
430..432: mouseOffClient(OFF_CLIENT_TOP);
450..452: mouseOffClient(OFF_CLIENT_RANDOM);
660..662: boredHuman();
860..870: minimap.setAngle(direction);
end;
end;

//finds the dtm in the bank pack and deposits it
function depositPlanks : boolean;
var
x, y: integer;
begin
if (not isLoggedIn) then Exit;

if (findDTM(plankDTM, x, y, 550, 75, 735, 350)) then
begin
Mouse(x + randomrange(-2,2), y + randomrange(-2,2), MOUSE_MOVE);
wait(randomrange(200, 250));
fastclick(MOUSE_RIGHT);
wait(randomrange(50, 75));
chooseoption.select(['All']);
result := true;
planksmade := planksmade + 26;
fails := 0;
end else
result := false;
end;

//calculates magic xp/hr
function xpperhour() : extended;
var
time, xpgained, timeinhour: extended;
begin
time := getTimeRunning;
xpgained := planksmade * 90;
timeinhour := time/1000/60/60;
result := xpgained/timeinhour;
end;

//ignore this procedure (its for testing purposes)
procedure loadPaint;
begin

smartImage.clearArea(IntToBox(4, 448, 569, 597));
smartImage.drawBitmap('C:\Simba\Scripts\AutoPlankMake\plankmakebmp.bmp', point(4,448));
end;

//simply paints the proggy
procedure paintProgress
begin
smartImage.clearArea(IntToBox(4, 448, 569, 597));
smartImage.drawBitmap('C:\Simba\Scripts\AutoPlankMake\plankmakebmp.bmp', point(4,448));


smartImage.DrawText('Run Time: ' + msToTime(GetTimeRunning, TIME_SHORT), Point(280, 500), upchars07, false, 9456471);
smartImage.DrawText('Total XP: ' + toString(planksmade * 90), Point(280, 515), upchars07, false, 9456471);
smartImage.DrawText('XP/HR: ' + toString(round(xpperhour())), Point(280, 530), upchars07, false, 9456471);
smartImage.DrawText('Planks Made: ' + toString(planksmade), Point(280, 545), upchars07, false, 9456471);
smartImage.DrawText('Planks/HR: '+ toString(round(round(xpperhour())/90)), Point(280, 560), upchars07, false, 9456471);

end;

//searches for the color of the banker, breaks into groups, and clicks closest group
function openBank : boolean;
var
x, y, CTS, i: integer;
TPA: TPointArray;
booth: Array of TPointArray;
begin
if (not isLoggedIn) then Exit;

if bankscreen.isOpen() then
begin
Writeln('Bank already open. Cant open again');
exit;
end;

findColorsTolerance(TPA, bankerColor, mainscreen.getBounds(), 5);
booth := TPAToATPA(TPA, 50);
sortATPAfromMidPoint(booth, mainscreen.playerPoint);
if (not bankscreen.isOpen()) then
begin
mouse(MiddleTPA(booth[0]).x + randomrange(-1,1), MiddleTPA(booth[i]).y + randomrange(-1,1), MOUSE_MOVE);
if isMouseOverText(['ank', 'nker'], randomrange(400,550)) then
begin
writeln('Opening Bank');
fastclick(MOUSE_LEFT);
result := true;
wait(randomrange(1650, 1800));
end
end else
begin
writeln('Bank Open');
end;
end;

//withdraws the logs from bankscreen
function withdrawLogs: boolean;
var
x, y: integer;
begin
if (not isLoggedIn) then Exit;

if findDTM(logDTM, x, y, 62,81, 543, 591) then
begin
Mouse(x,y, MOUSE_MOVE);
if isMouseOverText(['aho', 'gany', 'y log'], randomrange(400, 550)) then
begin
writeln('withdrawing logs');
fastclick(MOUSE_RIGHT);
wait(randomrange(200, 250));
chooseOption.select(['All']);
result := true;
fails := 0;
end;
end else
begin
fails := fails +1;
wait(randomrange(2500, 3000));
end;
end;

//clicks on the designated actionbar slot
procedure selectSpell;
var
x, y: integer;
begin
if (not isLoggedIn) then Exit;

if (clicknext = 'spell') then
begin
if (actionBar.clickSlot(spellSlot)) then
clicknext := 'log';

end;
end;

//clicks on the log in the inventory
procedure clickLog;
var
x, y: integer;
begin
if (not isLoggedIn) then Exit;

if (clicknext = 'log') then
begin
if (findDTM(logDTM, x, y, 575, 292, 796, 563)) then
begin
Mouse(x + randomrange(-2,2), y + randomrange(-2,2), MOUSE_MOVE);
wait(randomrange(150,250));
fastclick(MOUSE_LEFT);
clicknext := 'spell';
wait(randomrange(350, 450));
antiban;
end else
begin
exit;
clicknext := 'spell';
end;
end;
end;

//clicks on spell then logs repeatedly. some added code to make more humanlike
function makePlanks : boolean;
var
x, y : integer;
begin
clicknext := 'spell';
repeat
if (clicknext = 'spell') then
selectSpell;
wait(randomrange(50,100));
if (clicknext = 'log') then
begin
if findDTM(logDTM, x, y, 580, 320, 799, 560) then
begin
clickLog;
end else
break;
end;
paintProgress;
until(tabBackpack.countDTM(logDTM) = 0 or findDTM(plankDTM,x,y,624,500,665,540));
wait(randomrange(700, 900));
if (tabBackpack.countDTM(logDTM) = 1) then
begin
if (clicknext = 'spell') then
selectSpell;
wait(randomrange(50,100));
if (clicknext = 'log') then
begin
if findDTM(logDTM, x, y, 580, 320, 799, 560) then
begin
clickLog;
end;
end;
wait(randomrange(700,900));
end else
exit;
writeln('Made dem logs');
result := true;
if (tabBackpack.countDTM(logDTM) > 0) then result := false;
end;

//closes bank (only made this when I thought bankscreen.close() was broken but it wasnt
function bankClose : boolean;
var
x, y: integer;
begin

result := false;

if findDTM(closeDTM, x, y, 0, 0, 799, 599) then
begin
Mouse(x, y, MOUSE_MOVE);
wait(randomrange(150,250));
fastclick(MOUSE_LEFT);
wait(randomrange(150,250));
result := true;
end;
end;

//returns true if the minimap is north
function minimapisnorth : boolean;
var
ang: extended;
begin
result := false;
ang := minimap.getAngleDegrees();
wait(randomrange(150, 250));
if (ang > 330) then result := true;
if (ang < 25) then result := true;
end;

//checks what needs to happen and does it
procedure mainloop;
var
x, y: integer;
begin
planksmade := 0;
repeat
if (not isLoggedIn) then break;

if minimapisnorth then
begin
minimap.setAngle(direction);
wait(randomrange(300, 550));
randomCameraAngle(MS_ANGLE_HIGH);
wait(randomrange(500, 750));
end;

if (bankscreen.isOpen() and (bankScreen.getPackCountDTM(plankDTM) > 0)) then
begin
depositPlanks;
wait(randomrange(700, 900));
end;

if (bankscreen.isOpen() and (not bankScreen.isPackFull)) then
begin
withdrawLogs;
wait(randomrange(1300, 1500));
end;

if (bankScreen.isOpen and (bankScreen.getPackCountDTM(logDTM) <> 26) and (bankScreen.getPackCountDTM(plankDTM) > 0)) then
begin
withdrawLogs;
wait(randomrange(1300, 1500));
end;

if ((not bankscreen.isOpen()) and (tabBackpack.count() <3)) then
begin
openBank;
wait(randomrange(700, 900));
end;

if ((not bankScreen.isOpen()) and (tabBackpack.countDTM(logDTM) > 1)) then
begin
makePlanks;
end;

if ((not bankScreen.isOpen()) and (tabBackpack.countDTM(logDTM) < 2)) then
begin
openBank;
wait(randomrange(900, 1100));
end;

if ((bankScreen.isOpen()) and (bankScreen.getPackCountDTM(logDTM) > 1)) then
begin
bankClose;
wait(randomrange(1500, 1750));
end;

if ((bankScreen.isOpen()) and (not findDTM(plankDTM, x, y, 62, 82, 543, 590))) then
begin
bankScreen.close();
wait(randomrange(1500, 1750));
end;

if((bankScreen.isOpen()) and findDTM(plankDTM, x, y, 62, 82, 543, 590) and (not findDTM(logDTM, x, y, 62, 82, 543, 590))) then
begin
wait(randomrange(6000, 8000));
if (not findDTM(logDTM, x, y, 62, 82, 543, 590)) then
begin
bankScreen.close();
wait(randomrange(2000,3000));
openBank;
wait(randomrange(2000,3000));
if (not findDTM(logDTM, x, y, 62, 82, 543, 590)) then
begin
writeln('No logs in bank');
failExit;
end else
writeln('Your Internet is slow, try increasing wait times');
end else
writeln('Your Internet is slow, try increasing wait times');
end;

if((bankScreen.isOpen()) and (bankScreen.getPackCount = 2)) then
begin
withdrawLogs;
wait(randomrange(1300, 1500));
end;
//this section is a second failsafe where the script gets stuck in bankscreen
if (fails = 5) then
begin
if withdrawLogs then
begin
fails = 0;
end else
begin
if bankScreen.isOpen() then
begin
bankScreen.close();
failExit;
end else
failExit;
end;
end;

until(false);
end;


begin
smartEnableDrawing := true;
clearDebug();
setupSRL;
declarePlayers;
addonterminate('freetheDTMS');
loadDTMs;
loadPaint;
if not isLoggedIn then
players[currentplayer].login();
wait(1000);
mainloop;
wait(5000);
freethedtms;
end.

???$

The Mayor

2014-01-21 02:19:06

Crackup about your girlfriend :biggrin:

You seem to have been fairly active on the forums lately, and have even posted a snippet of code to the SRL section. After a quick glance there are some parts in your script which could be written more efficiently and compact. It also compiles which is a plus (believe it or not some people submit bug-ridden scripts hah). I'll take a look at this properly later, but so far it looks good and well done on preparing the script for the application!

Spartan 117

2014-01-21 02:44:55

From: The Mayor
Crackup about your girlfriend :biggrin:

You seem to have been fairly active on the forums lately, and have even posted a snippet of code to the SRL section. After a quick glance there are some parts in your script which could be written more efficiently and compact. It also compiles which is a plus (believe it or not some people submit bug-ridden scripts hah). I'll take a look at this properly later, but so far it looks good and well done on preparing the script for the application!


Thanks for the reply! and yeah she's pretty awesome. Hey just curious, how long does the poll stay open?

The Mayor

2014-01-21 02:48:51

From: Spartan 117
Thanks for the reply! and yeah she's pretty awesome. Hey just curious, how long does the poll stay open?


This poll will close on 02-04-2014 at 07:21 PM

Although the admins may close it early if the result is clear.

NKN

2014-01-21 06:39:44

Yes.

King

2014-01-21 07:42:11

I'm on my tablet right now, so I cannot efficiently look at the script. It is good from what I can tell. I do see some spots where you can use cases, condense some code ect. However it seems sound to me ( from what I can see ). When I can get home to my computer I will look though the code closer and see where I can make some suggestions. The member rank is very community orientated, but that doesn't always mean just post count, but how helpful, nice and especially how you take criticism on your application.

I wrote a water fiend killer for my application as well. So you already have that! I will post later after I look through the code with suggestions.

E* I have looked through the code thoroughly and have decided to vote yes.

I see potential and a good attitude, also you responded very well to @warpie. Others have already shown you examples of what I would have posted, I would look into case functions.

Hope all goes well for you!

Hoodz

2014-01-21 08:13:18

yes from me, but same as king im on my phone right now so check this post out later. so i can give you some tips/advice
take a look at this: for to do loop

not sure if this is the right syntax but it should look like this.

var
PotDTM: TIntegerArray;
Pot1, Pot2, Pot3, Pot4: Integer;

procedure FreeOurDTMs;
begin
FreeDTM(Pot1);
FreeDTM(Pot2);
FreeDTM(Pot3);
FreeDTM(Pot4);
end;

procedure DeclareVars;
begin
Pot1 := DTMFromString('mbQAAAHicY2VgYDjAxsCwC4iPAPEJIN4OxLOZGBgmAfEEIJ4LxNOBuGD1LKBqJhTMBSTRMSMWDAYA1E8I0A==');
Pot2 := DTMFromString('mbQAAAHicY2VgYHBmY2BwB2JbILYCYg8g3sfEwLANiLcA8W4gPgTEJusbgaqZUDAXkETHjFgwGAAAB/AGvw==');
Pot3 := DTMFromString('mbQAAAHicY2VgYHjNxsDwFIjfAvEHIH4AxDOZGBgmAnEPEM8D4tlAbLqxBaiaCQVzAUl0zIgFgwEAD5MJUw==');
Pot4 := DTMFromString('mbQAAAHicY2VgYHBiY2BwA2JbILYAYi8gZmMCSkAxJxDzArHZllaEIBRzAUl0zIgFgwEA+V0DPw==');
PotDTM := [Pot1, Pot2, Pot3, Pot4];
AddOnTerminate('FreeOurDTMs');
end;

procedure drinkPot;
var
x, y, I: integer;
begin
if not isLoggedIn then Exit;
for I := 0 to High(PotDTM) do
if findDTM(potDTM[I], x, y, tabBackpack.getBounds()) then
begin
tabBackpack.clickDTM(potDTM[I], MOUSE_LEFT, '', randomrange(300, 350), false);
writeln('Drinking dose of potion');
Exit;
end;
end;

begin
{be sure to call DeclareVars here!}
DeclareVars;
DrinkPot;
end.

edit: @warpie; gave also an example.

Kyle

2014-01-21 08:31:48

Yes

Sjoe

2014-01-21 08:56:21

voted yes, good luck :)

slacky

2014-01-21 09:10:36

If I am reading this correctly (which I believe I'm doing), both "KeepTaking", and "TakeLoot" procedures could have been written using a loop to iterate over the options, where the options (text) would be saved in a string array (or 2d string-array). Also, since you Exit out of the procedure (keepTaking) once an if-condition yields True and body is evaluated, there is no need to use "else if". All in all: The length of KeepTaking and TakeLoot could be less then 1/2 the size, and much easier to maintain.

[SPOILER="More critics, and possible enhancements"]
I had something like this in my mind (simply modified your procedure)..
This is very untested (written here in this post)..:

//Takes loot in a prioritized manner
procedure TakeLoot;
var
i,j: Integer;
atpa: T2DPointArray;
opts: Array of TStringArray;
begin
if not isLoggedIn then Exit;

atpa := FindLoot(setuploot);
// Options are the same as yours (not changed)
// | Option Exist | Option Select
opts := [['Take Crimson'], ['Take Crimson'],
['row'], ['Take Mithril a'],
['reen'], ['Take Green'],
['lue'], ['Take Blu'],
['old'], ['Take Gold'],
['orb'], ['Take Water o'],
['lood'], ['lood', 'une'],
['ithril', 'ore'],['ithr', 'l or', 'ore'],
['key'], ['key'],
['ivy'], ['ivy'],
['ater ru'], ['Take Water rune'],
['ru', 'rune'], ['ru', 'rune'],
['ancel'], ['ancel']
];

for i := 0 to high(atpa) do
begin
SmartImage.clear();
Mouse(MiddleTPA(atpa[0]), MOUSE_MOVE);
Wait(RandomRange(50, 100));
FastClick(MOUSE_RIGHT);
WriteLn('Grabbing loot');
Wait(RandomRange(150, 250));
j := 0;
while j < length(opts) do
begin
if ChooseOption.OptionsExist(opts[j]) then
begin
ChooseOption.select(opts[j+1]);
Wait(RandomRange(1500, 2000));
onLoot := True;
Exit;
end;
j := j + 2;
end;
end;
end;


Your AntiBan procedure is also catching my eye. I am thinking about the unnecessity in the way you have your case-statement:

...
i := random(1000);
case i of
1..3: randomRClickItem();
20..22: sleepAndMoveMouse(randomrange(1000, 1500));
60..62:
begin
randomCompass(0, 360, true);
minimap.clickCompass();
wait(randomrange(75,100));
randomCameraAngle(MS_ANGLE_HIGH);
end;
120..122: wait(randomrange(3000, 6000));
340..372: smallRandomMouse();
430..432: mouseOffClient(OFF_CLIENT_TOP);
450..452: mouseOffClient(OFF_CLIENT_RANDOM);
660..662: wait(randomrange(800, 2000));
860..870: minimap.setAngle(MM_DIRECTION_NORTH);
end;
In stead of unneeded value jumps (which makes it harder to maintain) you could just as well do:

...
i := random(1000);
case i of
1..3: randomRClickItem();
4..6: sleepAndMoveMouse(randomrange(1000, 1500));
7..9:
begin
randomCompass(0, 360, true);
minimap.clickCompass();
wait(randomrange(75,100));
randomCameraAngle(MS_ANGLE_HIGH);
end;
10..12: wait(randomrange(3000, 6000));
13..15: mouseOffClient(OFF_CLIENT_TOP);
16..18: mouseOffClient(OFF_CLIENT_RANDOM);
19..21: wait(randomrange(800, 2000));
22..32: minimap.setAngle(MM_DIRECTION_NORTH);
33..65: smallRandomMouse();
end;
This has the same "chances" for each case as yours.

function "isPraying" could be more efficient, as it does one unneeded search for a DTM (if it's already found):

function isPraying : boolean;
var
x, y: Integer;
begin
if not isLoggedIn then Exit;

result := false;

if findDTM(prayDTM, x, y, mainScreen.getBounds()) then
result := true;
if findDTM(pray2DTM, x, y, mainScreen.getBounds()) then
result := true;

writeln(result);
end;
could instead be more efficient:

function isPraying : boolean;
var
x,y: Integer;
begin
if not isLoggedIn then Exit;

Result := FindDTM(prayDTM, x, y, mainScreen.GetBounds());
if not(Result) then
Result := FindDTM(pray2DTM, x, y, mainScreen.GetBounds());

WriteLn(Result);
end;

I could give you a bit critics regarding indentation, but not to much.. it's pretty good, I was easily able to go trough the code. Tho there are cases where indentation does not follow the standards, hence could be a bit better.. but it's nothing special.

I can probably find more to criticize but, that will do…
[/SPOILER]

After looking over your script a few times (pretty fast I may add), I have decided to vote No. Tho I admit, i was close to voting Yes.

Spartan 117

2014-01-21 09:51:15

From: hoodz
yes from me, but same as king im on my phone right now so check this post out later. so i can give you some tips/advice
take a look at this: for to do loop

not sure if this is the right syntax but it should look like
edit: @warpie; gave also an example.


Ah I see where that would be faster. Thanks for the tip!

Spartan 117

2014-01-21 10:01:38

From: warpie
If I am reading this correctly (which I believe I'm doing), both "KeepTaking", and "TakeLoot" procedures could have been written using a loop to iterate over the options, where the options (text) would be saved in a string array (or 2d string-array). Also, since you Exit out of the procedure (keepTaking) once an if-condition yields True and body is evaluated, there is no need to use "else if". All in all: The length of KeepTaking and TakeLoot could be less then 1/2 the size, and much easier to maintain.

After looking over your script a few times (pretty fast I may add), I have decided to vote No. Tho I admit, i was close to voting Yes.



Thank you for those great tips. I never even though to check if the result was already true in the isPraying. And thanks for the array tip on the takeloot and keep taking functions

cause

2014-01-21 13:54:10

Besides the already mentioned condensing, looks good! Voted yes

Spartan 117

2014-01-22 00:53:52

From: cause
Besides the already mentioned condensing, looks good! Voted yes


Thanks! and thanks to all yesses! By the way I find your sig fairly entertaining!

Wu-Tang Clan

2014-01-22 08:36:42

I love this guy, so yes for that. Also, he knows what he's doing. And I like this guy… so yes.
~Wu-Tang 4ever

Spartan 117

2014-01-23 02:13:49

From: Wu-Tang Clan
I love this guy, so yes for that. Also, he knows what he's doing. And I like this guy… so yes.
~Wu-Tang 4ever


Aw Wu you're making me blush :o
Haha on a serious note, thanks!

The Mayor

2014-01-23 03:25:36

As I mentioned before (as as the others have said) there is quite a lot of code that can be written more efficiently. In addition to what has already been mentioned (i.e. using cases and arrays), there are things like this:


function invFull : boolean;
begin
if not isLoggedIn then Exit;

result := false;

if tabBackpack.isFull then
result := true;
end;

Why not just write use: tabBackpack.isFull()? It's like making a whole new function that does the same thing.

And this one too (not to mention that it actually results true if the player IS moving)


//Returns true if not moving
function notMoving : boolean;
begin
if not isLoggedIn then Exit;

result := false;

if minimap.isPlayerMoving() then
result := true;
end;

Why not just write: not minimap.isPlayerMoving()

Also, you seem to include if statements when assigning results quite a bit:


if length(findLoot(setuploot)) > 0 then
result := true;

You could just assign it directly:


result := length(findLoot(setuploot)) > 0

You should also investigate SPS, I'm not sure how reliable your walking stuff looks ;)

Overall though, based on your attitude, activity etc, I'll vote yes :)

Spartan 117

2014-01-23 03:41:34

@The Mayor I actually tried SPS but the maps of Zanaris returned about fifteen different points for the same spot, so I just made use of something. It may look weird but it uses atpa's if the dtms and it has worked quite well for me!

About those other functions, you are right they are a lot of extra code. I originally had writelns in them for debugging and took those out after I debugged what I needed to. At that point I just left the custom function names in the mainloop because I was used to them for this script. If I ever publicly release this one I will definitely clean those out and look deeper into SPS. And as for the result instead of if statement, I don't know why I didn't think of that, it seems too obvious now that you mention it! Thanks for looking so carefully at my script mate.

Ashaman88

2014-01-23 09:50:13

I like your attitude man - keep it up.


First pass through script I don't have a ton more to add, but how well/how long does it run?

Also just curious, is this still a good method to get charms?

Spartan 117

2014-01-23 10:11:46

From: Ashaman88
I like your attitude man - keep it up.


First pass through script I don't have a ton more to add, but how well/how long does it run?

Also just curious, is this still a good method to get charms?


It is still a great method to get charms. And the longest I've let it run was about two hours which, for my character, was three bank trips. I don't like to not babysit on my main since he already has a macro minor. I wish I could tell you it runs until the 6 hour limit. But I just haven't tested it to that extent yet. I got about 600 charms during the writing of the script. And I didn't add looting until close to the end, so it gets about 80 charms per hour for me

footballjds

2014-01-23 10:23:20

how much use has this script gotten? already found one logic error. I'll comment back soon.

edit:

Doesn't seem like this script would really work. It seems to me that someone wrote the logic and never tested it.

well, it seems you have several logical errors, but i guess you'll iron them out eventually. at anyrate i took the liberty of editing your take loot procedure…
DiffCheck: http://www.diffchecker.com/nthiedzo

procedure takeLoot();
var
i: integer;
loot_list: TStringArray;
atpa: array of TPointArray;
begin
if not isLoggedIn then Exit;

loot_list := ['Take Crimson', 'Take Mithril a', 'Take Green', 'Take Blu',
'Take Gold', 'Take Water o', 'Take Blood r', 'ithril', 'key', 'ivy', 'rune'];

atpa := findloot(setuploot);

for i := 0 to high(atpa) do
begin
smartImage.clear();
Mouse(middleTPA(atpa[0]), MOUSE_MOVE);
wait(randomrange(50, 100));
fastclick(MOUSE_RIGHT);
writeln('grabbing loot');
wait(randomrange(150, 250));
if chooseOption.select(loot_list, RandomRange(100, 300)) then
begin
wait(randomrange(1500, 2000));
onLoot := true;
exit();
end else chooseOption.close;
end;
end;

I went through all your if elses and determined the logic should be about the same in both procedures… 30 lins vs 111 lines. Way less overhead as well.

EDIT, technically there should be a water rune in front of the rune in that loot list. but, meh

final edit:

I'd like to change my vote from a no to a yes. While nothing is perfect you seem like a good member and are interested in learning. You obviously spent a lot of time on the script.
I've reported my post and asked a mod to change my vote to a YES.

The Killer

2014-01-23 11:09:49

I'v voted no. The script is good :), the things that stood out to me have already been mentioned.
The script I'm happy with, and would normally get my vote. I voted no based on activity. You have only recently returned to the scene of srl and I like to see a fair amount of activity before giving the yes vote.

Anyway, I like your attitude and you seem like a nice guy. Wish you all the best with your application (it seems to be doing well already :P) but you haven't quite got my vote this time round.


P.s. Just used my 3k post on you ;)

edit: apprently I had already hit 3k! :o - Someone must of moved a topic, or maybe I made a report :s

Spartan 117

2014-01-23 11:47:58

From: footballjds
how much use has this script gotten? already found one logic error. I'll comment back soon.

edit:

Doesn't seem like this script would really work. It seems to me that someone wrote the logic and never tested it.

well, it seems you have several logical errors, but i guess you'll iron them out eventually. at anyrate i took the liberty of editing your take loot procedure…
DiffCheck: http://www.diffchecker.com/nthiedzo

procedure takeLoot();
var
i: integer;
loot_list: TStringArray;
atpa: array of TPointArray;
begin
if not isLoggedIn then Exit;

loot_list := ['Take Crimson', 'Take Mithril a', 'Take Green', 'Take Blu',
'Take Gold', 'Take Water o', 'Take Blood r', 'ithril', 'key', 'ivy', 'rune'];

atpa := findloot(setuploot);

for i := 0 to high(atpa) do
begin
smartImage.clear();
Mouse(middleTPA(atpa[0]), MOUSE_MOVE);
wait(randomrange(50, 100));
fastclick(MOUSE_RIGHT);
writeln('grabbing loot');
wait(randomrange(150, 250));
if chooseOption.select(loot_list, RandomRange(100, 300)) then
begin
wait(randomrange(1500, 2000));
onLoot := true;
exit();
end else chooseOption.close;
end;
end;

I went through all your if elses and determined the logic should be about the same in both procedures… 30 lins vs 111 lines. Way less overhead as well.

EDIT, technically there should be a water rune in front of the rune in that loot list. but, meh

final edit:

I'd like to change my vote from a no to a yes. While nothing is perfect you seem like a good member and are interested in learning. You obviously spent a lot of time on the script.
I've reported my post and asked a mod to change my vote to a YES.


Wow that function looks a lot better structurally. I do have a lot to learn still. Thanks for help with that function. But actually I put water runes at the bottom of the list because I want it to be the last thing taken. The reason is I use water runes to detect loot stacks on the ground. I did this because water fiends ALWAYS drop at least one. Maybe that was the easy way of doing it, but it seemed like a sound for sure way of detection for the situation.

From: The Killer
I'v voted no. The script is good :), the things that stood out to me have already been mentioned.
The script I'm happy with, and would normally get my vote. I voted no based on activity. You have only recently returned to the scene of srl and I like to see a fair amount of activity before giving the yes vote.

Anyway, I like your attitude and you seem like a nice guy. Wish you all the best with your application (it seems to be doing well already :P) but you haven't quite got my vote this time round.


P.s. Just used my 3k post on you ;)

edit: apprently I had already hit 3k! :o - Someone must of moved a topic, or maybe I made a report :s


That's fair enough mate. I can understand with the strict sense of community here at SRL. No hard feelings!

Hoodz

2014-01-23 12:36:46

From: Spartan 117
Wow that function looks a lot better structurally. I do have a lot to learn still. Thanks for help with that function. But actually I put water runes at the bottom of the list because I want it to be the last thing taken. The reason is I use water runes to detect loot stacks on the ground. I did this because water fiends ALWAYS drop at least one. Maybe that was the easy way of doing it, but it seemed like a sound for sure way of detection for the situation.

since 'Rune' is the last thing in the array i THINK it will first check the other things before looting the runes.

Kevin

2014-01-23 13:13:14

From: Spartan 117
Wow that function looks a lot better structurally. I do have a lot to learn still. Thanks for help with that function. But actually I put water runes at the bottom of the list because I want it to be the last thing taken. The reason is I use water runes to detect loot stacks on the ground. I did this because water fiends ALWAYS drop at least one. Maybe that was the easy way of doing it, but it seemed like a sound for sure way of detection for the situation.


'ru' will be checked and verified true in 100% of cases that 'r ru' would be true. Having both is typically redundant, UNLESS you want to withdraw the water rune first and foremost and any other rune only if the water isn't around (only true if 'r ru' is first, if 'ru' is checked first, then the first rune seen will always be the first one withdrawn).

As for your script…
Simba now has this cool functionality called StringMatch; basically you give it a full string you want and the full string you have and then it tells you the percent match they have. With that, you can then instead do something like this:
if(StringMatch('Take Water Rune', lootOption) > 0.90))then//This will check for a 90% match, allowing for 1 or 2 letters to be wrong
that is pseudocode obviously, I'm not super up to date on the new LAPE functions we have for SRL6 to make it more efficient for iterating over the options list, but overall, it's a simple process that should greatly improve accuracy in picking up items, as well as making things simpler as opposed to trying to come up with partial strings like 'e ru'. It should help out greatly with your monster and item detection. And as FootballJDS said, you can really shorten the size of those looting based methods there.

As for usability/prettiness, I think it would also be beneficial to have all those Writeln() become optional - as in I would be allowed to pick a setting to turn them all off if I didn't want my debug box cluttered.

On a positive note, I do appreciate you attempting something so difficult, helping others, and having a larger number of failsafes than I normally see. And it's always a plus to see how well you've taken prior criticism so far and remained far more positive than many others I've seen, even if it's only a much more recent activity as The Killer noted.

Having not voted yet, I'm quite curious. Why exactly did you decide to apply for Member's? What do you hope to gain from it? (There is no wrong answer, I promise).

Spartan 117

2014-01-23 13:34:54

From: hoodz
since 'Rune' is the last thing in the array i THINK it will first check the others thing before looting the runes.

Oh okay I see what he was saying now. Earlier I was on my phone with small text and read it wrong. I thought he was saying water rune should be at the very beginning of the array.


From: Kevin
'ru' will be checked and verified true in 100% of cases that 'r ru' would be true. Having both is typically redundant, UNLESS you want to withdraw the water rune first and foremost and any other rune only if the water isn't around (only true if 'r ru' is first, if 'ru' is checked first, then the first rune seen will always be the first one withdrawn).

As for your script…
Simba now has this cool functionality called StringMatch; basically you give it a full string you want and the full string you have and then it tells you the percent match they have. With that, you can then instead do something like this:
if(StringMatch('Take Water Rune', lootOption) > 0.90))then//This will check for a 90% match, allowing for 1 or 2 letters to be wrong
that is pseudocode obviously, I'm not super up to date on the new LAPE functions we have for SRL6 to make it more efficient for iterating over the options list, but overall, it's a simple process that should greatly improve accuracy in picking up items, as well as making things simpler as opposed to trying to come up with partial strings like 'e ru'. It should help out greatly with your monster and item detection. And as FootballJDS said, you can really shorten the size of those looting based methods there.

As for usability/prettiness, I think it would also be beneficial to have all those Writeln() become optional - as in I would be allowed to pick a setting to turn them all off if I didn't want my debug box cluttered.

On a positive note, I do appreciate you attempting something so difficult, helping others, and having a larger number of failsafes than I normally see. And it's always a plus to see how well you've taken prior criticism so far and remained far more positive than many others I've seen, even if it's only a much more recent activity as The Killer noted.

Having not voted yet, I'm quite curious. Why exactly did you decide to apply for Member's? What do you hope to gain from it? (There is no wrong answer, I promise).


Hey that is a pretty cool new function. I'll look into that. It could really increase efficiency especially for this script. Thanks for sharing that.

I applied for members for many reasons.
1. I felt like I was finally ready. After two to three years of playing off and on all the while learning how to script I feel like I really have a solid grasp on the core concepts of SRL.
2. Curiosity. I have always been curious what members only scripts there were, I won't lie about that haha
3. I have always loved what goes on here at SRL. I love the fact that it's completely open source and non profit. Just a group of people who want to further their programming skills while playing a fun game. Well now I'm in college and have more free time to devote to that. Which leads me to my last reason
4. I feel like being a member will motivate me more to help the community and write scripts. I feel like having the member status is more than a status but an obligation to the community that you will participate. So I want that for me and for the community.

SRL has done a lot for me. It truly helped direct me into my degree plan and that's not a lie.

The Mayor

2014-01-23 15:23:36

From: Spartan 117


I applied for members for many reasons.
1. I felt like I was finally ready. After two to three years of playing off and on all the while learning how to script I feel like I really have a solid grasp on the core concepts of SRL.
2. Curiosity. I have always been curious what members only scripts there were, I won't lie about that haha
3. I have always loved what goes on here at SRL. I love the fact that it's completely open source and non profit. Just a group of people who want to further their programming skills while playing a fun game. Well now I'm in college and have more free time to devote to that. Which leads me to my last reason
4. I feel like being a member will motivate me more to help the community and write scripts. I feel like having the member status is more than a status but an obligation to the community that you will participate. So I want that for me and for the community.

SRL has done a lot for me. It truly helped direct me into my degree plan and that's not a lie.


Well that was a good answer :)

masterBB

2014-01-23 16:45:16

@Spartan 117 Can you make this function a one liner?

function notMoving : boolean;
begin
if not isLoggedIn then Exit;

result := false;

if minimap.isPlayerMoving() then
result := true;
end;

This is not what I am looking for:

function notMoving : boolean;
begin
if not isLoggedIn then Exit; result := false; if minimap.isPlayerMoving() then result := true;
end;

One line -> no if statements

Spartan 117

2014-01-23 17:14:14

From: masterBB
@Spartan 117 Can you make this function a one liner?



function notMoving : boolean;
begin
result := minimap.isPlayerMoving();
end;

The Mayor

2014-01-23 17:15:44

From: Spartan 117

function notMoving : boolean;
begin
result := minimap.isPlayerMoving();
end;


forgot the not ;)

Spartan 117

2014-01-23 17:20:41

From: The Mayor
forgot the not ;)


Shit.. I was just thinking about the concept/syntax haha.


function notWalking : boolean;
begin
result := not minimap.isPlayerMoving();
end;

Kevin

2014-01-23 17:20:51

From: The Mayor
forgot the not ;)


Actually it looks like he just named the method wrong… His shortened version matches the logic of the original flow :p

From: Spartan 117
Shit.. I was just thinking about the concept/syntax haha.


function notWalking : boolean;
begin
result := not minimap.isPlayerMoving();//If true, then result is false. if false, then result is true,
end;


function notMoving : boolean;
begin
if not isLoggedIn then Exit;
result := false;
if minimap.isPlayerMoving() then//If true, then result is true. If false, then result is false.
result := true;
end;

Spartan 117

2014-01-23 17:33:09

From: Kevin
Actually it looks like he just named the method wrong… His shortened version matches the logic of the original flow :p



I do want it to return true when not moving, so this way of doing it is correct:

function notMoving : boolean;
begin
result := not minimap.isPlayerMoving();
end;

footballjds

2014-01-23 17:42:07

From: Spartan 117
I do want it to return true when not moving, so this way of doing it is correct:

function notMoving : boolean;
begin
result := not minimap.isPlayerMoving();
end;


yeah, but that isn't how this one is:

function notMoving : boolean;
begin
if not isLoggedIn then Exit;

result := false;

if minimap.isPlayerMoving() then
result := true;
end;

Spartan 117

2014-01-23 17:51:58

From: footballjds
yeah, but that isn't how this one is:

function notMoving : boolean;
begin
if not isLoggedIn then Exit;

result := false;

if minimap.isPlayerMoving() then
result := true;
end;


Yeah, I know. There was a typo in that one. I never implemented the function in the script. I was planning on at one point, but decided I didn't need it. So I accidentally left out the not in the script. I never used it so I never noticed it. And I didn't take it out as I could possibly use it in the future.

Wetish

2014-01-23 20:38:47

Script is good as stated above, but your activity makes me uneasy. 150 posts is just too few. Unless you are very active on irc, skype, or some other platform relating to this forum, it is a no from me.

Spartan 117

2014-01-24 03:07:22

Just thought I might share this with everyone. I have added everyone's suggestions to the script and it is running flawlessly so far. Taking away a lot of the if statements seems to have really sped up the scripts logic. And @footballjds your suggestions for the loot taking took out a ton of lines of the script, making it easier to maintain, and although it is hard for a human to notice the difference I can see a small difference in the speed of looting so thanks a lot for that help. Everything is just more sound now. So to everyone's suggestions here is a thank you! Because with your suggestions I was able to edit other parts of my script that could be shortened. If anyone wanted to see the edits I can post the re-written script. I haven't done so yet because I don't know if that would be ethical for the application. But once again a huge thank you to everyone.

masterBB

2014-01-24 05:48:07

From: Spartan 117
I do want it to return true when not moving, so this way of doing it is correct:

function notMoving : boolean;
begin
result := not minimap.isPlayerMoving();
end;


ah, so close. But you removed the check for log in :S

Spartan 117

2014-01-24 11:02:44

From: masterBB
ah, so close. But you removed the check for log in :S


Hey that's not fair you asked for one line!

masterBB

2014-01-24 11:13:48

From: Spartan 117
Hey that's not fair you asked for one line!


function notMoving : boolean;
begin
result := isLoggedIn() and not(minimap.isPlayerMoving());
end;

Hmmm, let me check that script again for another challenge :p

Spartan 117

2014-01-24 11:27:35

From: masterBB
function notMoving : boolean;
begin
result := isLoggedIn() and not(minimap.isPlayerMoving());
end;

Hmmm, let me check that script again for another challenge :p


Well it will return false if it's not logged in anyways so that's really just an unnecessary check isn't it?
Challenges are fun :)

Turpinator

2014-01-26 00:22:30

From: Spartan 117
Well it will return false if it's not logged in anyways so that's really just an unnecessary check isn't it?
Challenges are fun :)


I guess technically it will return false if youre not logged in, but that is only after it has waited/done its pixelshift.

so this loggedin check is done quicker (ie just a getcolor) than doing a 500ms pixelshift.

The Mayor

2014-01-26 00:27:22

From: Turpinator
I guess technically it will return false if youre not logged in, but that is only after it has waited/done its pixelshift.

so this loggedin check is done quicker (ie just a getcolor) than doing a 500ms pixelshift.


The isPlayerMoving times out after 20 seconds (iirc)

Turpinator

2014-01-26 00:29:34

From: The Mayor
The isPlayerMoving times out after 20 seconds (iirc)

isPlayerMoving(shiftInterval: integer = 500)

Annyway. i voted yes. :)

The Mayor

2014-01-26 01:00:38

From: Turpinator
isPlayerMoving(shiftInterval: integer = 500)

Annyway. i voted yes. :)


Opps, I was thinking of waitPlayerMoving.

Hobbit

2014-02-03 00:48:12

In! Welcome!