SRL Archive - Reflection Help

Finding Current Tile position


Sags

2008-11-21 08:33:04

i am trying to find my current tile position but i keep getting errors when i try to run the script, it seems like a simple task but all i want to do is record the tile position i am standing in as i need to update it in a script im trying to get working. ive tried searching the forums and i found this bit of code

{.Include SRL\SRL\Misc\Smart.Scar}
{.Include SRL\SRL.Scar}
{.Include SRL\SRL\Reflection\Reflection.Scar}

Var
X, Y: Integer;

Begin
SmartSetupEX(110, True, True, False);
SetTargetDC(SmartGetDC);
SetupSRL;
//SetupReflection;
ActivateClient;
Wait(2000 + Random(500));
Repeat
If (IsFKeyDown(2)) Then
Begin
GetMyPos(X, Y);

WriteLn(IntToStr(X) + ', ' + IntToStr(Y));

While (IsFKeyDown(2)) Do
Wait(1);
End;
Until False;
End.

but i get this error Line 18: [Error] (18622:15): Invalid number of parameters in script C:\Program Files\SCAR 3.15\Scripts\get tile.scar
any ideas?

Kyle Undefined

2008-11-21 09:07:28

Try commenting out the include of reflection at the top. That *might* work. The repeat until sequence says to repeat until false, scar automatically sets it as false. So there might be some confusion on that end. Here is what I think will make it work.
{.Include SRL\SRL\Misc\Smart.Scar}
{.Include SRL\SRL.Scar}
//{.Include SRL\SRL\Reflection\Reflection.Scar}

Var
X, Y: Integer;

Begin
SmartSetupEX(110, True, True, False);
SetTargetDC(SmartGetDC);
SetupSRL;
//SetupReflection;
ActivateClient;
Wait(2000 + Random(500));
Repeat
If (IsFKeyDown(2)) Then
Begin
GetPos(X, Y); // I took out My in this line, if it still doesn't work try adding it
WriteLn(IntToStr(X) + ', ' + IntToStr(Y));
While (IsFKeyDown(2)) Do
Wait(1);
Result := True;
End;
Until True;
End.
Let me know if it works or not.

~Camo

Method

2008-11-21 09:23:42

Why would you comment out reflection? That's the only way any reflection function will work.

You're getting the error because GetMyPos returns a TPoint and doesn't accept any parameters. Assign a TPoint variable to it or call it directly in WriteLn to get it to work.

Gu3st...

2008-11-21 09:29:48

You could aslo use other bots who debugs the tile on-screen if you find it hard to do with srl.
RsBot for example.

Sags

2008-11-21 09:31:55

sorry im not sure on how to use TPoint, do you mean call it directly to WriteLN like

WriteLn(GetMyPos(X) + ', ' +  GetMyPos(Y));

because if so i still get invalid parameter errors

Method

2008-11-21 09:37:15

No, I don't mean call it like that. You still have to call GetMyPos on the WriteLn line (if you choose that option) to have it work.

If you don't do it that way, assigning a TPoint to it is the same as assigning any variable to anything.

Narcle

2008-11-21 09:52:35

Just show him ffs…

var M: TPoint;

M := GetMyPos;
WriteLn(IntToStr(M.X) + ', ' + IntToStr(M.Y));

0wn 4 skill

2008-11-25 13:30:51

{.Include SRL\SRL\Misc\Smart.Scar}
{.Include SRL\SRL.Scar}
{.Include SRL\SRL\Reflection\Reflection.Scar}

Begin
SmartSetupEX(110, True, True, False);
SetTargetDC(SmartGetDC);
SetupSRL;
Wait(2000 + Random(500));
Repeat
If (IsFKeyDown(2)) Then
Begin
GetMyPos;

WriteLn(IntToStr(GetMyPos.x) + ', ' + IntToStr(GetMyPos.y));

While (IsFKeyDown(2)) Do
Wait(1);
End;
Until False;
End.

That should work fine. Otherwise if you cba to find your tiles like that, use Summolions Path Finder. It works just fine :) Goodluck to you!

Kasi

2008-11-25 14:12:53

{.Include SRL\SRL\Misc\Smart.Scar}
{.Include SRL\SRL.Scar}
{.Include SRL\SRL\Reflection\Reflection.Scar}
Var
Me : TPoint;
Begin
SmartSetupEX(106, False, False, False);
SetTargetDC(SmartGetDC);
SetupSRL;
Wait(5000 + Random(5000));
Repeat
If (IsFKeyDown(2)) Then
Begin
Me := GetMyPos;

WriteLn(IntToStr(Me.x) + ', ' + IntToStr(Me.y));

While (IsFKeyDown(2)) Do
Wait(1);
End;
Until False;
End.

this is what i got
Edit : or just use path maker by sumillion (sorry if i spelt that rong)