PDA

View Full Version : Reflect.Tiles.TiletoMS help.



theholyone1
05-16-2017, 08:23 PM
Hi there,
first off, WOW am I shocked at how easy it is to use reflection..I left simba mainly because I couldn't even get it to load ( ATM i'm still quite confused about how to load the smart drawing / debugging of everything but that's for another time )

Just a quick question in regards to the findNPC..

Here is my snippet

procedure talkToBanker;
var
banker:TReflectNPC;
point:TPoint;
begin
repeat
begin
banker.Find('Banker');
Point := Reflect.Tiles.TileToMs(banker.GetTile);
HumanMMouse(Point, 0, 0);
wait(random(50,100));
FastClick(MOUSE_RIGHT);
wait(random(300,400));
chooseOption('bank Banker');
wait(random(300,500));
end;
until isBankOpen;
end;


My question is, what this does is it finds the banker, but always moves the mouse a few pixels down before right clicking, is there anyway to stop that? I was sure that setting the ranX,ranY to 0 would stop it from moving..:confused:

Aspect
05-16-2017, 08:53 PM
Hi there,
first off, WOW am I shocked at how easy it is to use reflection..I left simba mainly because I couldn't even get it to load ( ATM i'm still quite confused about how to load the smart drawing / debugging of everything but that's for another time )

Just a quick question in regards to the findNPC..

Here is my snippet

procedure talkToBanker;
var
banker:TReflectNPC;
point:TPoint;
begin
repeat
begin
banker.Find('Banker');
Point := Reflect.Tiles.TileToMs(banker.GetTile);
HumanMMouse(Point, 0, 0);
wait(random(50,100));
FastClick(MOUSE_RIGHT);
wait(random(300,400));
chooseOption('bank Banker');
wait(random(300,500));
end;
until isBankOpen;
end;


My question is, what this does is it finds the banker, but always moves the mouse a few pixels down before right clicking, is there anyway to stop that? I was sure that setting the ranX,ranY to 0 would stop it from moving..:confused:

I think it's the FastClick function.
Try using
Reflect.Mouse.Click(Mouse_Right);
Because you're using reflection anyways.

Aspect
05-16-2017, 08:54 PM
I think it's the FastClick function.
Try using
Reflect.Mouse.Click(Mouse_Right);
Because you're using reflection anyways.
Reflect.Mouse.Move(Point, 0, 0) is what I meant.

theholyone1
05-16-2017, 09:02 PM
I think I've sort of found the problem,
the banker NPC doesn't move.

I'm using the same procedure for other NPCs that move and it works perfectly fine... for now i'm back to using colour for the banker, would still appreciate it if someone knowledgeable about this could clear this up..

Thanks!

edit: hmm.. seems it's doing the same thing with other npcs as well.. guess that wasn't the problem

Aspect
05-16-2017, 09:13 PM
I think I've sort of found the problem,
the banker NPC doesn't move.

I'm using the same procedure for other NPCs that move and it works perfectly fine... for now i'm back to using colour for the banker, would still appreciate it if someone knowledgeable about this could clear this up..

Thanks!

Did my solution not work for you?

theholyone1
05-16-2017, 09:40 PM
Did my solution not work for you?

Sorry stepped out for a bit, gave it a go, the same thing is happening, it'll move to NPC, then move down a few pixels before right clicking

Aspect
05-16-2017, 09:51 PM
Sorry stepped out for a bit, gave it a go, the same thing is happening, it'll move to NPC, then move down a few pixels before right clicking

If you are storing the point in a TPoint, then moving the mouse to that point with humanMMouse, it shouldn't matter if you are using "color" considering you are just moving your mouse to an x y cord and right clicking it. The only thing that would cause the mouse to move down a few pixels would be your mouse movement function, or (maybe) the click and shouldn't have anything to do with color. Perhaps there's an offset between the move mouse and click mouse function for some reason.

Aspect
05-16-2017, 10:10 PM
If it doesn't stop before moving downward, it could be returning a value below the banker. You could add/subtract a bit to the y value of the returned point. But this could be your client zoom settings as well. Tiles to MS can be a little wonky sometimes.

Example
Point.y := Point.y - 5:

theholyone1
05-16-2017, 10:34 PM
so far this is what I have

program scriptTemplate;
{$DEFINE SMART}
{$i AeroLib/AeroLib.Simba}
{$I RSWalker/Walker.simba}
{$i Reflection/Reflection.simba}

var
ReflectPlayer : TReflectLocalPlayer;
procedure startCooksAssist;
var
cook:TreflectNPC;
Point: TPoint;
begin
repeat
begin
cook.Find('Cook');
Point := Reflect.Tiles.TileToMs(cook.GetTile);
Reflect.Mouse.Move(Point, 0, 0);
wait(random(50,100));
Reflect.Mouse.Click(Mouse_right);
wait(random(400,600));
chooseOption('alk-to Cook');
end;
until TReflectionChat.NpcChatOpen;
end;

begin
initAL;
Reflect.Setup;
ClearDebug;
reflectPlayer.Create;

StartCooksAssist;

end.


it has stopped doing the weird down movement, just need to adjust it so it clicks the cook prooperly, ATM it clicks a little to the right so it misses,

will report back in an hour or so, heading out
(using colour for bank atm)

Aspect
05-16-2017, 10:45 PM
Most of my scripts use reflection is the reason I'm so about it. But I will mention that reflection has a built in walking and positioning system. If you just like RSWalker better that's fine though. But it would eliminate the need for another include or map.