SRL Archive - OSR Help

Client dimention percent used as coordinates


Im4everlast

2010-11-26 21:24:24

How would I get the clients dimensions, and use them as x%, y%?


Here is an example of what I'd like to do:

procedure Example;
begin
DTM := DTMFromString('DTMDTMDTMDTMDTM');
if(FindDTM(DTM, x,y, 0%,0%, 99%,45%))then //percent of the clients size
Writeln('DTM found')
else
Writeln('DTM not found');
end;
I would realy apreciate if someone would show me a woring example of the above code or something similar.

Thanks in advance :)

i luffs yeww

2010-11-26 21:29:00

GetClientDimensions(w, h) is useful. Returns the width and height as w and h.

You could do wPercent := w * 99 / w * 100; and hPercent := h * 45 / h * 100;. I think that'd work?

Method

2010-11-26 21:32:14

From: i luffs yeww
GetClientDimensions(w, h) is useful. Returns the width and height as w and h.

You could do wPercent := w * 99 / w * 100; and hPercent := h * 45 / h * 100;. I think that'd work?


That would effectively eliminate the w and h variables from the calculation. Something like this would work fine:

w * percent / 100
h * percent / 100

Im4everlast

2010-11-26 22:20:43

I'm having some trouble understanding where to put this would you be kind enough to make a simple script that uses that?

Da 0wner

2010-11-26 23:09:42

procedure Example;
var
w, h : integer;
begin
DTM := DTMFromString('DTMDTMDTMDTMDTM');
GetClientDimensions(w, h);
w := Floor(w * 99 / 100);
h := Floor(h * 45 / 100);
if(FindDTM(DTM, x, y, 0, 0, w, h))then //percent of the clients size
Writeln('DTM found')
else
Writeln('DTM not found');
end;

Im4everlast

2010-11-26 23:17:59

After being unable to understand that i just did this (before I saw the above post):p

program Percent;
{$i SRL\SRL.scar}

var
x, y : Integer;


procedure Example;
var
w, h : Integer;

begin
GetClientDimensions(w, h);
if(FindColor(x,y, 16667408, 0,0, w / 100 * 25, h / 100 * 18))then
Writeln('Color found')
else
Writeln('Color not found');
end;

begin
SetupSRL;
ClearDebug;
Example;
end.
Than you for the example Da 0wner!
I finaly understand it now :)

Da 0wner

2010-11-26 23:19:58

No problem. Did it work though? I'm a bit rusty :/.

Im4everlast

2010-11-26 23:28:14

Yes it works perfectly :)