SRL Archive - OSR Help

Need help solving this error!


Athylus

2013-08-13 20:12:20

[Error] (56:11): Duplicate identifier 'OPENBANK' at line 55
Compiling failed.

It's an error I keep getting on my script. Trying to open a bank so I can store my items in it. But it keeps on giving this error code.


function BankColors: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.02, 2.44);

if not (FindColorsTolerance(arP, 3563636, MSX1, MSY1, MSX2, MSY2, 5)) 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;
//Writeln('AutoColor = ' + IntToStr(arC));
Break;
end;

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

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

procedure OpenBank;
var x, y: integer;
begin
Repeat
If FindObj(x, y, 'ank', BankColors, 5) Then
ClickMouse(x, y, mouse_Left);
end
else
MakeCompass(randomrange(25, 35));
until(BankScreen)
end;

Sjoe

2013-08-13 20:19:27

Openbank is already a function name in the srl include, that's why u get a duplicate identifier error.

Just rename it to like for example: OpenDaBank :)

Athylus

2013-08-14 08:52:17

Ooooh cool! Thanks mate, I had no idea. hehe, nooby mistake (it's my first script).

Edit: Changed it to OpenDatBank. XD

It's all working now. Now I just have to make a walking path. What is the recommended method for beginners and OSR, Radial or SPS?

Hoodz

2013-08-14 16:41:06

From: Athylus
Ooooh cool! Thanks mate, I had no idea. hehe, nooby mistake (it's my first script).

Edit: Changed it to OpenDatBank. XD

It's all working now. Now I just have to make a walking path. What is the recommended method for beginners and OSR, Radial or SPS?


reflection!

Athylus

2013-08-14 17:12:15

I've been told, but I don't get any of that. When I try SPS it won't even click anything, and with radialwalk it will click on the grass every 3rd step and crash.

I need some serious 1 on 1 help. o.O

Sjoe

2013-08-14 17:17:20

From: Athylus
I've been told, but I don't get any of that. When I try SPS it won't even click anything, and with radialwalk it will click on the grass every 3rd step and crash.

I need some serious 1 on 1 help. o.O


1) Download smart 8.2 for reflection

2) Put this in your script

function R_GetCameraYaw: Integer;
Begin
Result := SmartGetFieldInt(0, 'dq.fw') * -1896216087;
End;

function R_GetCompassAngle: extended; //your getdegrees func, just converted to rads
Begin
Result := R_GetCameraYaw / 5.67777;
End;

function R_GetTileGlobal: TPoint;
var
Me: Integer;
Begin
Me := SmartGetFieldObject(0, 'p.ho');
Result.X := (SmartGetFieldInt(0, 'd.cy') * 670470189) + (SmartGetFieldInt(Me, 'z') * -344898115) div 128;
Result.Y := (SmartGetFieldInt(0, 'r.cl') * -1567957809) + (SmartGetFieldInt(Me, 'v') * -331795885) div 128;
SmartFreeObject(Me);
End;

function R_TileToMM(tile: TPoint): TPoint;
var
angle, x, y: extended;
temp: TPoint;
begin
angle:= -Radians(R_GetCompassAngle);
temp := R_GetTileGlobal;
x:= (tile.x - temp.x) * 4 - 2;
y:= (temp.y - tile.y) * 4 - 2;
result.x:= round(x*cos(angle) + y*sin(angle)) + 645;
result.y:= round(y*cos(angle) - x*sin(angle)) + 85;
end;
//creds to Awkwardsaw
function R_WalkDaPath(path : TPointArray) : Boolean;
var
i, c, a: Integer;
tp, ntp : TPoint;
begin
RunEnergy(10 + Random(20));
Wait(100 + Random(300));
GameTab(Tab_inv);
for i := 0 to high(path) do
begin
tp := R_TileToMM(path[i]);
if i < high(path) then
begin
ntp := R_TileToMM(path[i + 1]);
if rs_OnMinimap(ntp) then
continue;
end;
if not rs_OnMinimap(tp) then
begin
writeln('tile not on map: ' + inttostr(i));
inc(a);
if a > 6 then FailSafe('Walking messed up, could be stuck in random: terminating script');
continue;
end;
if i = High(Path) then HumanMMouse(tp.x, tp.y, 1, 1)
else HumanMMouse(tp.x, tp.y, 2, 2);

Wait(60 + Random(30));
ClickMouse2(Mouse_left);
Wait(50 + Random(20));

if i < high(path) then
begin
ntp := R_TileToMM(path[i + 1]);
while not rs_OnMinimap(ntp) do
begin
ntp := R_TileToMM(path[i + 1]);
wait(100 + random(50));
inc(c);
if c > 300 then
begin
result := false;
exit;
end;
if not IsMoving then continue;
end;
end else
flag;
end;
result := true;
end;

3) use Writeln(R_GetTileGlobal) on tile you want to walk to for debugging.

Just like with sps u make a walkpath of the tiles u just gathered in chronological order ,

example taken from my flaxpicker:

procedure WalkToBank;
var
Path: TPointArray;
begin
if (not Loggedin) then Exit;

Path := [Point(2736, 3443), Point(2731, 3447), Point(2730, 3455), Point(2726, 3461), Point(2726, 3470), Point(2726, 3478), Point(2726, 3486), Point(2724, 3492)];

R_WalkDaPath(Path);
FFlag(1);
end;

Athylus

2013-08-15 08:51:59

Oooh cool! And those tile integers, u got them from using the SPS path generator and put in on reflection instead of SPS is my guess. Is that right?

Edit: I got. You are a fucking hero Sjoe!

Too bad this happened. XD
[Error] C:\Simba\Includes\SRL-OSR/SRL/misc/SmartParams.Simba(229:202): Invalid number of parameters at line 228

There's just always a problem

Athylus

2013-08-15 09:38:44

Fuck this I can't run any script, I'm getting the same error on everything now. I'm going to reinstall simba. Be right back with ya guys.

I lost all of my files, starting over now. It's like everything is working against me, but I'm not giving up.

No method was working for me so I'm using DTMs now for walking and it's working just great.
How I learnt it:
http://villavu.com/forum/showthread.php?t=77691
And this

Athylus

2013-08-19 12:09:06

Also, downloads don't work on that thread Sjoe.

Sjoe

2013-08-19 12:15:03

From: Athylus
Also, downloads don't work on that thread Sjoe.


Got skype? I'm bored, I'll teach ya how to do it.

Athylus

2013-08-19 13:00:09

Edit: Thanks a lot for all the help Sjoe!