SRL Archive - SRL Archives

Check Movement- A better version of flag for more acurate walking


Macrosoft

2008-05-27 18:46:07

Please go to the copy of this thread in the non-member area HERE

Camaro'

2008-05-27 18:50:37

From: Macrosoft
You know how when you click on the other side of a fence, the character walks around it? Most of the time, this means the flag will not be visible! This function will check if your character is moving without using the flag. If it finds the flag however, you are for sure moving, so it takes the easy way out.

Result Explanation

This function will return one of the following:

0: An error occurred (very rare)
1: We are NOT moving
2: We ARE moving


The Script

program New;
{.include SRL/SRL.scar}

function ColorCheck(Color: Integer): Boolean;
var
Dots, W, H, x, y : Integer;
begin
Dots := BitmapFromString(17, 15, 'beNpjYPgPAwxEA2pp+W9' +
'm9o+HB1nkHxjgNASoXkHhDxvbS1T1QPDmzRusWoDmA9V/ZGA4h6oF' +
'qP7SpUs47GG8ycCwB8yAizx69Ojo0aNIIlh0Ycgy4lVPMmDn5mOgG' +
'fj3T/jfPz6S1P/5w/T1K8Pdu8RqAaoHordvGc6cId4eRqD5YPUkhS' +
'RxIQ8AaQdf5g==');
SetTargetBitmap(Dots);
GetBitmapSize(Dots, W, H);
if(FindColorTolerance(x, y, Color, 0, 0, W, H, 10)or(Color=65536))then Result:=False
else Result:=True;
FreeBitmap(Dots);
ResetDC;
end;

function FindGoodPoint(x1, y1, x2, y2: Integer; var Color: Integer):TPoint; //finds good coords, duh!
var
y, x: Integer;
begin
y:=y1-1;
repeat
begin
y:=y+1;
x:=x1;
repeat
begin
x:=x+1;
Result.x:=x;
Result.y:=y;
Color:=GetColor(x, y);
end;
until(ColorCheck(GetColor(x, y))or(x=x2+1));
end;
until((ColorCheck(GetColor(x, y)))or((y=y2)and(x=x2+1)));
if((y=y2)and(x=x2+1))then
begin
Result.x:=-1;
Result.y:=-1;
end;
end;

function CheckMovement: Integer;
var
RPoint: Tpoint;
RColor, i, Strikes: Integer;
NColor: Integer;
begin
if(FlagPresent=True)then
begin
Result:=2;
Exit;
end;
i:=0;
RPoint:=FindGoodPoint(570, 33, 683, 135, RColor);
if(RPoint.x=-1)then
begin
WriteLn('Error: Could not find referance point');
Result:=0;
Exit;
end;
Strikes:=0;
repeat
begin
Wait(500);
NColor:=GetColor(RPoint.x, RPoint.y);
if(ColorCheck(NColor))and(not(NColor= RColor))then //if color changes
begin
i:=i+1;
Strikes:=0;
RColor:=NColor;
end else
begin
i:=0;
Strikes:=Strikes+1;
end;
end;
until(i=3) or (Strikes=3);
if(i=3)then
begin
Result:=2;
WriteLn('We are moving!');
end else
begin
Result:=1;
WriteLn('We are not moving!');
end;
end;

begin
SetupSRL;
CheckMovement;
end.

Your move N1Ke, told ya so lol (Were having a little Teacher Student brawl)


I was going to post a better flag but decided not too :P..

But you should really add if its "caught" the flag..

Example.. If you click inside an area but then as ur walking to it the gate closes. The flag is " stuck" on the screen, there for making the player wait longer for the flag to go away which its not going to ;P:stirthepot:

Macrosoft

2008-05-27 18:57:26

so you mean take the flag check in the beginning out?

Camaro'

2008-05-27 19:07:17

From: Macrosoft
so you mean take the flag check in the beginning out?


well no.. have it so If moving = true then start a failsafe timer.. and if timefrommark(fs) > 45000 and moving>0 then moving = 0… if you dont get what im saying then forget it ..best i can explain it..

Macrosoft

2008-05-27 19:20:44

I get it now, so If its been moving for 45 seconds, somethings obviously wrong, so say that its not moving, or return that it did not reach it's destination.

Ill make another function that uses checkmovement to do this. Checkmovement is more like FlagPresent. Also, it order for this to work, I must remove the flagpresent shortcut in Checkmovement.

BTW, love ur sig, I WAS ACTUALLY QUOTED!

Camaro'

2008-05-27 19:22:47

From: Macrosoft
I get it now, so If its been moving for 45 seconds, somethings obviously wrong, so say that its not moving, or return that it did not reach it's destination.

Ill make another function that uses checkmovement to do this. Checkmovement is more like FlagPresent. Also, it order for this to work, I must remove the flagpresent shortcut in Checkmovement.

BTW, love ur sig, I WAS ACTUALLY QUOTED!


Lol glad you got it..

And i couldnt resist it, *Very nice*

Macrosoft

2008-05-27 19:37:32

lol, <3 borat

Ill get that new version function done if the SRL Members show a little more interest. I HAVE noticed the view to post ratio.

Camaro'

2008-05-27 20:35:31

From: Macrosoft
lol, <3 borat

Ill get that new version function done if the SRL Members show a little more interest. I HAVE noticed the view to post ratio.


Its ridiculous i agree. * You made a funny, a ha ha , a laugh laugh *

Macrosoft

2008-05-27 21:04:21

"This shirt is NOT black."
"Don't get hurt CJ!"
lol so many great moments

Any SRL Member want to do me the kind favor of POSTING FEEDBACK?

Camaro'

2008-05-27 21:22:27

From: Macrosoft
"This shirt is NOT black."
"Don't get hurt CJ!"
lol so many great moments

Any SRL Member want to do me the kind favor of POSTING FEEDBACK?


Agreed.. Love borat.. hey are you working on the new version?

Macrosoft

2008-05-27 21:37:26

Nope, I could do it in like 10 minutes, but unfortunately, I need to do hw unless I want to stay up to 1 a.m….again

Bobarkinator

2008-05-27 21:45:42

Me thinks a better way would be to grab the client canvas, wait 500 then grab it again, check differences. If greater than 150 pixels changed than you can probably say you are moving

Macrosoft

2008-05-27 22:24:18

No, what if the world is highly populated? I see what your saying, but I have so many failsafes that mine is pretty much flawless, even though it does seem a bit unreliable.

Naike

2008-05-28 01:32:55

Macrosoft my master ;)

Nice work :D

BUT!, About pwning me and my upcomming pestcontroll script wont just happend :)

Macrosoft

2008-05-28 15:24:56

We will see. We will see. The competition continues.

Nava2

2008-05-28 16:07:40

From: Bobarkinator
Me thinks a better way would be to grab the client canvas, wait 500 then grab it again, check differences. If greater than 150 pixels changed than you can probably say you are moving


Maybe a smaller number (250?), but that concept would work.

Nava2

Macrosoft

2008-05-28 17:40:06

you still run the risk of item dots disappearing, and npc and player dots moving

Nava2

2008-05-28 20:17:34

From: Macrosoft
you still run the risk of item dots disappearing, and npc and player dots moving


In that case; disregard the previous post :)

Nava2

Macrosoft

2008-05-28 21:05:19

Dont worry about it. Its a good idea, mines just better :p

Nava2

2008-05-28 21:42:54

From: Macrosoft
Dont worry about it. Its a good idea, mines just better :p


Pft… conceited much? :D

Jokes.

Also, this could be better then flag, and remove that shortcut you talked about. Because sometimes if the flag is there, and you are stuck. You can see it but you aren't close enough to stop trying to walk to it, it will log you out. If you keep the moving pixels then you will be able to tell if the character has stopped walking or not.

Nava2

Macrosoft

2008-05-28 22:38:18

fixed it. I love how so many people view the thread but do not post feedback.

Widget

2008-05-29 00:23:11

Lol, how about if you see the flag but realize you're stuck, click where the flag is to get you unstuck as well as unscrew up the walking in whatever script you're using :)

Macrosoft

2008-05-29 01:11:11

Nope, If you see the flag, clicking it again wont do you again as you are stuck and runescape is already trying to get you there. If you are stuck, you need something to open a gate etc.

ShowerThoughts

2008-05-29 01:12:03

From: Macrosoft
Dont worry about it. Its a good idea, mines just better :p


I'm not that sure about yours to either…
Also make it a random 45000 +random else it will always stop at 45000 secs if not found…

Also i think You can use better a flag with some waits if i got some time(5 mins) then i will create it ;)

Macrosoft

2008-05-29 01:23:07

From: Hermpie
I'm not that sure about yours to either…
Also make it a random 45000 +random else it will always stop at 45000 secs if not found…

Also i think You can use better a flag with some waits if i got some time(5 mins) then i will create it ;)


Im not sure what you mean, but I think a better version would be to have the user input the max time it should take. Ill fix that in the morning.

And my way is better, it avoids the colors of dots. I tested and it gets it right every time :)

Negaal

2008-05-29 08:16:22

Danrox2004 made something similar, worked vey well. This one could be more complex or something like that..doh my english sucks pretty hard.

Anyways I think you forgot blue player dot(the player wearing same teamcape).

Macrosoft

2008-05-29 18:32:12

Thanks, i did, and the green, but seriously, who autoes with a team cape?

itSchRis917

2008-05-29 23:15:42

I do all the time Macrosoft. :p Nice function, i've tested it out a few times and it works perfectly everytime. :)

Macrosoft

2008-05-29 23:20:33

thanks alot. Could a mod please lock this thread. I want the one in the free section to be the main one.