Results 1 to 8 of 8

Thread: Client dimention percent used as coordinates

  1. #1
    Join Date
    Aug 2010
    Location
    Slovenia
    Posts
    52
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Client dimention percent used as coordinates

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


    Here is an example of what I'd like to do:
    Simba Code:
    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

  2. #2
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    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?

  3. #3
    Join Date
    Mar 2007
    Posts
    3,042
    Mentioned
    1 Post(s)
    Quoted
    14 Post(s)

    Default

    Quote Originally Posted by i luffs yeww View Post
    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
    :-)

  4. #4
    Join Date
    Aug 2010
    Location
    Slovenia
    Posts
    52
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

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

  5. #5
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    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;

  6. #6
    Join Date
    Aug 2010
    Location
    Slovenia
    Posts
    52
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    After being unable to understand that i just did this (before I saw the above post)
    Simba Code:
    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
    Last edited by Im4everlast; 11-27-2010 at 04:20 AM.

  7. #7
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

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

  8. #8
    Join Date
    Aug 2010
    Location
    Slovenia
    Posts
    52
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yes it works perfectly

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •