SRL Archive - OSR Help

Script won't do anything. Help ;/ (Iron Powerminer, first script)


Premix

2013-03-13 19:54:34

So I have been looking at Yohojo's video tuts to make a script. I made one powerminer for iron in Al Kharid. in other words, i did my best so far. Now I'm stuck as the script won't sign in the player, or search for colors. The only thing the script does is fixing camera angle and camera degrees. I'm very new to this, so I would like some advice and tips on how to improve this and how to make the script do something. xD
program PremixPowerminer;
{$i srl/srl.simba}
{$i P07Include.simba}

Procedure P07_DeclarePlayer;
Begin
P07_PlayerName:='';
P07_PlayerPass:='';
end;

Procedure AntiBan;
begin
if P07_LoggedIn then
begin;
case random(250) of
0: P07_HoverSkill('Mining', random(5000));
2: P07_MakeCameraAngleHigh;
3: P07_MakeCompassSouth;
5: P07_MakeCompassWest;
6: P07_DropInventorySlot(14);
7: P07_DropInventorySlot(22);
8: sleepandmovemouse(3000);
end;
end;
end;


function RockColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.10, 0.74);

if not (FindColorsTolerance(arP, 1713730, MSX1, MSY1, MSX2, MSY2, 11)) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
Result := arC[i];
//Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
//Writeln('AutoColor failed in finding the color.');
end;

function Mining;
var
x, y, PlusOne: integer;
begin
PlusOne:= InvCount + 1;
x:=MSCX;
y:=MSCY;
if FindObjTPA(x, y, RockColor, 5, 1, 50, 50, 250, ['Min']) then
begin
WriteLN('Found iron!');
GetMousePos(x, y);

case Random(2) Of
0: Mouse(x, y, 6, 6, True);
1: begin
Mouse(x, y, 6, 6, False);
WaitOption('Mine', 500);
end;
end;
if not FindObjTPA(x, y, RockColor, 5, 1, 50, 50, 250, ['Min']) then
WriteLn('Check colors.');

repeat
Antiban;
Wait(2000);
If InvCount=PlusOne then
WriteLn('Got one iron.');
until (InvCount=PlusOne);

end;
end;




begin;
ActivateClient;
SetupSRL;
SetupP07Include;
P07_DeclarePlayer;
P07_MakeCompassDegree(270);
P07_MakeCameraAnglehigh;
repeat
Mining;
until(not P07_LoggedIn);
TerminateScript;
end.

rj

2013-03-13 20:17:11

All I can say is check the colors -.- are you using a ACA generated function?

Iambubbleman

2013-03-13 20:18:55

Hi there!


program PremixPowerminer;
{$Define SMART8}
{$i srl/srl.simba}
{$i P07Include.simba}

procedure P07_DeclarePlayer;
begin
P07_PlayerName := '';
P07_PlayerPass := '';
end;

procedure AntiBan;
begin
if P07_LoggedIn then
begin
case random(250) of
0: P07_HoverSkill('Mining', random(5000));
2: P07_MakeCameraAngleHigh;
3: P07_MakeCompassSouth;
5: P07_MakeCompassWest;
6: P07_DropInventorySlot(14);
7: P07_DropInventorySlot(22);
8: sleepandmovemouse(3000);
end;
end;
end;

function RockColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.10, 0.74);
if not (FindColorsTolerance(arP, 1713730, MSX1, MSY1, MSX2, MSY2, 11)) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
Result := arC[i];
Break;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
end;

procedure Mining;
var
x, y, PlusOne: integer;
begin
PlusOne := InvCount + 1;
x := MSCX;
y := MSCY;
if FindObjTPA(x, y, RockColor, 5, 1, 50, 50, 250, ['Min']) then
begin
WriteLN('Found iron!');
GetMousePos(x, y);
case Random(2) of
0: Mouse(x, y, 6, 6, True);
1:
begin
Mouse(x, y, 6, 6, False);
WaitOption('Mine', 500);
end;
end;
if not FindObjTPA(x, y, RockColor, 5, 1, 50, 50, 250, ['Min']) then
WriteLn('Check colors.');
repeat
Antiban;
Wait(2000);
if InvCount = PlusOne then
WriteLn('Got one iron.');
until (InvCount = PlusOne);
end;
end;
begin
P07_DeclarePlayer;
ActivateClient;
SetupSRL;
SetupP07Include;
P07_LogInPlayer;
P07_MakeCompassDegree(270);
P07_MakeCameraAnglehigh;
repeat
Mining;
until (not P07_LoggedIn);
TerminateScript;
end.

Alright, let me quickly explain what I did.

First off, to solve your problem, I added P07_LogInPlayer; to your main loop to log in the users.

Second off, I changed your Function Mining; to Procedure Mining; as Mining; is being used to complete in game tasks.

Thirdly, I added SMART to your script, this simply acts as a client, and makes it so you can do things on your computer other than stare out a mouse clicking away on a Runescape client.
SMART for RS07 can be read about here:
http://villavu.com/forum/showthread.php?t=97599 (Simply the SMART portion at the Bottom)

I'm using Smart 8, you can simply take out the 8 to run tradition smart, but you must still make the modifications as stated on the link above to run the RS07 client.

Hope I helped! You appear to be off to a good start!

Premix

2013-03-14 02:10:12

RJJ95: I used ACA generated color. i followed Yohojo's ACA tutorial to try to not make any mistakes. The rocks were fully red, so it would be kind of weird if the colors were wrong :/

Iambubbleman: I was a bit confused if it was a function or a procedure, since Yohojo used a function to do almost the same code for a powerchopper. Still won't do the mining part, but you helped me make the script login the player :) I tried to add P07_LoginPlayer in the main loop before I posted. All it did was clicking the login button (didn't write anything at all).

Thanks for the quick replies <3