Simba Code:
program AstralRcRunnerGoogle;
{$define smart}
{$ifdef raymondpowns} function splittpa(arr : tpointarray; dist : integer) : t2dpointarray; begin splittpawrap(arr, dist, result); end; function splittpaex(arr : tpointarray; w, h : integer) : t2dpointarray; begin splittpaexwrap(arr, w, h, result); end; function cleartpafromtpa(arp, clearpoints : tpointarray) : tpointarray; begin cleartpafromtpawrap(arp, clearpoints, result); end; function tpatoatpaex(arp : tpointarray; w, h : integer) : t2dpointarray; begin tpatoatpaexwrap(arp, w, h, result); end; function tpatoatpa(arp : tpointarray; dist : integer) : t2dpointarray; begin tpatoatpawrap(arp, dist, result); end; function findgapstpa(tpa : tpointarray; minpixels : integer) : t2dpointarray; begin findgapstpawrap(tpa, minpixels, result); end; {$endif}
{$i srl/srl.simba}
{$i sps/sps.simba} {$i srl/srl/misc/smartgraphics.simba}
type foodinfo = record
fooddtm: integer;
end;
var
x, y, t, runs, giant, tele, large,
medium, small, runecount, runesperhour,
runstotal, waittime, waittele, timetele,
astral, count, air, cosmic, hpeat, pot,
vial, summ, contact, profit, decay, essused,
essloss, astralprofit, profitperhour, lunar,
home, new, mass, ess: integer;
status: string;
food: foodinfo;
walk, altar, bank, lodestone: tpointarray;
const
scriptversion = '2.2';
updatescript = true;
getmaps = true;
debug = true;
paint = false;
massive = true;
bunyip = false;
essprice = 119;
astralprice = 68;
procedure includes;
begin
hpeat := 900;
runstotal := 936; //436 is 6 hours roughly
waittime := 750 + random(225);
waittele := 965 + random(375);
timetele := 485 + random(265);
srl_sixhourfix := true;
smart_fixspeed := true;
end;
procedure declareplayers;
begin
howmanyplayers := 1;
numberofplayers(howmanyplayers);
currentplayer := 0;
with players[0] do
begin
name := '';
pass := '';
nick := '';
pin := '';
member := true;
active := true;
strings[0] := 'monkfish';
end;
end;
procedure downloadimage(imagename: string; location: string);
var
image, path: string;
fp: integer;
begin
image := getpage(location);
path := includepath + 'sps\img\runescape_other\' + imagename + '.png';
path := trim(path);
fp := createfile(path);
writefilestring(fp, image);
closefile(fp);
end;
function grabmap: boolean;
var
astralmap : string;
astralname: string;
begin
astralname := 'lunar';
astralmap := 'http://img713.imageshack.us/img713/1531/lunarq.png';
if getmaps then
begin
if (not fileexists(includepath + 'sps\img\runescape_other\lunar.png')) then
writeln('we do not have the map, downloading the file now');
downloadimage(astralname, astralmap);
end else
writeln('we already have the lunar map');
result := (fileexists(includepath + 'sps\img\runescape_other\lunar.png'));
end;
procedure mapchecker;
begin
if not grabmap then
raiseexception(ercustomerror, 'maps do not exist or its named incorrectly');
end;
procedure autoupdateme; var neifile: integer; onlineversion, newscript, neifeilnennen: string; begin writeln(#67#104#101#99#107#105#110#103#32#102#111#114#32#115#99#114#105#112#116#32#117#112#100#97#116#101#115#46#46#46); onlineversion := getpage(#104#116#116#112#58#47#47#103#105#116#115#103#111#111#103#108#101#46#103#111#111#103#108#101#99#111#100#101#46#99#111#109#47#103#105#116#47#118#101#114#115#105#111#110#46#116#120#116); writeln(onlineversion); writeln(scriptversion) if (trim(onlineversion) > scriptversion) then begin writeln(#78#101#119#101#114#32#115#99#114#105#112#116#32#118#101#114#115#105#111#110#32#111#110#108#105#110#101#33); writeln(#65#117#116#111#117#112#100#97#116#105#110#103#32#116#111#32#110#101#119#101#114#32#118#101#114#115#105#111#110#46); newscript := getpage(#104#116#116#112#58#47#47#103#105#116#115#103#111#111#103#108#101#46#103#111#111#103#108#101#99#111#100#101#46#99#111#109#47#103#105#116#47#65#115#116#114#97#108#85#112#100#97#116#101#46#115#105#109#98#97); neifeilnennen := scriptpath + #65#115#116#114#97#108#82#99#82#117#110#110#101#114#32#86 + onlineversion + #32#98#121#32#71#111#111#103#108#101#46#115#105#109#98#97; neifile := rewritefile(neifeilnennen, true); try writefilestring(neifile, newscript); except begin writeln(#70#97#116#97#108#32#101#114#114#111#114#32#119#114#105#116#105#110#103#32#116#111#32 + neifeilnennen + #33#33); terminatescript; end; end; closefile(neifile); writeln(#78#101#119#32#115#99#114#105#112#116#32#100#111#119#110#108#111#97#100#101#100#32#116#111#32 + neifeilnennen + #33#33#32#80#108#101#97#115#101#32#117#115#101#32#116#104#105#115#32#111#110#101#33#33); terminatescript; end else writeln(#89#111#117#32#104#97#118#101#32#116#104#101#32#108#97#116#101#115#116#32#118#101#114#115#105#111#110#32#111#102#32#116#104#101#32#115#99#114#105#112#116#33); end;
procedure loadfoodinfo;
begin
case lowercase(players[currentplayer].strings[0]) of
'lobster':
begin
writeln('you have choosen monkfish for your food');
writeln('if this is incorrect stop the script and fill out the setup');
food.fooddtm := BitmapFromString(4, 12, 'meJwTC1gkHrxSMnIbDw+vWMAS8ZDVktG7pBOPiwUukwhdJxW7Vzr5lHjQConwTVKx+2VSzoIVb+U3L+Q3ywcqFrAqF7CpFrCuBGoXtK0VcmgScu6AkMKuvSKeU0Ckx2RRrxmifvNBpO9csYBFQItAZOAyoMlAA0EoZLV46FqJsA0AQBou8A==');
end;
'monkfish':
begin
writeln('you have choosen monkfish for your food');
writeln('if this is incorrect stop the script and fill out the setup');
food.fooddtm := BitmapFromString(7, 6, 'meJzzCI5zC4wGIhf/SCsnHwiy9wi2cwsAIhsXPyAJFLFw8GzvmtPYMhUuDkRAcU/vPG+fguq6PggXgtw9sjy8cjp75pVVdgI1ApGZnXtxydTS8pnlFbMrq+eVlE3PL5hgamELAN1dKu4=');
end;
else
begin
writeln('please correctly fill out the food under declareplayers');
terminatescript();
end;
end;
end;
procedure spsvariables;
begin
lodestone := [point(85,144),point(89,146),point(91,146),point(95,145),point(99,145),point(100,145),point(105,145),point(107,145),point(109,145),point(112,145),point(114,145),point(116,146),point(117,146),point(119,146),point(123,146),point(124,146),point(125,146),point(128,146),point(130,146),point(131,146),point(133,145),point(133,144),point(135,143),point(138,141),point(141,140),point(141,137),point(141,135),point(141,131),point(141,129),point(140,129),point(139,129),point(138,129),point(138,129),point(138,129),point(139,129),point(143,129),point(143,129)];
walk := [point(346, 349), point(337, 351), point(330, 354), point(323, 356), point(311, 357), point(303, 358), point(278, 326), point(274, 319), point(269, 310), point(261, 305), point(256, 300), point(251, 296), point(242, 286), point(236, 278), point(226, 269), point(219, 262), point(209, 254), point(198, 244), point(193, 234), point(193, 224), point(189, 213), point(192, 198), point(191, 139), point(161, 139), point(138, 123), point(139, 125), point(140, 126)];
bank := [point(136, 128), point(138, 128), point(140, 127), point(142, 128)];
//altar :=[Point(157,142),Point(195,144),Point(203,196),Point(202,210),Point(202,225),Point(201,238),Point(204,250),Point(217,265),Point(231,274),Point(247,286),Point(258,295),Point(271,308),Point(282,321),Point(310,343),Point(330,347),Point(346,347),Point(360,348),Point(367,348),Point(362,347),Point(362,344),Point(364,343),Point(365,346),Point(365,348)];
altar := [point(157, 139), point(190, 141), point(188, 197), point(185, 204), point(187, 211), point(190, 218), point(194, 222), point(197, 227), point(200, 233), point(202, 238), point(202, 243), point(206, 247), point(209, 252), point(212, 255), point(217, 262), point(221, 266), point(225, 268), point(230, 271), point(238, 277), point(243, 281), point(249, 288), point(254, 292), point(262, 302), point(266, 307), point(270, 314), point(275, 321), point(277, 331), point(308, 344), point(323, 342), point(331, 342), point(338, 342), point(361, 345)];
end;
procedure script;
begin
giant := BitmapFromString(15, 12, 'meJx90PtKwzAUBvDhG+gLWAQdbk' +
'xaa7V07Zre1oXeNmuM1Tprd/P2/n/7SSCMKsJHSOF3zskp4Y1T1lb' +
'BDTo/PO7/ztHJADEzpgV0Qufh89Z/WntVO2HL8aK6ScoOQ6vLKD0d' +
'qge9nh3niBWl8IQ3KMEsVMEguFzFef9Ch1Qtf9+bAUWkxznUTSEVR' +
'QWWHlj6ay9GRsb4XDOEFBh3/lgvX9vV7q1ZreuXBp/soSpuy1mS+m' +
'HUadtutp2gMMny6YyG09j1fszIJDgx1MvY7vNr8/4BA4n+GIQRizs' +
'GLzDiJiUkggt+o1zTcCO8pLzneBKejR2Vs4GQ0kuM7eB129csgjUt' +
'24EPCo782XzfY4rjEoFlyT8eP+cbv5+GoA==');
decay := BitmapFromString(7, 13, 'meJzzj472DgvzDAlx9Q9w9vW1dXOzcHT0jYhERlbOLmZ2dgGxsf7R0UAuRL17UJC9h4ehmSUQ6Rub6xqYaOkZAk1w9PY2sbCBCMLFgQgiiCYOFMQUN7OyQxOHCGKKW9g6YooTIwgRhwsiKwYAcNJAIA==');
air := BitmapFromString(13, 7, 'meJxdjksKgDAQQ+8oWkopZSh+q9Y/4jF162UMCMNQeItMCJMQVd439/P+tO3Iep6PdT23/YJ2zrNflh1rEOOGJJAmUSXPEKZhWKQDrCV51nUv24FSRmtrjGMHU5N2kOeak/iJqUn7PyDLiiQpA3iLAYh9V/iu3Q==');
astral := BitmapFromString(4, 6, 'meJw7tvr4MRJRampmWnp2RmZuYmJqcnI6hAsASeUuIQ==');
cosmic := BitmapFromString(5, 9, 'meJwrr6gtr6iVOXMegkpKKkvLquHcoqJyoAgQQbgFBaVAESCCK4ALAhlZ2fk5OYV5ecUQ8YzMXIgIhJuWng0UgetKTc0EisC5ADbBRHE=');
vial := BitmapFromString(3, 25, 'meJwljrsSgjAURD/LwsIPoACGBPKAvEgCKpWdNIyNM1rR0PmxLqE7kz27N5fXen6+T49F1JQURZ5ltmtFU9Oy7LXuOK+K/Ldt6/ezzPM0jt5opNMwIEXlPkSnFCPkFgOKDamuIZg2gfdKCkSj75XggOgcBjml0dqWMdSDNXgBHLewjDXICTqAZM0OUsAHaCkTKAB8AG4BUMd1+Pje4SfYtT8t51Mn');
pot := BitmapFromString(4, 17, 'meJzLyUjPyUhPSUiICg/LTk8HouT4+KgwIDsNyE6Kj4sMDc1MTU1NTIiOCAeKtzdMrS3rrinpqihq62me314/q7l6an3FxBCvlmDP5gD3en+3OhS2dyuQHejRCGEDpYBsoFSoTztcGYgNVgZkh/l2wJUB2RBlQHa4bxdBNgClmVAu');
tele := BitmapFromString(5, 9, 'meJzbum3blKlTgWjl0oUnjh1JSkpqb28DcoEkEG3dtg0oCERbwcogbDQE1IgsBTENyICYAzQQYjLETLiByAgoCACoy1sL');
mass := BitmapFromString(24, 16, 'meJzF089LwmAYB3DpGh0stZBEMc' +
'sSTW2uTMec07WGptP5s8LEPAR5kDoEUSBJFIUeIuoQRfSX9pUXZDR' +
'b1iX48h7e9+Wz532fd1RMpDQJRHjt5D9mwmBQ588IV65PzdomTVYS' +
'HWozIWnvAfsxjzGaq6odQn1XoRZZE9Jk20ZKmXH51I46+IRa0zYFS' +
'5FsGYjR7p52ekYimMcnzEsByzKlc14sxasNnOsLFd4phsSMnxO9DI' +
'+yMWKnwxFAdKhYSoHGFmv8XlOoHW03WoyYCSckOiYEI9xKkP4RGVK' +
'sJEPDCGGI+Ojo+AjuDTsL18/5q8dc5yF72c9c9CiG/xVCitntf1R7' +
'75X7t/Lda+n2BU7y+Jw5aFHyvieRHudlkobiREr3CUFJSOrshj1sA' +
'/GJstXp1nnk5CyDvgtpNl+LlxoIX2mSwJFOu3ShviopRpNlzu5CRm' +
'pEGFysBsHkelyEwzVP3FR0wU9brDY45nkHQn4BdXcgaBEEzaK35FA' +
'yI7Y7/lRxMRgG5fRSQ4fc+SdcLvZi');
new := BitmapFromString(5, 15, 'meJyz9Au3DojUMbXSMjJX0zMCMuBsJQ0di8hU8/BkCFtBTdM2IQ/INfAJ13bxU7FyMg2JNwqI1nLyVjS1ldUztXL11nELAMoqm9vLG5rrmdtqGJgCVQIRUC/cZKB6BWMQA8o1Mtf1CDKwsocrAGoHcoHaIVygIchcIDKycYJwISLIKoEILg7hAgDufDAN');
large := DTMFromString('mwQAAAHic42RgYLjHysDwFIjvAvE1IL4KxDeB+BkQvwLiS0DcyMjAUA7EJUBcBsT1QNwLxN1A3ALEnUDs7mgGNI2JACYMGInAcAAAMsgNYw==');
medium := DTMFromString('mwQAAAHic42RgYOBgY2DgAmJ2IBYE4v+sDAwsQJoHiHmBmAGImxgZGIqBuAeIWxkh/Coo7gbiTiD2cbUCKmYigAkDRiIwHAAA4DAHAg==');
small := DTMFromString('mwQAAAHic42RgYDBiY2AwZoPQNkCsAcS6QGwOxBZArAPEjYwMDCVA3AXEzUDcAsQ1QFwLxJ1Q7OlsATSNiQAmDBiJwHAAADJsB3o=');
contact := DTMFromString('mlwAAAHicY2dgYBBkZGAQAGIZIJaDYn4gZgHiZ0B8B4gfAPErIP4Ixc+BePK5Nwy8vDwMPNzcDJxsbAycfOIMXNxcYD4XA27AiAdDAQAI4woh');
summ := DTMFromString('m1gAAAHic42JgYLjNxMBwHYhvAfF9IH4ExA+B+C4Q3wDiK0B8FYh/ANV+BuJPUBrE/wPEDIwMDP+B1G8g/gbEWdVKEEECmIuBOEDYJAhGAABANhKE');
lunar := DTMFromString('mbQAAAHicY2VgYPjMzsDwHojfAPEXIP4BxIuB4nOBeDkQrwbiJUDMa13G8P36fob9W+cxMGmHAXE4AytQHISRASMWDAYAQkgOjA==');
home := DTMFromString('mlwAAAHicfcWxCYAwGAXhSxHDbyDEkUUklahYKIKL2bmAM/gKWz34uACMBoNssssirRSZHHRSZJVDZunlvG6iBXLO1LpVnhSNJkU837kfbw8FLAuV');
ess := DTMFromString('m6wAAAHic42ZgYDAFYjsgdoZidSDWAGIDIDYHYhsgdoDy5wLxCiBeCMQzgXg2EC8B4tVQPAmIpwFxPxBnpCQDSSY8mBGKQWziASMJGAkAAB/ZCn4=');
//setbitmapname(food.fooddtm, 'food bitmap');
setbitmapname(giant, 'giant pouch bitmap');
setbitmapname(decay, 'giant decay bitmap');
setbitmapname(tele, 'teleport spell bitmap');
setbitmapname(pot, 'energy potion bitmap');
setbitmapname(vial, 'empty vial bitmap');
setbitmapname(air, 'air rune bitmap');
setbitmapname(astral, 'asral rune bitmap');
setbitmapname(cosmic, 'cosmic rune bitmap');
setbitmapname(mass, 'massive pouch bitmap');
setbitmapname(new, 'unused massive pouch bitmap');
setdtmname(large,'large pouch dtm');
setdtmname(medium, 'medium pouch dtm');
setdtmname(small, 'small pouch dtm');
setdtmname(contact, 'contact spell dtm');
setdtmname(summ, 'summoning icon dtm');
setdtmname(home, 'home icon dtm');
setdtmname(lunar, 'lunar icon dtm');
end;
procedure freescript;
begin
//freebitmap(food.fooddtm);
freebitmap(giant);
freebitmap(decay);
freebitmap(tele);
freebitmap(pot);
freebitmap(vial);
freebitmap(air);
freebitmap(astral);
freebitmap(cosmic);
freebitmap(mass);
freebitmap(new);
freebitmap(ess);
freedtm(large);
freedtm(medium);
freedtm(small);
freedtm(contact);
freedtm(summ);
freedtm(home);
freedtm(lunar);
end;
function sixhourcheck: boolean;
begin
if loggedin then
exit;
result := false;
if not loggedin then
begin
if debug then
writeln('we have hit the 6 hour mark, relogging in');
loginplayer;
exitsquealoffortune;
if debug then
writeln('ajusting the camera angle back to absolute north');
clicknorth(srl_angle_high);
end;
if loggedin then
result := true;
end;
procedure actionkey(text: string);
var
i: integer;
begin
for i := 1 to length(text) do
begin
{$ifdef simbamajor980}
sendkeys(text[i], 40 + random(40));
{$else}
sendkeys(text[i], 30 + random(30), 30 + random(30));
{$endif}
wait(40 + random(40));
end;
end;
function actionkeychange(text: string; time:integer):boolean;
var
i, t, first, second:integer;
begin
first := getxpbartotal; {property of google}
marktime(t);
for i := 1 to length(text) do
begin
repeat
{$ifdef simbamajor980}
sendkeys(text[i], 50 + random(40));
{$else}
sendkeys(text[i], 50 + random(30), 30 + random(30));
{$endif}
wait(50 + random(40));
sixhourcheck;
wait(10);
second := getxpbartotal;
if timefrommark(t) > time then
begin
result := false;
writeln('function is wrong');
exit;
end;
until(second > first);
result := true;
writeln('function is correct');
end;
end;
function sps_getmyposition(): tpoint;
var
minimap: tmufasabitmap;
smallmap: t3dintegerarray;
t, foundmatches: integer;
p: tpoint;
searches: extended;
begin
result := point(-1, -1);
if (not loggedin) then
exit;
if (sps_tolerance < 1.0) then
sps_tolerance := 600.0;
if (sps_matchespercent = 0.0) then
sps_matchespercent := 0.45;
if (inrange(round(rs_getcompassangledegrees), 10, 350)) then
makecompass('n');
t := getsystemtime();
minimap := sps_gatherminimap;
sps_filterminimap(minimap);
//drawbitmapdebugimg(minimap.index);
//displaydebugimgwindow(150, 150);
{$ifdef simbamajor990}
setlength(smallmap, 0); // using this instead of smallmap := [];
sps_bitmaptomap(minimap, sps_accuracy, smallmap);
{$else}
smallmap := [];
smallmap := sps_bitmaptomap(minimap, sps_accuracy);
{$endif}
foundmatches := sps_findmapinmap(p.x, p.y, sps_areamaps, smallmap, sps_tolerance);
searches := ((minimap.width / sps_accuracy) * (minimap.height / sps_accuracy));
{
writeln('fx: '+tostr(p.x)+' ~ on area: '+tostr(p.x * sps_accuracy + (minimap.width / 2)));
writeln('fy: '+tostr(p.y)+' ~ on area: '+tostr(p.y * sps_accuracy + (minimap.width / 2)));
writeln('matches: '+tostr(foundmatches));
writeln('searches: '+tostr(searches));
writeln('percent: '+tostr(foundmatches / searches));
}
if ((foundmatches / searches) > sps_matchespercent) then
result := sps_localtoglobal(sps_gettopleftcoords(sps_areas), // the top left of the total area
p.x * sps_accuracy + (minimap.width / 2),
p.y * sps_accuracy + (minimap.width / 2));
minimap.free;
t := (getsystemtime - t);
if (sps_debug) then
writeln('sps_getmypos: finished in '+tostr(t)+' ms. result = '+tostr(result));
end;
function sps_walkline(path: tpointarray): boolean;
var
i, h, t, d: integer;
p, mm: tpoint;
begin
h := high(path);
t := getsystemtime + 20000 + random(5000);
exitsquealoffortune;
while (not result) and (getsystemtime < t) do
begin
runenergy(20);
p := sps_getmyposition;
for i := h downto 0 do
begin
mm.x := mmcx + path[i].x - p.x;
mm.y := mmcy + path[i].y - p.y;
d := distance(mm.x, mm.y, mmcx, mmcy);
if (d < 10) then
break
else
if (d < 70) then
begin
if (sps_multimouse) then
multimouse(mm.x, mm.y, 25, 3, false)
else
mouse(mm.x, mm.y, 5, 5, mouse_left);
fflag(integer(i <> h) * 30);
t := getsystemtime + 20000 + random(1000);
break;
end;
end;
result := (i = h);
end;
end;
procedure smart_bigbox(dots: tpointarray);
begin
smart_drawdotsex(false, dots, clwhite);
end;
function energy: boolean;
begin
result := findcolorspiraltolerance(x, y, 255, 736, 104, 761, 121, 10);
end;
function hpfull: boolean;
begin
result := findcolorspiraltolerance(x,y,198578,706, 21,711, 22,10);
end;
function waitinvfull(waitperloop, maxtime:integer): boolean;
var
t: integer;
begin
t := (getsystemtime + maxtime);
ftab(25);
while (getsystemtime < t) do
if invcount = 28 then
begin
result := true;
break;
end;
wait(waitperloop);
end;
function waitfindchat(txt: string; action: fnct_ActionOptions; waitperloop, maxtime: integer): boolean;
var
t, i: integer;
begin
result := findNPCChatTextMulti([txt], action);
t := (getsystemtime + maxtime);
while (getsystemtime < t) do
begin
marktime(i);
repeat
clickmouse2(true);
if timefrommark(i) > maxtime then
begin
result := false;
exit;
end;
until(result)
end;
end;
function waitbitmap(bitmap: integer; var x, y: integer; xs, ys, xe, ye: integer; tol: integer; waitperloop, maxtime:integer): boolean;
var
t: integer;
begin
t := (getsystemtime + maxtime);
while (getsystemtime < t) do
begin
if (findbitmaptolerancein(bitmap, x, y, xs, ys, xe, ye, tol)) then
begin
result := true;
break;
end;
wait(waitperloop);
end;
end;
function methodfinder(var x, y: integer; color, tol: integer; hmod, smod: extended; uptext: tstringarray): boolean;
var
b: tbox;
cts,i: integer;
tpa,pbox: tpointarray;
atpa: t2dpointarray;
begin
result := false;
cts := getcolortolerancespeed;
colortolerancespeed(2);
setcolorspeed2modifiers(hmod, smod);
findcolorsspiraltolerance(mscx, mscy, tpa, color, msx1, msy1, msx2, msy2, tol);
colortolerancespeed(cts);
if (length(tpa) < 1) then
exit;
tpa := cleartpafromtpa(tpa, pbox);
atpa := splittpaex(tpa, 30, 30);
sortatpafromfirstpoint(atpa, point(mscx, mscy));
for i := 0 to high(atpa) do
begin
b := gettpabounds(atpa[i]);
with b do
begin
if debug then
smart_bigbox(tpa);
if debug then
smart_debugatpa(false, atpa);
middletpaex(atpa[i], x, y);
mmouse(x, y, 5, 5);
if waituptextmulti(uptext, 500) then
begin
smart_clearcanvasarea(inttobox(1, 49, 547, 384));
result := true;
getmousepos(x, y);
exit;
end;
end;
end;
end;
procedure waitmoving(time: integer);
var
t: integer;
begin
marktime(t);
while (ismoving or flagpresent) and (timefrommark(t) < time) do
wait(50+random(100));
end;
function increasedxp(time:integer):boolean;
var
t, first, second:integer;
begin
first := getxpbartotal; {property of google}
marktime(t);
repeat
sixhourcheck;
wait(10);
second := getxpbartotal;
if timefrommark(t) > time then
begin
result := false;
exit;
end;
until(second > first);
result := true;
end;
function waitxpchange(time, min: integer): integer;
var
xp: array[0..1] of integer;
diff, t: integer;
begin
result := 0;
togglexpbar(true);
xp[0] := getxpbartotal;
marktime(t);
while (timefrommark(t) < time) do
begin
wait(100);
xp[1] := getxpbartotal;
diff := xp[1] - xp[0];
if (diff >= min) then
begin
result := diff;
exit;
end;
end;
end;
function hplevel: integer;
var
colourstring: string;
begin
result := getmmlevels('hp', colourstring);
end;
procedure walkback;
label
start;
begin
start:
if debug then
writeln('script is starting up walking back to bank');
if sps_walkline(walk) then
status := 'walking to the bank'
else begin
status :='failed walking to bank';
writeln(status + ' + time running:' +timerunning);
if sixhourcheck then
goto start;
end;
writeln(status + ' + time running:' +timerunning);
end;
procedure walkthere;
label
start;
begin
start:
if debug then
writeln('walking to the altar');
if sps_walkline(altar) then
status := 'walking to the altar'
else begin
status :='failed walking to altar';
writeln(status + ' + time running:' +timerunning);
if sixhourcheck then
goto start;
end;
writeln(status + ' + time running:' +timerunning);
end;
procedure walkbank;
label
start;
begin
marktime(t);
repeat
sixhourcheck;
wait(10);
until(waitfinddtmex(summ, x, y, mmx1, mmy1, mmx2, mmy2, 50, 5000) or findsymbol(x, y, 'clothes shop')) or (findsymbol(x, y, 'bank')) or (timefrommark(t) > 10000)
if debug then
if finddtm(summ, x, y, mmx1, mmy1, mmx2, mmy2) then
writeln('we found the summoning icon, walking to bank');
if debug then
if findsymbol(x, y, 'bank') then
writeln('we found the bank icon, walking to bank');
if (timefrommark(t) > 10000) then
begin
start:
if debug then
writeln('10 seconds have gone by and we havent moved');
if debug then
writeln('going to attempt using the lodestone to get back to bank');
if waitfinddtmex(home, x, y, msx1, msy1, msx2, msy2, 50, 5000) then
mouse(x, y, 8, 8, mouse_left);
if waitfinddtmex(lunar, x, y, msx1, msy1, msx2, msy2, 50, 5000) then
mouse(x, y, 6, 6, mouse_left);
wait(randomrange(19000,20000));
if sps_walkline(lodestone) then
status := 'walking from lodestone to bank'
else
status := 'failed walking to bank from lodestone';
writeln(status + ' + time running:' +timerunning);
end else
writeln('teleporting was succesfull');
if sps_walkline(bank) then
status := 'walking to bank'
else begin
status :='failed walking to bank';
writeln(status + ' + time running:' +timerunning);
if sixhourcheck then
goto start;
end;
writeln(status + ' + time running:' +timerunning);
end;
procedure progressreport;
begin
runesperhour := round((runecount)/ (gettimerunning / 3600000.0));
essused := (runecount / 2);
essloss := (essused * essprice);
astralprofit := (runecount * astralprice)
profit := (astralprofit - essloss);
profitperhour := round((profit)/ (gettimerunning / 3600000.0));
writeln('(*-----------------------------*)');
writeln(' \ AstralRcRunner /');
writeln(' / '+scriptversion+' VERSION \');
Writeln('| TIME RUNNING:' + MsToTime(GetTimeRunning, Time_Bare) + ' |');
writeln('| RUNS DONE:' +inttostr(runs) +' |');
writeln('| ASTRALS MADE:' +inttostr(runecount) + ' |');
writeln('| ASTRALS/HOUR:' +inttostr(runesperhour) + ' |');
writeln('| PROFIT:' +inttostr(profit) + ' |');
writeln('| PROFIT/HOUR:' +inttostr(profitperhour) + ' |');
writeln('|______________________________|');
end;
procedure drawtextinfo;
var
//navbar: tpointarray;
rantime: extended;
loadingtime: integer;
tr, exp, ran, exph, prof, profh: string;
begin
//navbar := tpafrombox(inttobox(1, -50, 760, -5));
rantime := ((gettimerunning-loadingtime)/3600000.0);
tr := mstotime((gettimerunning-loadingtime), Time_Abbrev);;
ran := inttostr(runs);
exp := inttostr(runecount)
exph := inttostr(runesperhour)
prof := inttostr(profit);
profh := inttostr(profitperhour);
smartsetdebug(true);
//smart_drawdotsex(true, navbar, RGBtoColor(11, 16, 17));
smart_drawtextex(true, 0, -50, UpChars, 'TIMERUNING:', clwhite);
smart_drawtext(1, -39, UpChars, 'RUNS DONE:', clwhite);
smart_drawtext(1, -28, UpChars, 'ASTRAL CRAFTED:', clwhite);
smart_drawtext(1, -17, UpChars, 'ASTRALS PER HOUR:', clwhite);
smart_drawtext(170, -39, UpChars, 'GP MADE:', clwhite);
smart_drawtext(170, -28, UpChars, 'GP PER HOUR:', clwhite);
smart_drawtext(81, -50, UpChars, tr, clwhite);
smart_drawtext(72, -39, UpChars, ran, clwhite);
smart_drawtext(111, -28, UpChars, exp, clwhite);
smart_drawtext(120, -17, UpChars, exph, clwhite);
smart_drawtext(226, -39, UpChars, prof, clwhite);
smart_drawtext(250, -28, UpChars, profh, clwhite);
end;
function countastrals: integer;
begin
if findbitmaptolerancein(astral, x, y, mix1, miy1, mix2, miy2, 55) then
count := getamount(x, y);
result:= count;
end;
procedure dropvial;
begin
if findbitmaptolerancein(vial, x, y, mix1, miy1, mix2, miy2, 30) then
begin
if debug then
writeln('droping the vial');
mmouse(x,y,7,7);
clickmouse2(false);
waitoption('Drop',500);
end else
writeln('there was no vial to drop');
end;
procedure depositastrals;
begin
if findbitmaptolerancein(astral, x, y, mix1, miy1, mix2, miy2, 55) then
begin
if debug then
writeln('depositing the astrals');
if debug then
smart_drawcircle(false, point(x, y), 6, false, clwhite);
mmouse(x, y, 7, 7);
clickmouse2(false);
waitoption('Deposit-All',300);
end;
smart_clearcanvasarea(inttobox(536, 200, 730, 457));
end;
procedure boothscreen;
begin
if bankscreen then
exit;
sixhourcheck;
findspinticket;
if methodfinder(x, y, 5662320, 4, 0.12, 0.72, ['bank', 'booth', 'ooth', 'ank', 'bank booth']) then
begin
if debug then
writeln('we found the bank booth');
clickmouse2(true);
if debug then
smart_clearcanvasarea(inttobox(1, 49, 547, 384));
fflag(1);
marktime(t);
repeat
sixhourcheck;
if timefrommark(t) > 1000 then
break;
if bankscreen or pinscreen then
break;
until(false)
if (pinscreen) then
inpin(players[0] .pin);
end;
end;
procedure findaltar;
label
start;
begin
start:
if sixhourcheck then
walkthere;
if methodfinder(x, y, 8025208, 6, 0.47, 0.10, ['Altar','ltar','tar','Alt']) then
begin
if debug then
writeln('we found the altar');
clickmouse2(true);
if debug then
smart_clearcanvasarea(inttobox(1, 49, 547, 384));
if not didredclick then
goto start;
end else
goto start;
if debug then
writeln('crafting astrals');
fflag(1);
increasedxp(2000);
end;
procedure teleport;
begin
countastrals;
inc(runs);
incex(runecount, countastrals);
//wait(timetele);
actionkeychange('1',3000);
ftab(25);
{ if not increasedxp(1500) then
begin
if debug then
writeln('unsuccesfully teleported, trying again');
actionkey('1');
end; }
if clickcontinue(true, true) then
begin
writeln('the green button was found, blocking teleport');
clickcontinue(true, true);
end else
writeln('there was no green button found during teleport');
if debug then
progressreport;
if paint then
drawtextinfo;
end;
procedure takeessence;
begin
if FindDTM(ess, x, y, mix1, miy2, mix2, miy2) then
writeln('we found the essence');
wait(45 + random(15));
GetMousePos(x, y);
MMouse(x, y, 1, 1);
Mouse(x, y, 0, 0, false);
waitoption('All',1000);
Mouse(x, y, 0, 0, true);
end;
function giantdecay: boolean;
var
a : integer;
tpa : tpointarray;
atpa : t2dpointarray;
mp : tpoint;
tmpcts : integer;
box : tbox;
begin
tmpcts := getcolortolerancespeed;
colortolerancespeed(2);
setcolorspeed2modifiers(0.42, 0.08);
findcolorsspiraltolerance(mscx, mscy, tpa, 3356987, mix1, miy1, mix2, miy2, 10);
sorttpafrom(tpa, point(mscx, mscy));
atpa := tpatoatpaex(tpa, 20, 20);
for a := 0 to high(atpa) do
begin
mp := middletpa(atpa[a]);
box := inttobox((mp.x - 5), (mp.y - 5), (mp.x + 5), (mp.y + 5));
result := true;
end;
colortolerancespeed(tmpcts);
setcolorspeed2modifiers(0.2, 0.2);
end;
procedure clickdecay;
var
a, h: integer;
tpa : tpointarray;
atpa : t2dpointarray;
tmpcts : integer;
begin
if (bankscreen) then exit;
exitsquealoffortune;
tmpcts := getcolortolerancespeed;
colortolerancespeed(2);
setcolorspeed2modifiers(0.41, 0.12);
findcolorsspiraltolerance(mscx, mscy, tpa, 2764337, mix1, miy1, mix2, miy2, 7);
atpa := tpatoatpaex(tpa, 20, 20);
sortatpasize(atpa,true);
h := high(atpa);
for a := 0 to h do
begin
middletpaex(atpa[a], x, y);
mmouse(x, y, 5, 5);
if (waituptextmulti(['pouch', 'ouch', 'pou', 'po', 'ch'], 1000)) then
begin
clickmouse2(true);
//result := true
//exit;
end;
end;
colortolerancespeed(tmpcts);
setcolorspeed2modifiers(0.2, 0.2);
end;
procedure repairpouches;
begin
boothscreen;
wait(575 + random(185));
deposit(2, 4, true);
deposit(6, 8, true);
if findbitmaptolerancein(air, x, y, msx1, msy1, msx2, msy2, 35) then
begin
if debug then
writeln('withdrawing 2 air runes');
if debug then
smart_drawcircle(false, point(x, y), 6, false, clwhite);
mmouse(x,y,7,7);
clickmouse2(true);
wait(355 + random(215));
clickmouse2(true);
if debug then
smart_clearcanvasarea(inttobox(1, 49, 547, 384));
end else
writeln('unable to find air runes, update bitmap');
if findbitmaptolerancein(cosmic, x, y, msx1, msy1, msx2, msy2, 65) then
begin {property of google}
if debug then
writeln('withdrawing 1 cosmic rune');
if debug then
smart_drawcircle(false, point(x, y), 6, false, clwhite);
mmouse(x,y,7,7);
clickmouse2(true);
wait(355 + random(215));
if debug then
smart_clearcanvasarea(inttobox(1, 49, 547, 384));
end else
writeln('unable to find the cosmic runes, update bitmap');
if findbitmaptolerancein(astral, x, y, msx1, msy1, msx2, msy2, 65) then
begin
if debug then
writeln('withdrawing 1 astral rune');
if debug then
smart_drawcircle(false, point(x, y), 6, false, clwhite);
mmouse(x,y,7,7);
clickmouse2(true);
if debug then
smart_clearcanvasarea(inttobox(1, 49, 547, 384));
wait(675 + random(65));
end;
closebank;
wait(355 + random(215));
if not waitfinddtmex(contact, x, y, msx1, msy1, msx2, msy2, 50, 5000) then
exit;
if waitfinddtmex(contact, x, y, msx1, msy1, msx2, msy2, 50, 5000) then
begin
if debug then
writeln('found the contact spell');
actionkey('2');
wait(355 + random(215));
end else
writeln('unable to find the contact spell, update dtm');
if waitcolor(489,200,526601,1,7000) then
begin
wait(randomrange(400,500));
if debug then
writeln('found black bar, sliding down');
mousebox(486, 191, 488, 201,1);
end;
wait(waittime);
if debug then
writeln('clicking on the dark mage');
mousebox(414,153,446,189,1);
ftab(25);
marktime(t);
repeat
sixhourcheck;
clickcontinue(true,true);
until(findnpcchattext('repair',clickleft)) or (timefrommark(t) > 20000)
marktime(t);
repeat
sixhourcheck;
wait(50+random(10));
until(clickcontinue(true,true)) or (timefrommark(t) > 10000)
boothscreen;
end;
function replacepouch: boolean;
begin
if waitinvfull(50, 3000) then
deposit(2, 4, true);
if debug then
writeln('replacing the massive pouch');
repeat
wait(1)
sixhourcheck;
until(invcount < 23)
if findbitmaptolerancein(mass, x, y, msx1, msy1, msx2, msy2, 35) or findbitmaptolerancein(new, x, y, msx1, msy1, msx2, msy2, 35) then
begin
if debug then
writeln('found the new massive pouch, withdrawing');
if debug then
smart_drawcircle(false, point(x, y), 6, false, clwhite);
mmouse(x, y, 7, 7);
clickmouse2(true);
if debug then
smart_clearcanvasarea(inttobox(4, 9, 504, 331));
end else
writeln('unable to find the new massive pouch, update bitmap');
takeessence;
if waitbitmap(mass, x, y, mix1, miy1, mix2, miy2, 35, 50, 3000) or waitbitmap(new, x, y, mix1, miy1, mix2, miy2, 35, 50, 3000) then
begin
if debug then
writeln('the new massive pouch has appeared in the inventory, filling');
mmouse(x, y, 7, 7);
clickmouse2(false);
waitoption('Fill', 600)
if debug then
smart_drawcircle(false, point(x, y), 6, false, clwhite);
end else
writeln('unable to find the new massive pouch in the inventory, update bitmap');
if findbitmaptolerancein(mass, x, y, mix1, miy1, mix2, miy2, 35) then
result := true;
end;
procedure fillpouches;
begin
if not bankscreen then
boothscreen;
if giantdecay then
repairpouches;
takeessence;
if findbitmaptolerancein(giant, x, y, mix1, miy1, mix2, miy2, 25) then
begin
if debug then
writeln('filling the giant pouch');
if debug then
smart_drawcircle(false, point(x, y), 6, false, clwhite);
mmouse(x, y, 6, 6);
clickmouse2(false);
waitoption('Fill',400);
end else
writeln('unable to find the giant pouch, update bitmap');
if debug then
smart_clearcanvasarea(inttobox(536, 200, 730, 457));
if not bankscreen then
boothscreen;
depositastrals;
takeessence;
if finddtm(large, x, y, mix1, miy1, mix2, miy2) then
begin
if debug then
writeln('filling the large pouch');
if debug then
smart_drawcircle(false, point(x, y), 6, false, clwhite);
mmouse(x, y, 6, 6);
clickmouse2(false);
waitoption('Fill',400);
end else
writeln('unable to find the large pouch, update dtm');
if debug then
smart_drawcircle(false, point(x, y), 6, false, clwhite);
if not bankscreen then
boothscreen;
if finddtm(medium, x, y, mix1, miy1, mix2, miy2) then
begin
if debug then
writeln('filling the medium pouch');
if debug then
smart_drawcircle(false, point(x, y), 6, false, clwhite);
mmouse(x, y, 6, 6);
clickmouse2(false);
waitoption('Fill',400);
end else
writeln('unable to find the medium pouch, update dtm');
if debug then
smart_drawcircle(false, point(x, y), 6, false, clwhite);
if finddtm(small, x, y, mix1, miy1, mix2, miy2) then
begin
if debug then
writeln('filling the small pouch');
if debug then
smart_drawcircle(false, point(x, y), 6, false, clwhite);
mmouse(x, y, 6, 6);
clickmouse2(false);
waitoption('Fill',400);
end else
writeln('unable to find the small pouch, update dtm');
if debug then
smart_clearcanvasarea(inttobox(536, 200, 730, 457));
takeessence;
if massive = false then
exit;
if massive = true then
begin
if not findbitmaptolerancein(mass, x, y, mix1, miy1, mix2, miy2, 35) then
begin
replacepouch;
end else
if waitbitmap(mass, x, y, mix1, miy1, mix2, miy2, 35, 50, 5000) then
begin
if debug then
writeln('filling the massive pouch');
if debug then
smart_drawcircle(false, point(x, y), 6, false, clwhite);
mmouse(x, y, 8, 8);
clickmouse2(false);
waitoption('Fill', 700);
end else
writeln('unable to find the massive pouch, update bitmap');
if debug then
smart_clearcanvasarea(inttobox(536, 200, 730, 457));
takeessence;
end;
end;
procedure drink;
label
start;
begin
start:
if bankscreen then
wait(150 + random(75));
boothscreen;
writeln('searching for the energy potion (3)');
marktime(t);
repeat
if not bankscreen then
boothscreen;
wait(10);
until(findbitmaptolerancein(pot, x, y, msx1, msy1, msx2, msy2, 35)) or (timefrommark(t) > 6000)
if (timefrommark(t) > 6000) then
begin
if not bankscreen then
writeln('we arent on the bankscreen, reopening it');
goto start;
end else
writeln('update the potion bitmap');
if findbitmaptolerancein(pot, x, y, msx1, msy1, msx2, msy2, 35) then
begin
if debug then
writeln('withdrawing the energy potion(3)');
mmouse(x, y, 6, 6);
clickmouse2(true);
end else
writeln('could not find the potion, update bitmap');
closebank;
if debug then
writeln('waiting for the potion to show up in the inventory');
repeat
sixhourcheck;
wait(10);
until(findbitmaptolerancein(pot, x, y, mix1, miy1, mix2, miy2, 35))
if debug then
writeln('finding the potion in the inventory');
if debug then
writeln('drinking the potion');
if findbitmaptolerancein(pot, x, y, mix1, miy1, mix2, miy2, 35) then
mmouse(x, y, 7, 7);
marktime(t);
repeat
sixhourcheck;
clickmouse2(true);
wait(2137 + random(379));
until(timefrommark(t) > 20000) or (isuptextmulticustom(['vial','ial','al']))
if findbitmaptolerancein(vial, x, y, mix1, miy1, mix2, miy2, 25) or (isuptextmulticustom(['vial','ial','al'])) then
begin
if debug then
writeln('dropping the empty vial');
mmouse(x, y, 6, 6);
clickmouse2(false);
waitoption('Drop',400);
end else
writeln('could not find the vial');
boothscreen;
end;
procedure eatfood;
begin
if debug then
writeln('searching for the food');
repeat
sixhourcheck;
wait(10);
until(findbitmaptolerancein(food.fooddtm, x, y, msx1, msy1, msx2, msy2, 55))
if findbitmaptolerancein(food.fooddtm, x, y, msx1, msy1, msx2, msy2, 55) then
begin
if debug then
writeln('withdrawing food');
mmouse(x, y, 8, 8);
clickmouse2(false);
waitoption('Withdraw-5',100);
end else
writeln('was unable to find the food, update bitmap');
if debug then
writeln('finding the food in the inventory');
repeat
sixhourcheck;
wait(10);
until(findbitmaptolerancein(food.fooddtm, x, y, mix1, miy1, mix2, miy2, 35))
repeat
sixhourcheck;
if findbitmaptolerancein(food.fooddtm, x, y,mix1, miy1, mix2, miy2, 35) then
begin
mmouse(x, y, 7, 7);
clickmouse2(false);
waitoption('Eat',200);
wait(randomrange(1700,2000));
end;
until(hpfull) or (not(findbitmaptolerancein(food.fooddtm, x, y, mix1, miy1, mix2, miy2, 35)))
if findbitmaptolerancein(food.fooddtm, x, y, mix1, miy1, mix2, miy2, 35) then
if hpfull then
writeln('we are full hp depositing food');
if findbitmaptolerancein(food.fooddtm, x, y, mix1, miy1, mix2, miy2, 35) then
begin
mmouse(x, y, 6, 6);
clickmouse2(false);
if waitoptionmulti(['Deposit-All', 'Deposit'], 200) then
writeln('deposited the food');
end;
end;
procedure summoning;
begin
end;
procedure handlegoods;
begin
if sixhourcheck then
walkbank;
dropvial;
boothscreen;
depositastrals;
if energy then
drink;
if hplevel < hpeat then
eatfood;
if bunyip = true then
summoning;
fillpouches;
end;
procedure dowork;
begin
fflag(1);
sixhourcheck;
findspinticket;
findaltar;
waitmoving(15000);
wait(waittime);
if giantdecay then
if findbitmaptolerancein(decay, x, y, mix1, miy1, mix2, miy2, 25) then
mouse(x, y, 6, 6, mouse_left);
if findbitmaptolerancein(giant, x, y, mix1, miy1, mix2, miy2, 35) then
begin
if debug then
writeln('emptying the giant pouch');
if debug then
smart_drawcircle(false, point(x, y), 6, false, clwhite);
mmouse(x, y, 6, 6);
clickmouse2(true);
end else
writeln('unable to find the giant pouch, update bitmap');
findaltar;
wait(waittime);
if finddtm(large, x, y, mix1, miy1, mix2, miy2) then
begin
if debug then
writeln('emptying the large pouch');
if debug then
smart_drawcircle(false, point(x, y), 6, false, clwhite);
mmouse(x, y, 6, 6);
clickmouse2(true);
end else
writeln('unable to find the large pouch, update dtm');
if finddtm(medium, x, y, mix1, miy1, mix2, miy2) then
begin
if debug then
writeln('emptying the medium pouch');
if debug then
smart_drawcircle(false, point(x, y), 6, false, clwhite);
mmouse(x, y, 6, 6);
clickmouse2(true);
end else
writeln('unable to find the medium pouch, update dtm');
if finddtm(small, x, y, mix1, miy1, mix2, miy2) then
begin
if debug then
writeln('emptying the small pouch');
if debug then
smart_drawcircle(false, point(x, y), 6, false, clwhite);
mmouse(x, y, 6, 6);
clickmouse2(true);
end else
writeln('unable to find the small pouch, update dtm');
findaltar;
wait(waittele);
findspinticket;
if massive = false then
teleport;
if massive = true then
begin
if findbitmaptolerancein(mass, x, y, mix1, miy1, mix2, miy2, 35) then
begin
if debug then
writeln('emptying the massive pouch');
if debug then
smart_drawcircle(false, point(x, y), 6, false, clwhite);
mmouse(x, y, 7, 7);
clickmouse2(true);
findaltar;
wait(waittele);
teleport;
end;
end;
end;
begin
cleardebug;
mapchecker;
if updatescript then
autoupdateme;
includes;
spsvariables;
setupsrl;
script;
sps_setup(runescape_other,['lunar']);
if debug then
sps_debug:= false;
declareplayers;
//loadfoodinfo;
loginplayer;
smartsetrefresh(35);
addonterminate('freescript');
mousespeed := 40;
clicknorth(srl_angle_high);
ftab(25);
findnormalrandoms;
smart_clearcanvas;
walkback;
repeat
sixhourcheck; handlegoods; sixhourcheck; walkthere; sixhourcheck; dowork; sixhourcheck; walkbank;
until(runs >= runstotal) or (allplayersinactive)
end.