Results 1 to 4 of 4

Thread: Dtm

  1. #1
    Join Date
    Jul 2007
    Posts
    42
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Dtm

    ok im trying to learn how to use dtms and i read a tutorial and this is what i got so far....

    SCAR Code:
    program New;
    //include SRL\SRL.scar
    var
      x, y: Integer;
      Lobster: Integer; //DTM

    begin;
    //start load
      Lobster := DTMFromString('78DA6314656060E067400165D1E60CBF80342' +
           '310FF0702464520838F010D302291409A1348B01350C302240409' +
           'A8E10212E204D4C8000931026A248104337E3500BE2106FA');
    //load ended. Use DTM now
      if FindDTM(Lobster, x, y, 100, 100, 250, 300) then //finds DTM
      begin
       Mouse(x, y, 1, 1, true);  //clicks DTM(SRL)
        WriteLn('Clicked Lobster.');
      end;
    end.

    but when i trye to run it i get....

    SCAR Code:
    Failed when compiling
    Line 15: [Error] (15:1): Unknown identifier 'Mouse' in script C:\Documents and Settings\Owner\Desktop\dtm.scar

    thanks in advanced

  2. #2
    Join Date
    Apr 2007
    Posts
    379
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok well you didn't "include" SRL right... you don't use normal comment marks
    SCAR Code:
    //include SRL\SRL.scar

    you use the big block comment marks

    SCAR Code:
    {.include SRL\SRL.scar}

    and right after the first { you need a .


    SCAR Code:
    program New;
    {.include SRL\SRL.scar }

    var
      x, y: Integer;
      Lobster: Integer; //DTM

    begin;
    //start load
      Lobster := DTMFromString('78DA6314656060E067400165D1E60CBF80342' +
           '310FF0702464520838F010D302291409A1348B01350C302240409' +
           'A8E10212E204D4C8000931026A248104337E3500BE2106FA');
    //load ended. Use DTM now
      if FindDTM(Lobster, x, y, 100, 100, 250, 300) then //finds DTM
      begin
        Mouse(x, y, 1, 1, true);  //clicks DTM(SRL)
        WriteLn('Clicked Lobster.');
      end else
       begin
         WriteLn('Didnt find Lobster');
       end;
    end.

    Also for good practice I recommened you add an end else thing in there like above.

    And your standards where slightly off, 2 spaces after a begin. Even if you have a long line of things to do.

    Also And You should just get into the habbit of seperrating the things into procedures and the main loop.

    SCAR Code:
    program New;
    {.include SRL\SRL.scar }
    var
      x, y: Integer;
      Lobster: Integer; //DTM
    procedure LoadDTM;
     begin
    //start load
      Lobster := DTMFromString('78DA6314656060E067400165D1E60CBF80342' +
           '310FF0702464520838F010D302291409A1348B01350C302240409' +
           'A8E10212E204D4C8000931026A248104337E3500BE2106FA');
     end;
    //load ended. Use DTM now

    procedure ClickDTM;
    begin
     if FindDTM(Lobster, x, y, 100, 100, 250, 300) then //finds DTM
      begin
        Mouse(x, y, 1, 1, true);  //clicks DTM(SRL)
        WriteLn('Clicked Lobster.');
      end else
       begin
         WriteLn('Didnt find Lobster');
       end;
     end;

    Begin
     SetupSRL;
     LoadDTM;
     ClickDTM;
    end.

    You should free the DTM/bitmap from memory by using FreeDTM(DTMName) and FreeBitmap(BMPName), respetivly.

  3. #3
    Join Date
    Jul 2007
    Posts
    42
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ok...it compiled but it didnt click on the image at all.

  4. #4
    Join Date
    Apr 2007
    Posts
    379
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    What do you mean? Did you use the cross hair, and did you Use activate client?

    SCAR Code:
    program New;
    {.include SRL\SRL.scar }
    var
      x, y: Integer;
      Lobster: Integer; //DTM
    procedure LoadDTM;
     begin
    //start load
      Lobster := DTMFromString('78DA6314656060E067400165D1E60CBF80342' +
           '310FF0702464520838F010D302291409A1348B01350C302240409' +
           'A8E10212E204D4C8000931026A248104337E3500BE2106FA');
     end;
    //load ended. Use DTM now
     
    procedure ClickDTM;
    begin
     if FindDTM(Lobster, x, y, 100, 100, 250, 300) then //finds DTM
      begin
        Mouse(x, y, 1, 1, true);  //clicks DTM(SRL)
        WriteLn('Clicked Lobster.');
      end else
       begin
         WriteLn('Didnt find Lobster');
       end;
     end;
     
    Begin
     SetupSRL;
     ActivateClient; //This makes the thing you selected the top screen
     LoadDTM;
     ClickDTM;
    end.

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
  •