Hello people of SRL.
I have been thinking on how to add antirandom of my pickaxe head falling off in oldschool RS.
So, how can I add the mining.simba's (from Simba>Includes>SRL-OSR>SRL>skill>mining)
to my script, and use the part FindPickAxe + Attach it back?
Here's my script code:
Simba Code:
program IronMiner;
{$DEFINE SMART}
{$i SRL-OSR/SRL.Simba}
{$i SPS/SPS-OSR.Simba}
{$i SRL-OSR/SRL/skill/mining.Simba}
Var
myPath:TPointArray;
Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; //Type in your login-name
Players[0].Pass := ''; //Password
Players[0].Nick := ''; //Your player name shown in-game. Not the first characters of words! eg. 'Bob' = 'ob'
Players[0].Pin := ''; //Bank PIN
Players[0].Active:=True; //Ignore this
end;
Procedure AxeHead;
Var
x, y: integer;
begin
If FindText (x, y, 'ou need a pickaxe', NPCCHARS, MCX1, MCY1, MCX2, MCY2) Then
end;
Function FindRandoms: Boolean;
begin
Result := FindNormalRandoms;
If FindNormalRandoms Then
Begin
Result := True;
End;
End;
procedure WalkToMine;
var
x, y: integer;
begin
SPS_Setup(RUNESCAPE_SURFACE,['12_7','11_6','11_7','11_8','12_8','13_8','13_7']);
myPath := [Point(4844, 2982), Point(4844, 2975), Point(4852, 2969),
Point(4865, 2967), Point(4876, 2967), Point(4888, 2968), Point(4902, 2968),
Point(4917, 2964), Point(4930, 2965), Point(4942, 2965), Point(4959, 2965),
Point(4971, 2977), Point(4976, 2991), Point(4982, 3011), Point(4976, 3025),
Point(4981, 3034), Point(4988, 3048), Point(4998, 3058), Point(4999, 3071),
Point(4996, 3083), Point(4993, 3095), Point(4996, 3105), Point(4998, 3122),
Point(4999, 3134), Point(5001, 3148), Point(5010, 3156), Point(5003, 3169),
Point(4994, 3181), Point(4988, 3187), Point(4978, 3189), Point(4973, 3198)];
SPS_WalkPath(myPath);
if FindSymbol (x, y, 'mining spot') then
MMouse(x, y, 2, 2);
ClickMouse2(mouse_left);
end;
procedure Bank;
begin
FindRandoms;
WriteLn('Banking Iron...');
OpenBank('veb', False, True) if BankScreen then
begin
Depositall;
CloseBank;
FindRandoms;
end;
end;
Procedure Antiban;
Begin
Case Random(100) Of
1: HoverSkill('mining', False); //replace 'magic' with 'skill'
2: FindRandoms;
3: Boredhuman;
4: Wait(2500 + random(4500));
6: PickUpMouse;
7: RandomMovement;
8: RandomRClick;
end;
end;
procedure MineIron;
var x, y: integer;
begin
Writeln('Mining...');
repeat;
if FindObj(x, y, 'ine', 2898784, 8) then
Mouse(x, y, 3, 3, true);
ChooseOption('ine');
FindRandoms;
Wait(2000+random(2500));
AntiBan;
until(InvFull)
end;
procedure WalkToBank;
var
x, y :integer;
begin
SPS_Setup(RUNESCAPE_SURFACE,['12_7','11_6','11_7','11_8','12_8','13_8','13_7']);
myPath := [Point(4972, 3190), Point(4986, 3181), Point(4999, 3171),
Point(5001, 3159), Point(5001, 3141), Point(4999, 3130), Point(4993, 3121),
Point(4993, 3113), Point(4990, 3101), Point(4990, 3092), Point(4997, 3085),
Point(4996, 3072), Point(4996, 3062), Point(4990, 3049), Point(4985, 3042),
Point(4979, 3029), Point(4975, 3015), Point(4981, 3004), Point(4973, 2994),
Point(4971, 2982), Point(4965, 2970), Point(4956, 2965), Point(4937, 2965),
Point(4925, 2968), Point(4912, 2968), Point(4902, 2964), Point(4887, 2969),
Point(4871, 2967), Point(4854, 2963), Point(4844, 2966), Point(4841, 2979),
Point(4839, 2994), Point(4844, 3003)];
SPS_WalkPath(myPath);
if FindSymbol(x, y, 'bank') then
MMouse (x, y, 0, 0);
ClickMouse2(mouse_left);
end;
begin
SetupSRL;
DeclarePlayers;
ActivateClient;
LoginPlayer;
SPS_Setup(RUNESCAPE_SURFACE,['12_7','11_6','11_7','11_8','12_8','13_8','13_7']);
repeat;
WalkToMine;
MineIron;
WalkToBank;
Bank;
until AllPlayersInactive;
end.
Oh, and if it's not possible, how can I apply this to my script the mining part:
Simba Code:
function FindPickHeadColor: Boolean;
var
Pick, ix, iy: Integer;
curTab: Byte;
begin
Result := False;
if (not LoggedIn) then exit;
Pick := DTMFromString('78DA63FCC2C4C0F09C910115302291409A899' +
'981E1310135FF8830870368CE4B026A78816A5EE3570300F6B206' +
'B0');
NoPick := True;
curTab := GetCurrentTab;
GameTab(tab_Inv);
if (FindDTM(Pick, ix, iy, MIX1, MIY1, MIX2, MIY2)) then
begin
NoPick := False;
Wielding := False;
EquipPick := False;
end else
begin
GameTab(tab_Equip);
if (FindDTM(Pick, ix, iy, MIX1, MIY1, MIX2, MIY2)) then
begin
NoPick := False;
Wielding := True;
EquipPick := False;
end;
end;
if (not NoPick) then
begin
Wait(100 + Random(100));
MMouse(ix, iy, 0, 0);
Hc1 := GetColor(ix + 1, iy);
Hc2 := GetColor(ix + 2, iy - 1);
Hc3 := GetColor(ix + 6, iy - 1);
Hc4 := GetColor(ix + 12, iy + 1);
Hc5 := GetColor(ix + 16, iy);
srl_Warn('FindPickHeadColor', 'PickColors = [' + IntToStr(hc1) + ', ' + IntToStr(hc2) + ', '
+ IntToStr(hc3) + ', ' + IntToStr(hc4) + ', ' + IntToStr(hc5)+'];', warn_Debug);
Result := True;
end;
FreeDTM(Pick);
GameTab(curTab);
end;
{*******************************************************************************
function FindPick: Boolean;
By: WT-Fakawi
Description: Finds and Attaches Pickhead.
*******************************************************************************}
function FindPick: Boolean;
var
c, XH, YH, dx, dy, ex, ey, x, y, cts: Integer;
EC: TBox;
begin // checks for Blue ClickToContinue, but doesnt handle ClickToContinue.
result := true;
if FindColor(x, y, 16711680, 182, 439, 346, 457) then
begin
if FindNPCChatText('Pickaxe', Nothing) then // check for word PickAxe
begin
if InvFull then // First make some space for PickAxeHead
begin
if (FindBitmapSpiralTolerance(Ore, x, y, MIx1, MIy1, MIx2, MIy2, 50)) then
begin
Mouse(x, y, 5, 5, False);
ChooseOption('Drop');
end;
end;
case Wielding of // switch to appropriate GameTab;
True:
begin
GameTab(tab_Equip);
EC.x1 := 570; EC.y1 := 287; EC.x2 := 603; EC.y2 := 320;
end;
False:
begin
GameTab(tab_Inv);
EC.x1 := MIx1; EC.y1 := MIy1; EC.x2 := MIx2; EC.y2 := MIy2;
end
end;
if FindBitmapMaskTolerance(BrokenPick, dx, dy, EC.x1, EC.y1, EC.x2, EC.y2, 10, 10) then
begin // Broken Pickaxe Handler
NoPick := True;
case Random(5) of
0: TypeSend('arg');
1: TypeSend('aarg');
2: TypeSend('arghh');
3: TypeSend('dam');
4: TypeSend('sjee.');
end;
Result := False;
Exit;
end;
if FindBitmapMaskTolerance(PickAxeHandle, dx, dy, EC.x1, EC.y1, EC.x2, EC.y2, 10, 10) then
begin // PickHead & Handle Handler
GameTab(tab_Inv);
repeat
if not (LoggedIn) then Exit;
x := Random(510) + 5;
y := Random(330) + 5;
cts := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
if (FindColorSpiralTolerance(x, y, hc1, MSx1, MSy1, MSx2, MSy2, 10)) or
(FindColorSpiralTolerance(x, y, hc2, MSx1, MSy1, MSx2, MSy2, 10)) or
(FindColorSpiralTolerance(x, y, hc3, MSx1, MSy1, MSx2, MSy2, 10)) or
(FindColorSpiralTolerance(x, y, hc4, MSx1, MSy1, MSx2, MSy2, 10)) or
(FindColorSpiralTolerance(x, y, hc5, MSx1, MSy1, MSx2, MSy2, 10)) then
begin
MMouse(x, y, 2, 2);
if IsUpTextMultiCustom(['Take', 'pick', 'head']) then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, True);
end;
FFlag(0);
Wait(1000 + Random(100));
end;
c := c + 1;
until ((FindBitmapMaskTolerance(PickAxeHead, x, y, MIx1, MIy1, MIx2, MIy2, 10, 10))
or (c >= 10));
ColorToleranceSpeed(cts);
if not FindBitmapMaskTolerance(PickAxeHead, x, y, MIx1, MIy1, MIx2, MIy2, 10, 10) then
begin
NoPick := True;
Result := False;
Exit;
end;
end;
// Attach
if Wielding then
begin
GameTab(tab_Equip);
if FindBitmapMaskTolerance(PickAxeHandle, Xh, Yh, 560, 280, 615, 322, 10, 10) then
begin
WriteLn('Found Handle');
Mouse(Xh + 5, Yh + 11, 2, 2, True); // remove the handle, if any.
end;
end;
Wait(500);
GameTab(tab_Inv);
Wait(500);
if FindBitmapMaskTolerance(PickAxeHead, dx, dy, MIx1, MIy1, MIx2, MIy2, 10, 10)
and FindBitmapMaskTolerance(PickAxeHandle, ex, ey, MIx1, MIy1, MIx2, MIy2, 10, 10) then
begin
Mouse(dx, dy, 0, 0, True);
Wait(1000 + Random(100));
Mouse(ex + 5, ey + 11, 2, 2, True);
// PickAxeAttached := PickAxeAttached + 1;
WriteLn('Attached Head & Handle');
NoPick := False;
Result := True;
if Wielding then
begin
Wait(3000);
if FindColor(dx, dy, hc1, MIx1, MIy1, MIx2, MIy2) then
Mouse(dx, dy, 0, 0, True);
end;
end;
end;
end;
end;
That would be my first script, so please don't judge me lol.
Thank you for any help.