Emarian
2021-01-18 10:44:18
How Long have You Played Runescape?
10 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
Not much most everything I know, I learned here on villavu
Are you a member of any other communities?
No. This is the only forum I've posted to in 10 years
Tell us about yourself…
Please show us one (or multiple) of your scripts.
10 Year(s)
Are you affilated in anyway with Jagex LTD?
No
Were you Referred to SRL?
What is your general programming knowledge?
Not much most everything I know, I learned here on villavu
Are you a member of any other communities?
No. This is the only forum I've posted to in 10 years
Tell us about yourself…
From: Emarian
I don't play often because I don't have much time in real life. I also don't work with computers in real life so this stuff is hard for me.
I quit for about 10 years but I've come back recently and I've been trying to learn. SRL is the only community that's open source and public. Kinda dead nowadays, but maybe we can change that?
I don't know much, but I'm trying. I just want to help make this site great again
Please show us one (or multiple) of your scripts.
I posted up most of what I have. I didn't post this one because it got me banned but this is the first complete one I wrote recently. I've learned alot more since, so I've been meaning to rewrite it and try again, but this one got to over 90 magic and smithing from a lvl3 before it got the hammer.
Below that is a basic NMZ script I wrote. I thought about submitting the mouseoverprayer function to the github. I asked about that in the discord!!
That's someone else's drink potion procedure. I was gonna write my own but I found that snippet that I had saved from somewhere and it was just too perfect. I also use slacky's progress report because his scripts are what made things finally start clicking for me. So for me seeing his progress report makes me happy
[SIMBA]program new;
{$define SMART} // need to adjust rsw and fill dtm
{$I SRL/OSR.simba}
{$I RSWalker/Walker.simba}
const
LOGIN_NAME = '';
LOGIN_PASS = '';
RS_WORLD = -1;
IS_MEMBER = true;
var
HeatSlot: Integer;
TimesDone: Integer;
TimesHeated: Integer;
MagicExp: Integer;
MiningExp: Integer;
SmithExp: Extended;
OreCounter: Integer;
OreCountExp: Integer;
RSW: TRSWalker;
var
GoldOre := DTMFromString('');
procedure declarePlayers();
begin
with Players.New()^ do
begin
LoginName := LOGIN_NAME;
Password := LOGIN_PASS;
IsActive := True;
IsMember := IS_MEMBER;
World := RS_WORLD;
end;
Players.SetCurrent(0);
end;
procedure goldWaitLoop();
var
InvCount, InvCount2 : Integer;
T: TTimeMarker;
begin
T.Start;
InvCount := Inventory.Count(GoldOre);
repeat
WaitEx(120,25);
InvCount2 := Inventory.Count(GoldOre);
if chatbox.FindTextOnLines(['here is currently'], [7]) then
Break;
until((InvCount2 > InvCount) or (T.GetTime > RandomRange(50000,100000)));
end;
procedure spellWaitLoop();
var
T: TTimeMarker;
begin
T.Start;
repeat
WaitEx(120,25);
until((Spells.IsOpen = true)) or (T.GetTime > RandomRange(5000,8000));
if not Spells.IsOpen then
Spells.Open;
end;
procedure invWaitLoop();
var
T: TTimeMarker;
begin
T.Start;
repeat
WaitEx(120,25);
until((Inventory.IsOpen = true)) or (T.GetTime > RandomRange(5000,8000));
if not Inventory.IsOpen then
Inventory.Open;
end;
procedure checkSpell();
var
T: TTimeMarker;
begin
T.Start;
if not MainScreen.IsUpText('uperheat') then
repeat
if not Spells.IsOpen then
Spells.Open;
Mouse.Move(IntToBox(620, 330, 720, 230));
WaitEx(120,25);
Spells.Cast(CAST_SUPERHEAT_ITEM);
until((MainScreen.IsUpText('uperheat') = true)) or (T.GetTime > RandomRange(20000,25000));
if not MainScreen.IsUpText('uperheat') then
begin
if not Spells.IsOpen then
Spells.Open;
WaitEx(120,25);
Spells.Cast(CAST_SUPERHEAT_ITEM);
end;
end;
procedure findGold;
var
TPA, Gold: TPointArray;
ATPA: T2DPointArray;
begin
SRL.DismissRandom();
if (SRL.FindColors(TPA, CTS2(3446440, 13, 0.02, 0.47), MainScreen.GetBounds) > 0) then
begin
ATPA := TPA.Cluster(3);
ATPA.FilterSize(550, 2100);
ATPA.SortByIndex(MainScreen.GetMiddle);
//Smart.Image.DebugATPA(ATPA);
for Gold in ATPA do
begin
WaitEx(300,150);
mouse.Move(TPA.Bounds);
//Mouse.Move(Gold[Random(Length(Gold))]);
if not MainScreen.IsUpText(['ocks']) then
Continue;
if MainScreen.IsUpText('ocks') then
begin
WaitEx(300,150);
if Mouse.Click(ctRed) then
begin
//Smart.Image.Clear;
Minimap.WaitPlayerMoving();
goldWaitLoop();
if chatbox.FindTextOnLines(['ou manage to'], [7]) then
inc(OreCounter);
Break;
end;
end;
end;
end;
//Smart.Image.Clear;
end;
procedure superheatGold;
begin
Spells.Open();
writeln('About to try and heat '+IntToStr(OreCounter)+' ores');
repeat
if TimesHeated = OreCounter then
Break;
SRL.DismissRandom();
spellWaitLoop();
Spells.Cast(CAST_SUPERHEAT_ITEM);
checkSpell();
invWaitLoop();
Inventory.MouseSlot(HeatSlot);
WaitEx(200,50);
if not MainScreen.IsUpText('old') then
begin
repeat
WaitEx(800,250);
HeatSlot := HeatSlot - 1;
Inventory.MouseSlot(HeatSlot);
WaitEx(800,250);
until (MainScreen.IsUpText('old') = true);
end;
if MainScreen.IsUpText('bar') then
begin
Mouse.Click(mouse_Left);
spellWaitLoop();
Break;
end;
if MainScreen.IsUpText(['uperheat', 'ore']) then
begin
Mouse.Click(mouse_Left);
spellWaitLoop();
Inc(TimesHeated);
end;
until(TimesHeated = 40);
Inventory.Open();
invWaitLoop();
end;
begin
//Smart.EnableDrawing := True;
SRL.Setup([]);
clearDebug();
declarePlayers();
RSW.Init('world.png');
Inventory.ShiftDrop := True;
WaitEx(750,200);
writeln('Starting GoldMHD!');
repeat
if (not SRL.isLoggedIn) then
begin
Players.LoginCurrent();
WaitEx(750,200);
MainScreen.setAngle(True);
WaitEx(750,200);
end;
if RSW.GetMyPos.DistanceTo([1802, 2416]) > 10 then
RSW.WebWalk(Point(1802, 2416),5)
repeat
if Inventory.IsFull() then
Break;
findGold(); // Look for gold rocks
until(Inventory.isFull());
HeatSlot := 24;
superheatGold(); // Start superheating process
TimesHeated := 0;
OreCountExp:= OreCountExp + OreCounter;
OreCounter := 0;
WaitEx(350,100);
Inventory.DropItemsExcept([25..27], Inventory.ErrorPattern(DROP_PATTERN_SNAKE));
Inc(TimesDone);
writeln('We have finished '+IntToStr(TimesDone)+' load(s) in '+SRL.TimeRunning());
writeln('Out of a total of '+IntToStr(OreCountExp)+' gold, we have gained:');
MagicExp := OreCountExp*53;
MiningExp := OreCountExp*65;
SmithExp := OreCountExp*56.2;
writeln(IntToStr(MagicExp)+' Magic experience');
writeln(IntToStr(MiningExp)+' Mining experience');
writeln(FloatToStr(Round(SmithExp))+' Smithing experience');
until(TimesDone = 98); // Roughly 5 hours
RSW.Free();
FreeDTMs([GoldOre]);
end.program new;
{$I SRL/OSR.simba}
{$H-}
var
ms, StatsDebugTick: Int64;
clicks: Integer;
var
DTM_OVERLOAD := DTMFromString('mWAAAAHicY2FgYNjPxMBwEIi3AfEpID7ByMCwDoiPQbEQHx9QFSMSJgwAsvsGRA==');
DTM_ROCKCAKE := DTMFromString('mggAAAHicY2NgYHBiYmCwBWI/IPYAYgsgNgXiF0C5O0D8BIg/APFbIH4ExMWZvkCSEQNzMZADAAZMCDQ=');
DTM_ABSORPTION := DTMFromString('mWAAAAHicY2FgYNjPxMBwEIi3AfEpID7ByMCwDoiPQfG2fUeAqhjhmIuBMAAAHF4IWA==');
procedure TMouse.Click(Middle: TPoint; Radius, Button: Int32); override;
begin
if Mainscreen.IsUpText('Quick-prayers') then
Mouse.Click(mouse_Left) else
Self.Click(srl.RandomPoint(Middle, Radius), Button);
end;
function TRSMinimap.TogglePrayer(const Enable: Boolean): Boolean; override;
var t: TCountDown;
begin
if (Enable = Self.isPrayerEnabled()) then Exit(True);
with (Self.OrbInfo[Ord(MMOrbPrayer)]) do
begin
Mouse.Click(Middle, Radius, mouse_Left);
t.Init(Round(srl.TruncatedGauss(300, 1500)));
while (not t.IsFinished()) and (Self.isPrayerEnabled() <> Enable) do
WaitEx(50,10);
Result := Self.isPrayerEnabled() = Enable;
end;
end;
procedure MouseOverPrayer;
var
T: TTimeMarker;
begin
T.Start;
Mouse.Move(Point(555, 91), 13);
repeat
WaitEx(50,10);
if (T.GetTime > RandomRange(50000,60000)) then TerminateScript('Error while moving mouse to minimap prayer orb');
until (Mainscreen.IsUpText('Quick-prayers'));
end;
procedure Process();
begin
if GetTickCount() - StatsDebugTick > 1000 then
begin
ClearDebug();
ms:= GetTimeRunning;
ClearDebug();
WriteLn('+---| STATS |----------------------------------------');
WriteLn('|- Script Runtime : ', SRL.MsToTime(GetTimeRunning, Time_Short));
WriteLn('|- Clicks Performed : ', IntToStr(clicks));
WriteLn('+----------------------------------------------------');
StatsDebugTick := GetTickCount();
end;
end;
function DrinkPotion(DTM, Doses: Integer): boolean;
var
Slots: TIntegerArray;
i, c: Integer = 0;
T: TTimeMarker;
begin
Slots := Inventory.FindDTM(DTM);
if Slots.Len = 0 then
Exit(False);
for i := 0 to Doses - 1 do
begin
if Inventory.IsSlotUsed(Slots[c]) then
begin
T.Start();
repeat
Inventory.MouseSlot(Slots[c], mouse_left);
Wait(150,300, wdLeft);
until (T.GetTime > 50000) or Mainscreen.IsUpText(['Drink']);
mouse.Click(mouse_left);
Wait(150,1000, wdRight);
end
else
c += 1;
if (c - 1) > Slots.Len then
Exit(False);
end;
Result := True;
MouseOverPrayer;
end;
procedure Guzzle();
var
findcake: TIntArray;
cakeslot: Integer;
T: TTimeMarker;
begin
Wait(150,1000, wdLeft);
findcake := Inventory.FindDTM(DTM_ROCKCAKE);
if (findcake = []) then TerminateScript('Rock cake not detected');
cakeslot := findcake[0];
while (Minimap.GetHPLevel > 1) do
begin
T.Start();
Inventory.MouseSlot(cakeslot);
if Mainscreen.IsUpText('Dwarven', 1000) then
ChooseOption.Select('Guzzle') else
TerminateScript('That was not a rockcake we just found');
Wait(150,1000, wdLeft);
if (T.GetTime > 60000) then TerminateScript('Unknown error while guzzling rock cake');
end;
MouseOverPrayer;
end;
procedure ClickPrayer;
var
x, y: Integer;
begin
Minimap.TogglePrayer(True);
Minimap.TogglePrayer(False);
while findColorTolerance(x, y, 14745568, 382, 277, 510, 332, 35) do // runelite
begin
inc(clicks);
Process();
Wait(8000,54000, wdRight);
Minimap.TogglePrayer(True);
Minimap.TogglePrayer(False);
//if Minimap.GetHPLevel > 50 then DrinkPotion(DTM_OVERLOAD, 1); // overload mode
if (Minimap.GetHPLevel > 1) then Guzzle;
if findColorTolerance(x, y, 2228192, 9, 298, 43, 333, 35) then DrinkPotion(DTM_ABSORPTION, Round(srl.NormalRange(10, 14)))
end;
writeln('Runelite menu not detected');
end;
begin
srl.Setup([]);
ClearDebug;
if not Inventory.IsOpen then
Inventory.Open;
ClickPrayer;
FreeDTM(DTM_OVERLOAD);
FreeDTM(DTM_ROCKCAKE);
FreeDTM(DTM_ABSORPTION);
end.