Results 1 to 24 of 24

Thread: Help with my script.

  1. #1
    Join Date
    Jul 2007
    Location
    California
    Posts
    252
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Help with my script. (New Question!!!)

    I'm am writing my first script and I have some questions, so instead of starting a new thread for each one I will just put them all in this one, I hope thats ok.

    Fifth Question: I'm now getting and Syntax error.
    Line 144: [Error] (15232:1): Syntax error in script
    (The script is attached)

    [Solved]Forth Question: When I'm using the Timing Include in my script it pops open a new tab with the Timing Include and gives me this error.

    Line 18: [Error] (15048:10): Duplicate identifier 'THETIME' in script[/Solved]


    [Solved]Third Question: I'm getting another Identifier expected in script Error.


    [Solved]Second Question:I keep getting this error Line 14: [Error] (15088:1): Identifier expected in script.[/Solved]

    Here where the error is.(and I want to keep the repeat until in the procedure rather than the main loop.)[/solved]

    [Solved]First Question:I am trying to get it to click on a NPC but it only seems to work some of the time and if it does not find the NPC color it moves the mouse to the top left corner. (The NPC is the bartender in the bar in West Falador; my script is a beer buyer.)[/Solved]

  2. #2
    Join Date
    Apr 2007
    Location
    UK
    Posts
    2,295
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Find a color which is isolated to the bartender (try top of the head).

    Post what you got so far. Using scar tags

    Rogeruk's Al-Kharid Tanner V1.1 [Released]
    Rogeruk's Barbarian Crafter [Coming Soon]
    Rogeruk's Guild Fisher [Coming Soon]
    !! - Taking Requests - !!

  3. #3
    Join Date
    Jul 2007
    Location
    California
    Posts
    252
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    Procedure FindNpcSeller;
     var
      x: Integer;
      y: Integer;

     begin
       if(FindColor(x,y,1217429, MSX1, MSY1, MSX2, MSY2))then
        MMouse(x,y,0,0);
        wait(100+random(50));
       Mouse(x,y,0,0,True);
      end;

    That is the procedure that I'm using to find the Bartender.

  4. #4
    Join Date
    Apr 2007
    Location
    UK
    Posts
    2,295
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Try this..

    SCAR Code:
    procedure FindNpcSeller;
    var
      x: Integer;
      y: Integer;
    begin
      if (FindColorSpiralTolerance(x, y, 1217429, MSX1, MSY1, MSX2, MSY2,4)) then
      begin
        MMouse(x, y+2, 2, 2);
        wait(100 + Random(50));
        if(IsUpText('tender'))then
        begin
          GetMousePos(x,y);
          Mouse(x, y, 0, 0, true);
        end;
      end;
    end;

    When you move your mouse over the bartender, have a look what it says in the top left hand corner. eg, Talk-To etc, and replace 'tender' with whatever it says minus the first letter.. eg.. Talk becomes 'alk'.

    Fiddle around with the 4 at the end (tolerance).

    Problem with the mouse straying was because it didnt find the bartender, you were still clicking, but x and y had no value (so really 0), so it would click at 0,0. Using begin and ends solves this problem

    Rogeruk's Al-Kharid Tanner V1.1 [Released]
    Rogeruk's Barbarian Crafter [Coming Soon]
    Rogeruk's Guild Fisher [Coming Soon]
    !! - Taking Requests - !!

  5. #5
    Join Date
    Jul 2007
    Location
    California
    Posts
    252
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Alright thanks that helped a lot!!!

    I edited it a little because the color that you had wouldn't work if she was standing in a certain position.

    SCAR Code:
    procedure FindNpcSeller;
    var
      x: Integer;
      y: Integer;
    begin
      if (FindColorSpiralTolerance(x, y, 1758679, MSX1, MSY1, MSX2, MSY2,5)) then
      begin
        MMouse(x, y+random(4), 2, 2);
        wait(100 + Random(50));
        if(IsUpText('mily'))then
        begin
          GetMousePos(x,y);
          Mouse(x, y, 0, 0, true);
        end;
      end;
    end;

    Here it is if you want to see if it works ok.

    BTW another quick question how do you have it repeat until inventory is full and/or a certain number of times.(If you don't have the time to look this up, its ok I will look it up later, but I have to do some hw)

    And Thanks Again defiantly rep++

  6. #6
    Join Date
    Jul 2007
    Location
    California
    Posts
    252
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    New Question, Please help.

  7. #7
    Join Date
    Apr 2007
    Location
    Michigan -.-
    Posts
    1,357
    Mentioned
    2 Post(s)
    Quoted
    4 Post(s)

    Default

    You needed to switch that 'until' and the 'end;' around...

    like this:
    SCAR Code:
    procedure FindNpcSeller;
    var
      x: Integer;
      y: Integer;
    begin
      repeat
        if (FindColorSpiralTolerance(x, y, 1758679, MSX1, MSY1, MSX2, MSY2,5)) then
        begin
          MMouse(x, y+random(2), 1, 0);
          wait(10 + Random(50));
          if(IsUpText('mily'))then
          begin
            GetMousePos(x,y);
            Mouse(x, y, 0, 0, true);
          end;    //Needed to end the begins in the repeat loop before you end the repeat loop ;-)      
        end;
      until FindNPCChat('eya')
    end;
    METAL HEAD FOR LIFE!!!

  8. #8
    Join Date
    Jan 2007
    Location
    Kansas
    Posts
    3,760
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    SCAR Code:
    repeat
     FindNPCSeller;
     BuyBeer;
    until (InvFull)


  9. #9
    Join Date
    Jul 2007
    Location
    California
    Posts
    252
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Bobarkinator View Post
    SCAR Code:
    repeat
     FindNPCSeller;
     BuyBeer;
    until (InvFull)
    I already have that in the main loop but I want it to repeat the finding and clicking until it actually talks to the NPC (thats why I have FindNPCText). Because sometimes it will try to click on the NPC while she is walking and will miss, and wont try again until its done with trying to buy.

  10. #10
    Join Date
    Apr 2007
    Location
    Michigan -.-
    Posts
    1,357
    Mentioned
    2 Post(s)
    Quoted
    4 Post(s)

    Default

    SCAR Code:
    begin
      repeat
        FindNpcSeller;
      until(FindNPCChat('eya'));
    end.
    METAL HEAD FOR LIFE!!!

  11. #11
    Join Date
    Jul 2007
    Location
    California
    Posts
    252
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by gerauchert View Post
    SCAR Code:
    begin
      repeat
        FindNpcSeller;
      until(FindNPCChat('eya'));
    end.
    Alright Thank You that helps a little more but I would like to keep the repeat until in the procedure rather than the main loop. Can anyone tell me how do to that?

  12. #12
    Join Date
    Apr 2007
    Location
    UK
    Posts
    2,295
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    procedure FindNpcSeller;
    var
      x: Integer;
      y: Integer;
      found: Boolean;
    begin
      repeat
        if (FindColorSpiralTolerance(x, y, 1758679, MSX1, MSY1, MSX2, MSY2,5)) then
        begin
          MMouse(x, y+random(4), 2, 2);
          wait(100 + Random(50));
          if(IsUpText('mily'))then
          begin
            Found:=True;
            GetMousePos(x,y);
            Mouse(x, y, 0, 0, true);
          end;
        end;
      until(Found)
    end;

    Tried that?

    Rogeruk's Al-Kharid Tanner V1.1 [Released]
    Rogeruk's Barbarian Crafter [Coming Soon]
    Rogeruk's Guild Fisher [Coming Soon]
    !! - Taking Requests - !!

  13. #13
    Join Date
    Jul 2007
    Location
    California
    Posts
    252
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Omg. Im so sorry that I keep asking for help on my problem. I didn't see and read gerauchert's first post. That solved my error.

  14. #14
    Join Date
    Jul 2007
    Location
    California
    Posts
    252
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    New Question!!! Please help.

  15. #15
    Join Date
    Jun 2006
    Posts
    18
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    If I assumed correctly, I would write it like:

    SCAR Code:
    Procedure StartProgressReport;
    var
      Money: Integer;
      Beers: Integer;
      BeerNick: string;
      BeerName: string;
    begin
      Money:= Loads*28*3;
      Beers:= Loads*28
      case BeerType of
        1 : begin
              BeerNick := 'sgar';
              BeerName := 'Asgarnian Ale';
            end;
        2 : begin
              BeerNick := 'ind';
              BeerName := 'Mind Bomb';
            end;
        3 : begin
              BeerNick := 'warv';
              BeerName := 'Dwarven Stout';
            end;
      end;
      WriteLn('Type of beer being bought '+ BeerName)
      WriteLn('Beers being bought ' + IntToStr(Beers))
      WriteLn('Gp being spent ' + IntToStr(Money));
    end;

    You had an extra begin, and you also put BeerNick & BeerName as integers, when they should have been strings. I don't knowthe the identifier 'is' but I added a nice little case block, which is like: if the BeerType is 1, it changes the BeerNick to 'x' and the BeerName to 'x'.

    Good luck

  16. #16
    Join Date
    Jul 2007
    Location
    California
    Posts
    252
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yeah thats exactly what I wanted!!! I was sure if the "is" part was right either. But Thank You.

  17. #17
    Join Date
    Jul 2007
    Location
    California
    Posts
    252
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    One more question. Hopefully this will be my last and I can release my script tonight.

  18. #18
    Join Date
    Mar 2007
    Location
    Netherlands->Amersfoort.
    Posts
    1,615
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    program BeerBuyer;
    {.include SRL/SRL.scar}
    {=========================================================================]
    [                            Beer Buyer                                   ]
    [                                                                         ]
    [           NAME        : Beer Buyer.                                     ]
    [           WRITER      : Dudenow12                                       ]
    [           CATEGORY    : .....                                           ]
    [           DESCRIPTION : Buys Beer from the bar in west Falador.         ]
    [           USAGE       : Buys Beer for you.                              ]
    [           AUTOCOLOR   : No                                              ]
    [           CONTACT     : <a href="http://www.srl-forums.com" target="_blank">www.srl-forums.com</a> Dudenow12                    ]
    [                                                                         ]
    [                                                                         ]
    [=========================================================================]
    [                                                                         ]
    [=========================================================================]
    [                           Instructions.                                 ]
    [=========================================================================]
    [ 1. USE Runescape with Low Detail, Very Bright.                          ]
    [ 2. Set your Screen to 32 bit TRUE color.                                ]
    [ 3. Set Up 29-32                                                         ]
    [ 4. Go to West Falador.                                                  ]
    [ 5. Go to the Bank.                                                      ]
    [ 6. Start script!                                                        ]
    [=========================================================================}


    const//Set Up 29-32
      Loads = 3; //How many loads you want to do.
      BarFloorColor = 9284016; //Pick the color from the floor of the bar.
      BankFloorColor = 9284016;//Pick the color from the floor of the Bank.
      BeerType = 3;// 1 = Asgarnian Ale  2 = Mind Bomb  3 = Dwarven Stout


      Money2 = 28*3; //Dont edit!!!

    var//Global Variables
      Loadz: Integer;

    Procedure StartProgressReport;
    var
      Money: Integer;
      Beers: Integer;
      BeerNick: string;
      BeerName: string;
    begin
      Money:= Loads*27*3;
      Beers:= Loads*27
      case BeerType of
        1 : begin
              BeerNick := 'sgar';
              BeerName := 'Asgarnian Ale';
            end;
        2 : begin
              BeerNick := 'ind';
              BeerName := 'Mind Bomb';
            end;
        3 : begin
              BeerNick := 'warv';
              BeerName := 'Dwarven Stout';
            end;
      end;
      WriteLn('-------Start Proggie-------')
      WriteLn('Type of beer being bought '+ BeerName)
      WriteLn('Beers being bought ' + IntToStr(Beers))
      WriteLn('Gp being spent ' + IntToStr(Money))
      WriteLn('---Script By: Dudenow12---')
    end;

    procedure FindNpcSeller;
     var
      x: Integer;
      y: Integer;
     begin
      repeat
      if (FindColorSpiralTolerance(x, y, 1758679, MSX1, MSY1, MSX2, MSY2,5)) then
      begin
       MMouse(x, y+random(2), 1, 0);
       wait(10 + Random(50));
       if(IsUpText('mily'))then
       begin
        GetMousePos(x,y);
        Mouse(x, y, 0, 0, true);
        wait(500+random(50));
        PickUpMouse;
       end;
      end;
     until(FindNPCChatText('eya'))
    end;

    Procedure BuyStout;
     var
      BeerNick: string;
     begin
      ClickToContinue;
      wait(1000+random(100));
      ClickToContinue;
      wait(1000+random(75));
      ClickToContinue;
      wait(1000+random(50));
      ClickNpcChatText((BeerNick), true);
      wait(1000+random(100));
      ClickToContinue;
      wait(1000+random(100));
      ClickToContinue;
     end;


    Procedure Bank1;
     var
      Time: Integer;
     begin
      MarkTime(Time)
      repeat;
       if (not(Loggedin)) then  break;
       OpenBankQuiet('fwb')
      until(BankScreen or (TimeFromMark(Time) > 120000));
       Withdraw(1, 1, (Money2*3));
       wait(100+random(100));
       CloseBank;
     end;

     Procedure WalkToBar;
       begin;
        RadialWalk((BarFloorColor) , 59, 74, 45, 0, 0);
        Flag;
       end;

    Procedure WalkToBank;
       begin;
        RadialWalk((BankFloorColor) , 248, 53, 53, 0, 0);
        Flag;
       end;

    Procedure Bank2;
     var
      time: Integer;
     begin;
      MarkTime(time)
      repeat;
       if (not(Loggedin)) then  break;
       OpenBankQuiet('fwb')
      until(BankScreen or (TimeFromMark(time) > 120000));
       if BankScreen then
       begin;
        Deposit(2,28,2)
        Wait(100+random(50))
        CloseBank;
        Loadz:= Loadz + 1
      end;
     end;

    Procedure EndProgressReport;
     begin;
      WriteLn('-----End Proggie-----')
      WriteLn('Worked For' + TimeRunning)
      WriteLn(IntToStr(BeerType)+'bought'+ IntToStr(Loadz*27))
      WriteLn('---Script By: Dudenow12---')
     end;

    Begin
     SetupSrl;
      repeat;
      Cleardebug;
      StartProgressReport;
      Bank1;
      WalkToBar;
       repeat;
        FindNpcSeller;
        wait(100+random(50));
        BuyStout;
        wait(1000+random(750));
       until(InvFull);
      WalkToBank;
      Bank2;
      EndProgressReport;
      until(Loads = Loadz)
    end.

    all the files in ''core'' are already included to need to do that
    ScriptTime(2), have i changed to TimeRunning;

    all the other problems are solved i think

  19. #19
    Join Date
    Jul 2007
    Location
    California
    Posts
    252
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thank You! My Script is finished. But I will be updating and expanding it latter. Thank You everyone!!!

  20. #20
    Join Date
    Apr 2007
    Location
    UK
    Posts
    2,295
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Fix your standards

    Rogeruk's Al-Kharid Tanner V1.1 [Released]
    Rogeruk's Barbarian Crafter [Coming Soon]
    Rogeruk's Guild Fisher [Coming Soon]
    !! - Taking Requests - !!

  21. #21
    Join Date
    Jul 2007
    Location
    California
    Posts
    252
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I have another problem and I cant seem to fix it please help. And rogeruk are my standers better? Cause I tried to do it the same way you did it on my before.

  22. #22
    Join Date
    Jul 2007
    Location
    California
    Posts
    252
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Fixed old problem by my self. But created a new one

  23. #23
    Join Date
    Apr 2007
    Location
    UK
    Posts
    2,295
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You've done your case wrong. It has to be..

    SCAR Code:
    case BeerType of
    1: begin
          //MoreCode...
        end;
    2: begin
          //MoreCode...
        end;
    end;

    Correct with STANDARDS

    SCAR Code:
    procedure BuyStout;
    var
      BeerName: string;
    begin
      case BeerType of
        1:
          begin
            BeerName := 'Asgarnian Ale';
            ClickToContinue;
            wait(1000 + Random(100));
            ClickToContinue;
            wait(1000 + Random(75));
            ClickToContinue;
            wait(1000 + Random(50));
            ClickNpcChatText('asga', true);
            wait(1000 + Random(100));
            ClickToContinue;
            wait(1000 + Random(100));
            ClickToContinue;
          end;
        2:
          begin
            BeerName := 'Mind Bomb';
            ClickToContinue;
            wait(1000 + Random(100));
            ClickToContinue;
            wait(1000 + Random(75));
            ClickToContinue;
            wait(1000 + Random(50));
            ClickNpcChatText('ind', true);
            wait(1000 + Random(100));
            ClickToContinue;
            wait(1000 + Random(100));
            ClickToContinue;
          end;
        3:
          begin
            BeerName := 'Dwarven Stout';
            ClickToContinue;
            wait(1000 + Random(100));
            ClickToContinue;
            wait(1000 + Random(75));
            ClickToContinue;
            wait(1000 + Random(50));
            ClickNpcChatText('warv', true);
            wait(1000 + Random(100));
            ClickToContinue;
            wait(1000 + Random(100));
            ClickToContinue;
          end;
      end;
    end;

    You could easily do..

    SCAR Code:
    procedure BuyStout;
    var
      BeerName: string;
    begin
      case BeerType of
        1: BeerName := 'asga';
        2: BeerName := 'ind';
        3: BeerName := 'warv';
      end;
      ClickToContinue;
      wait(1000 + Random(100));
      ClickToContinue;
      wait(1000 + Random(75));
      ClickToContinue;
      wait(1000 + Random(50));
      ClickNpcChatText(BeerName, true);
      wait(1000 + Random(100));
      ClickToContinue;
      wait(1000 + Random(100));
      ClickToContinue;
    end;

    Thats the whole point of a case ;p You can also use ClickContinue(true,true);

    Rogeruk's Al-Kharid Tanner V1.1 [Released]
    Rogeruk's Barbarian Crafter [Coming Soon]
    Rogeruk's Guild Fisher [Coming Soon]
    !! - Taking Requests - !!

  24. #24
    Join Date
    Jul 2007
    Location
    California
    Posts
    252
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Alright thanks again rogeruk. I sorta tried the smaller version before but I had the case in a different function so I guess it didn't carry over. And You do a good job of explaining the problem too. Thanks a ton!!!

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
  •