Macrosoft
2008-05-27 18:46:07
Please go to the copy of this thread in the non-member area HERE
2008-05-27 18:46:07
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 Scriptprogram 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)
2008-05-27 18:57:26
2008-05-27 19:07:17
From: Macrosoft
so you mean take the flag check in the beginning out?
2008-05-27 19:20:44
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!
2008-05-27 19:37:32
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.
2008-05-27 21:04:21
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?
2008-05-27 21:37:26
2008-05-27 21:45:42
2008-05-27 22:24:18
2008-05-28 01:32:55
2008-05-28 15:24:56
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
2008-05-28 17:40:06
2008-05-28 20:17:34
From: Macrosoft
you still run the risk of item dots disappearing, and npc and player dots moving
2008-05-28 21:05:19
2008-05-28 21:42:54
From: Macrosoft
Dont worry about it. Its a good idea, mines just better :p
2008-05-28 22:38:18
2008-05-29 00:23:11
2008-05-29 01:11:11
2008-05-29 01:12:03
From: Macrosoft
Dont worry about it. Its a good idea, mines just better :p
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 ;)
2008-05-29 08:16:22
2008-05-29 18:32:12
2008-05-29 23:15:42
2008-05-29 23:20:33