Results 1 to 7 of 7

Thread: Many questions DTM, If,then,else, Error

  1. #1
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default Many questions DTM, If,then,else, Error

    OK, more problems with my script. Im sure somebody could just do this in a day but I have been working for 3 days and have so many problems...
    I need someone to look at my script and tell me why I am getting this:
    SCAR Code:
    Line 32: [Error] (17693:1): 'BEGIN' expected in script C:\Program Files\SCAR 2.03\Scripts\DTMS\my first.scar
    And also tell me how to do this:
    SCAR Code:
    Procedure Buying;
     if (ArrowType = Bronze)then
      begin
       FindDTM(BrArrow,x,y,1, 1, 200, 200)
       Mouse(x, y, 2, 2, False);
       ChooseOption(x, y, '10');
       Wait(6000+random(300));
       Bought:= Bought + 10
      end;
     else
     end;
    end;
    I am trying to get it to do the following:
    If the user sets the const for ArrowType to Bronze, to find the DTM and click it, but if it is set to another type of arrow (right now iron) then to skip that and look for the iron DTM. I dont know how to do this unless I did it right. I cant tell if it is wrong because I am getting that other error and dont know how to fix it. Also, do I need the whole loading DTM thing?

  2. #2
    Join Date
    Aug 2006
    Posts
    24
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yeah..u need to declare DTM...

  3. #3
    Join Date
    Oct 2006
    Location
    Ontario,Canada
    Posts
    1,718
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    for the begin. try going in your main loop begin not begin;

  4. #4
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    Quote Originally Posted by XcanadamanX View Post
    for the begin. try going in your main loop begin not begin;
    ya but it says its in line 32 and my main thing is 47. I tried anyway and it didnt work, thanks anyway

  5. #5
    Join Date
    Oct 2006
    Location
    Ontario,Canada
    Posts
    1,718
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    now it compiles...i dont know what your trying to do with the buying proc.
    SCAR Code:
    {Credits: JAD, Markus, Yohojo8 (DTM), Jason2gs, and RScheater13 for letting me
    use his Feather buyer to start this}

    program Arrowbuyer;
    {.include SRL/SRL.scar}
    var BrArrow : Integer;
    Bought : Integer;
    IrArrow : Integer;
    const
    ArrowType=('Bronze'); //Type of arrow you want to buy
    Buying= 50; //How many you want to buy
    {--------------Writes a Progress Report------------------------------------}
    procedure Report;
    begin
      Writeln('[]========================================[]');
      Writeln('---------------->Progress Report<-----------');
      Writeln('  Bought ' + IntToStr(Bought) + 'Arrows ' + '        ');
      Writeln('[]========================================[]');
    end;

    procedure LoadDTMS;
     begin
     Writeln ('Loading DTMs')
     BrArrow:= DTMFromString('78DA631467606090634001D922BC0CFF81342' +
           '310FF07024605204392010D302291405A1048881250C309241409' +
           'A801C9F3105003728B327E350096CF06C0');
     IrArrow:= DTMFromString('78DA630C616060B06640013161610C3A8C0C0' +
           'C40C4F01F0818BD818C000634C0C820C9005103E6B9020927026A' +
           'A281843901357E40C28C801A4720E143404D1090F0C2AF0600EE3' +
           'D09CC');
     Writeln ('Done loading DTMs')
    end;


    Procedure Buying1;
    Begin
     if (ArrowType = 'Bronze')then
      begin
       FindDTM(BrArrow,x,y,1, 1, 200, 200)
       Mouse(x, y, 2, 2, False);
       ChooseOption(x, y, '10');
       Wait(6000+random(300));
       Bought:= Bought + 10
      end
     else
     end;
    {------------Main Loop-----------------------------------------------------}
    begin;
    SetupSRL;
    repeat
     if FindDTM(BrArrow,x,y,1, 1, 200, 200) Then
     Begin
       Mouse(x, y, 2, 2, False);
       ChooseOption(x, y, '10');
       Wait(6000+random(300));
       Bought:= Bought + 10
     End;
    until(Bought = Buying);
    Report;
    end.

  6. #6
    Join Date
    Dec 2006
    Location
    Third rock from the sun.
    Posts
    2,510
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Yes, you must declare the DTM/Btmap as a variable.

    The reason for your "BEGIN" error, is because you threw an extra END; in there on line 32. Just rip it right out.

    And the name of your procedure "Buying" is duplicated. Just rename it something else.

    Also, in "If(ArrowType = Bronze)then" You have to mark the arrow type as a string.

    At the end of that procedure, you want the procedure to stop if the user declares any other arrow type.

    You seem to have messed that up, however. Lemme post the corrected procedure.

    SCAR Code:
    Procedure Buying; // Rename this something else
    begin

     if(Not(ArrowType = 'Bronze'))then  // With the apostrophes around it
      Begin                             // It's a "string"
       Exit;        // Make note of how this command is set up
      End           // It's important to get it right
     else           // It's very confusing at first

     if (ArrowType = 'Bronze')then
      begin
       FindDTM(BrArrow,x,y,1, 1, 200, 200)
       Mouse(x, y, 2, 2, False);
       ChooseOption(x, y, '10');
       Wait(6000+random(300));
       Bought:= Bought + 10
      end;
    end;

  7. #7
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    Quote Originally Posted by Jason2gs View Post
    Yes, you must declare the DTM/Btmap as a variable.

    The reason for your "BEGIN" error, is because you threw an extra END; in there on line 32. Just rip it right out.

    And the name of your procedure "Buying" is duplicated. Just rename it something else.

    Also, in "If(ArrowType = Bronze)then" You have to mark the arrow type as a string.

    At the end of that procedure, you want the procedure to stop if the user declares any other arrow type.

    You seem to have messed that up, however. Lemme post the corrected procedure.

    SCAR Code:
    Procedure Buying; // Rename this something else
    begin

     if(Not(ArrowType = 'Bronze'))then  // With the apostrophes around it
      Begin                             // It's a "string"
       Exit;        // Make note of how this command is set up
      End           // It's important to get it right
     else           // It's very confusing at first

     if (ArrowType = 'Bronze')then
      begin
       FindDTM(BrArrow,x,y,1, 1, 200, 200)
       Mouse(x, y, 2, 2, False);
       ChooseOption(x, y, '10');
       Wait(6000+random(300));
       Bought:= Bought + 10
      end;
    end;
    Ya i figured out the extra end and the buying thing on my own but I did not have a clue how to do the "if this person wants bronze, do this but if they want iron, dont do bronze and do this instead." Can I keep the same procedure and do iron too with the exact same format or do I have to add another procedure?

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. some questions
    By ShowerThoughts in forum OSR Help
    Replies: 2
    Last Post: 09-02-2007, 11:32 PM
  2. DTM questions
    By lefamaster in forum OSR Help
    Replies: 3
    Last Post: 03-22-2007, 03:55 PM
  3. Few Questions.
    By Hey321 in forum OSR Help
    Replies: 10
    Last Post: 12-03-2006, 05:02 PM

Posting Permissions

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