SRL Archive - SRL Archives

Walkingchecker


warship45

2006-09-25 15:08:28

hey, This small function allows you to check if the player is moveing if the player is moveing then it will return false if it is not moving it returns a true. I dont know all of the SRL procedures and functions that are made at the moment and as far as i could see by looking at the help files there is not a function out there that does this job however i may not be right about this so if there is i am sorry.

Function Walkingcheck: Boolean;
var
mouseposx,mouseposy,Flagpointer,timeroutvar: Integer;
begin
Flagpointer:= DTMFromString('78DA63DCCCC4C090CB8002628D05195280342' +
'310FF0702C675986AFE43694618BD11A8268B809AF5403539F8D5' +
'00005BB40C80');
For timeroutvar:=0 to 10 do
begin
if FindDTM(Flagpointer,mouseposx,mouseposy,mmx1,mmy1,mmx2,mmy2)=True then
begin
result:= True;
exit;
end;
wait(100);
end;
result:= False;
end;

Thanks for looking at my function

Yakman

2006-09-25 16:44:24

thats quite good,
i think you should put MMX1,MMY1,MMX2,MMY2, instead of the figures you put, the constants record the minimap edge points, (look in globals.scar), it stops the function becoming outdated if the boudrys change

you could probably do a similar thing with getcolors;

c:=getcolor(345,456)
wait(200)
if(c=getcolor(345,456))then
result:=false

but i think you way is better,

well done :D

warship45

2006-09-25 17:03:34

The color way does work however you have to put in about 2sec's gap in the the two color checkers and the other problem is some of the mini map colors are the same and it does not record that was the way i started to do it but it did not work lol.


thanks for your comments i have now changed the function to use mmx1 and mmx2 and so on

Yakman

2006-09-25 17:53:18

hmm try this, 50 different getcolors


var f,change:integer;c:array of integer;
begin
setarraylength(c,50)
for f:=0 to 49 do
c[f]:=getcolor(mmx1+f+10,mmy1+f+10)
wait(2000)
for f:=0 to 49
if(c[f]<>getcolor(mmx1+f+10,mmy1+f+100))then
change:=change+1
if(change<=25)then
result:=true//change by 50% or more
end;

heres another 1, but i think im just getting really off topic here, anyway this takes 2 screenshot and compairs the pixels

var shot1,shot2:tcanvas;x,y,change,bmp1,bmp2:integer;
begin
bmp1:=bitmapfromstring(mmx2-mmx1,mmy2-mmy1,'')
bmp2:=bitmapfromstring(mmx2-mmx1,mmy2-mmy1,'')
shot1:=getbitmapcanvas(bmp1)
shot2:=getbitmapcanvas(bmp2)
safecopycanvas(getclientcanvas,shot1,mmx1,mmy1,mmx2,mmy2,mmx1,mmy1,mmx2,mmy2)
wait(200)
safecopycanvas(getclientcanvas,shot2,mmx1,mmy1,mmx2,mmy2,mmx1,mmy1,mmx2,mmy2)
for x:=0 to mmx2-mmx1 do
for y:=0 to mmy2-mmy1 do
if(shot1.pixels[x,y]<>shot2.pixels[x,y])then
change:=change+1
if(change<=(mmx2-mmx1)*(mmy2-mmy1)/2)then
result:=true //less than 50% change
freebitmap(bmp1)
freebitmap(bmp2)
end.

(i still think your way is better :f: )

warship45

2006-09-25 17:56:02

lol so do i as the hold idea of programing is to get the job done as so it works 100% or as close to as possible. and my way gets the job done every time i have tryed it and is like much shorter than the way you showed but thanks for the other ways to do it they may come in handy when i cant think of a way to get somthing done.

p.s. i cna tell you are realy board lol

WhiteShadow

2006-09-25 23:07:44

CEWL.

Isn't this just basically FlagPresent though?

function iWalk(iW : Integer) : Boolean;
var
i, cW : Integer;
begin
cW:= Round(iW div 4)
for i:= 0 to 3 do
begin
if FlagPresent then
Result:= True;
Wait(cW);
end;
end;

warship45

2006-09-26 02:24:10

see i new there would be a function out there for it but i could not find it in the help files for SRL so i made by own lol. o well if there is already one then no need to worry about it i will get back to scripting my fisher now thanks for pointing that out.