Page 1 of 2 12 LastLast
Results 1 to 25 of 33

Thread: Starting to Script

  1. #1
    Join Date
    Jan 2008
    Posts
    94
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Starting to Script

    Well im a total noob to scripting but what do these errors mean

    Code:
    Line 14: [Error] (14:1): Identifier expected in script 
    
    
    Line 8: [Error] (8:19): Semicolon (';') expected in script

    Hope somebody can help me.

  2. #2
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    The first one means you have a begin that doesn't have a corresponding end. Usually, the second one means you're missing a semicolon on the line indicated.

  3. #3
    Join Date
    Jan 2008
    Posts
    94
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thank you very much, Now i have these problem when i use including and a identifier problem which i cant seem to fix.


    Include file C:\Program Files\SCAR 3.20\includes\Mining.Scar does not exist.
    Failed when compiling

    Line 13: [Error] (13:1): Identifier expected in script C:\Users\M. Giesing\Desktop\SRL Scripts\Marco40 Gold_Digga_0.1.scar



    Whats this ? i got the Mining.Scar in my includes.


    Code:
    Program Gold_Digga_0_1;
    {.include Mining.Scar}
    
    //////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////
    /////////////////////////////Gold Digga V.01//////////////////////////
    ///////////////////////////// By Marco 40/////////////////////////////
    /////////////////////////////Enjoy and get////////////////////////////
    ////////////////////////////////GP!!!!!!!/////////////////////////////
    
    Procedure Wheresmymine;
    
    begin
    
    Const
    MineColor=1343130;
    Findcolor(x,y,MineColor,661,482)then
    begin
    Mouse(x,y,true)
    end;
    End;

    I get this error also

    Line 13: [Error] (13:1): Identifier expected in script C:\Users\M. Giesing\Desktop\SRL Scripts\Marco40 Gold_Digga_0.1.scar
    Last edited by Marco40; 05-11-2009 at 07:22 PM.

  4. #4
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    Try this:
    SCAR Code:
    Program Gold_Digga_0_1;
    {.include SRL\SRL.scar}
    {.include SRL\SRL\Skill\Mining.scar}
    //////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////
    /////////////////////////////Gold Digga V.01//////////////////////////
    ///////////////////////////// By Marco 40/////////////////////////////
    /////////////////////////////Enjoy and get////////////////////////////
    ////////////////////////////////GP!!!!!!!/////////////////////////////
    Const //constants must be declared outside of any procedures
    MineColor = 1343130;

    Procedure Wheresmymine;
    begin
    Findcolor(x,y,MineColor,661,482)then
    begin
    Mouse(x,y,3,3,true); //mouse requires a value for x randomness and y randomness
    end;
    End;
    //you need a main section of code
    begin
    SetupSRL;
    Wheresmymine;
    end.

  5. #5
    Join Date
    Jan 2008
    Posts
    94
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks you very much, I will post if i have more problems btw repp++ for you.

    Then what do you mean with Mouse(x,y,3,3,true) (Why 3,3 ? and when does it got to be 4,4 (This is a example)

    And what do you mean with //you need a main section of code


    Edit:

    I actually gained a new error with yours

    Line 15: [Error] (17551:11): Unknown identifier 'x' in script C:\Users\M. Giesing\Desktop\SRL Scripts\Marco40 Gold_Digga_0.1.scar
    Last edited by Marco40; 05-11-2009 at 07:31 PM.

  6. #6
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    3,3 was an arbitrary number I picked. The bigger the numbers you use, the more randomness in the clicking.

    As for the "you need a main section of code", one of the problems I fixed up was that you didn't have a begin...end. block. You just had a procedure. You need a final section of code that begins with a begin, and ends with an end. (note the period. That's important).

  7. #7
    Join Date
    Jan 2008
    Posts
    94
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks you very much cleared up alot of things, I get better in scripter every post you make,


    Then i get a kinda weird error (Well i think it is)

    Line 15: [Error] (17551:11): Unknown identifier 'x' in script C:\Users\M. Giesing\Desktop\SRL Scripts\Marco40 Gold_Digga_0.1.scar

    Code:
    Findcolor(x,y,MineColor,661,482)then
    What could be the problem there?

  8. #8
    Join Date
    Feb 2009
    Location
    Philipines
    Posts
    600
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Above const add this:
    SCAR Code:
    var
      x, y: Integer;

    So it should look like this:
    SCAR Code:
    Program Gold_Digga_0_1;

    /////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////
    /////////////// Gold Digga V.01 ///////////////////////
    /////////////// By Marco 40 /////////////////////////
    /////////////// Enjoy and get ///////////////////////
    ////////////////// GP!!!!!!! //////////////////////////

    {.Include SRL\SRL.Scar}
    {.Include SRL\SRL\Skill\Mining.Scar}

    var
      x, y: Integer;

    const
      MineColor = 1343130;

    Procedure Wheresmymine;
    begin
      if FindColor(x, y, MineColor, 661, 482)then
      begin
        Mouse(x, y, 3, 3, True);
      end;
    end;

    begin
      SetupSRL;
      WheresMyMine;
    end.
    Last edited by Dark Arcana; 05-11-2009 at 07:49 PM.

  9. #9
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    Whoops, I forgot to declare x and y as variables. Below the line:
    SCAR Code:
    procedure Wheresmymine;
    Add this:
    SCAR Code:
    var
    x, y : Integer;

    Edit: Dark Arcana, you should really avoid using Global variables unless you absolutely have to.

  10. #10
    Join Date
    Jan 2008
    Posts
    94
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    So before any X,Y things you should always use that line ?,

    Now i get another error
    (Sorry for all those errors but you probaly got explain one time for every error as you tell me how to fix them so i can do it myself)

    Line 17: [Error] (17553:33): Invalid number of parameters in script C:\Users\M. Giesing\Desktop\SRL Scripts\Marco40 Gold_Digga_0.1.scar

    [CodeFindcolor(x,y,MineColor,661,482)[/Code]

    Error with the same line again.

  11. #11
    Join Date
    Feb 2009
    Location
    Philipines
    Posts
    600
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Change that line into:
    SCAR Code:
    if FindColor(x, y, MineColor, MSX1, MSY1, MSX2, MSY2) then

    MS looks for the color in the main screen.

    Hope this works.

  12. #12
    Join Date
    Jan 2008
    Posts
    94
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Again sorry for so much questions,

    But those MS1 MS 2 Etc, Why a 1 and a 2 not just all ones for example, And for every color searching should i use these ?.


    Then it works thanks alot, No more errors,

    Now repp for you.

  13. #13
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    MSX1 is the X Coordinate of the top left of the RS main screen. MSX2 is the X Coordinate of the bottom right of the RS main screen.

  14. #14
    Join Date
    Jan 2008
    Posts
    94
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I see anyway,


    Code:
    Program Gold_Digga_0_1;
    {.include SRL\SRL.scar}
    {.include SRL\SRL\Skill\Mining.scar}
    //////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////
    /////////////////////////////Gold Digga V.01//////////////////////////
    ///////////////////////////// By Marco 40/////////////////////////////
    /////////////////////////////Enjoy and get////////////////////////////
    ////////////////////////////////GP!!!!!!!/////////////////////////////
    ////////////////////////////////Like it?//////////////////////////////
    ////////////////////////////////Rep+++++//////////////////////////////
    ////////////////////////////////Marco40///////////////////////////////
    ////////////////////////////////For Script////////////////////////////
    ////////////////////////////////Senrath///////////////////////////////
    ////////////////////////////////For help//////////////////////////////
    ////////////////////////////////Without him///////////////////////////
    ////////////////////////////////No script/////////////////////////////
    
    Const
    MineColor = 1343130;
    
    Procedure Wheresmymine;
    var
    x, y : Integer;
    begin
    if FindColor(x, y, MineColor, MSX1, MSY1, MSX2, MSY2) then
    begin
    Mouse(x,y,3,3,true);
    Wait(5000)
    end;
    End;
    //you need a main section of code
    begin
    SetupSRL;
    Wheresmymine;
    end.
    The script should actually mine right ? Well i try'd it but it does nothing.

  15. #15
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    If you properly selected the Runescape window before running the code, it means that it's not finding the color. Try picking a new one. The colors in Runescape change quite often.

  16. #16
    Join Date
    Jan 2008
    Posts
    94
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Good, Got it working. Anyway if i run it 2 seconds later it stops again, Just gets enough time to click once on the rock, It just stops after the first time clickign the rock, The whole script stops,

    And how to make it mine more then one rock ?
    Last edited by Marco40; 05-11-2009 at 08:10 PM.

  17. #17
    Join Date
    Jan 2008
    Posts
    94
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    (Sorry for double post)

    Nobody knows why it stops after some time?,

    How to make things a loop ? so it keeps doing it.

  18. #18
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    Here this is a simple mine section. I know it can result in a infinite loop but it is a base you can work off of.
    SCAR Code:
    Program Gold_Digga_0_1;
    {.include SRL\SRL.scar}
    {.include SRL\SRL\Skill\Mining.scar}
    //////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////
    /////////////////////////////Gold Digga V.01//////////////////////////
    ///////////////////////////// By Marco 40/////////////////////////////
    /////////////////////////////Enjoy and get////////////////////////////
    ////////////////////////////////GP!!!!!!!/////////////////////////////
    ////////////////////////////////Like it?//////////////////////////////
    ////////////////////////////////Rep+++++//////////////////////////////
    ////////////////////////////////Marco40///////////////////////////////
    ////////////////////////////////For Script////////////////////////////
    ////////////////////////////////Senrath///////////////////////////////
    ////////////////////////////////For help//////////////////////////////
    ////////////////////////////////Without him///////////////////////////
    ////////////////////////////////No script/////////////////////////////

    Const
      MineColor = 1343130;

    function Wheresmymine : Boolean;
    var
      x, y : Integer;
    begin
      if FindColor(x, y, MineColor, MSX1, MSY1, MSX2, MSY2) then
      begin
        GetMousePos(x, y);
        MMouse(x, y, 0, 0);
        Result := True;
      end;
    end;

    procedure mineOre;
    var
      x, y : Integer;
    begin
      if(Wheresmymine)then
        repeat
          Wait(2000 + Random(500));
          Mouse(x, y, 3, 3, True);
        until(InvFull);
    end;

    begin
    SetupSRL;
    mineOre;
    end.

    ~Camo
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


  19. #19
    Join Date
    Jan 2008
    Posts
    94
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks alot!.


    Only thing is why did you delete the SETUPSRL of WhereIsMyMine


    and the Result := True;

    what is it for ?

    Is it like if he finds the colors result clicking on it ?

  20. #20
    Join Date
    Jan 2008
    Posts
    94
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    (Once again sorry for doublepost)

    I run and it stops instantly just like the other script

    I need this fixed so i can continue, Scripting.

  21. #21
    Join Date
    Apr 2009
    Location
    California!
    Posts
    280
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Marco40 View Post
    (Once again sorry for doublepost)

    I run and it stops instantly just like the other script

    I need this fixed so i can continue, Scripting.
    Quote Originally Posted by Camo¤Kyle aka Camo Developer View Post
    Here this is a simple mine section. I know it can result in a infinite loop but it is a base you can work off of.
    SCAR Code:
    Program Gold_Digga_0_1;
    {.include SRL\SRL.scar}
    {.include SRL\SRL\Skill\Mining.scar}
    //////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////
    /////////////////////////////Gold Digga V.01//////////////////////////
    ///////////////////////////// By Marco 40/////////////////////////////
    /////////////////////////////Enjoy and get////////////////////////////
    ////////////////////////////////GP!!!!!!!/////////////////////////////
    ////////////////////////////////Like it?//////////////////////////////
    ////////////////////////////////Rep+++++//////////////////////////////
    ////////////////////////////////Marco40///////////////////////////////
    ////////////////////////////////For Script////////////////////////////
    ////////////////////////////////Senrath///////////////////////////////
    ////////////////////////////////For help//////////////////////////////
    ////////////////////////////////Without him///////////////////////////
    ////////////////////////////////No script/////////////////////////////

    Const
      MineColor = 1343130;

    function Wheresmymine : Boolean;
    var
      x, y : Integer;
    begin
      if FindColor(x, y, MineColor, MSX1, MSY1, MSX2, MSY2) then
      begin
        GetMousePos(x, y);
        MMouse(x, y, 0, 0);
        Result := True;
      end;
    end;

    procedure mineOre;
    var
      x, y : Integer;
    begin
      if(Wheresmymine)then
        repeat
          Wait(2000 + Random(500));
          Mouse(x, y, 3, 3, True);
        until(InvFull);
    end;

    begin
    SetupSRL;
    mineOre;
    end.

    ~Camo
    He deleted the "SetupSRL" in the function because you only want SRL to load once per player. There is no need to set up srl every time it tries to find the mine.

    Here's the new version

    SCAR Code:
    Program Gold_Digga_0_1;
    {.include SRL\SRL.scar}
    {.include SRL\SRL\Skill\Mining.scar}
    //////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////
    /////////////////////////////Gold Digga V.01//////////////////////////
    ///////////////////////////// By Marco 40/////////////////////////////
    /////////////////////////////Enjoy and get////////////////////////////
    ////////////////////////////////GP!!!!!!!/////////////////////////////
    ////////////////////////////////Like it?//////////////////////////////
    ////////////////////////////////Rep+++++//////////////////////////////
    ////////////////////////////////Marco40///////////////////////////////
    ////////////////////////////////For Script////////////////////////////
    ////////////////////////////////Senrath///////////////////////////////
    ////////////////////////////////For help//////////////////////////////
    ////////////////////////////////Without him///////////////////////////
    ////////////////////////////////No script/////////////////////////////

    Const
      MineColor = 1343130;

    function Wheresmymine : Boolean;
    var
      x, y : Integer;
    begin
      if FindColor(x, y, MineColor, MSX1, MSY1, MSX2, MSY2) then
      begin
        GetMousePos(x, y);
        MMouse(x, y, 0, 0);
        Result := True; //This tells the script that it has found the color (True).
      end;
    end;

    procedure mineOre;
    var
      x, y : Integer;
    begin
      if(Wheresmymine = True)then //Since "Wheresmymine" is a boolean, we have to make it equal to true or false (We want true cause, if it doesn't find the mine then it will log out, that's good)
        repeat
          Wait(2000 + Random(500));
          Mouse(x, y, 3, 3, True);
        until(InvFull);
    end;

    begin
      repeat //A simple repeat, can be changed later
      SetupSRL;
      Wheresmymine; //Include it in the main loop
      mineOre;
      until(False); // and since you have a repeat you need to tell it when to stop until(False)
    end.
    Hope this helps. Look at This Thread. This is the one script that helped me out ALOT, and I still look at it now.
    Last edited by Mystic; 05-11-2009 at 09:05 PM.
    ~Penguin
    Semi-active
    http://i44.tinypic.com/33vk9aq.jpg
    SELL AUTOED GOODS AT MID-MAX! DON'T LET PRICES FALL AND GIVE US LESS PROFIT. (Put this in your sig)

  22. #22
    Join Date
    Jan 2008
    Posts
    94
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    How to set it to like 6 hours ? for example?. Or how to set it to run till i make it stop manually or when it fucks up?,



    And i keep using this topic for problems,

    Anyway tommorow if (After i tested this everything works fine) i take on the banking/walking.

    If you got any guids (On banking/walking) who you think is the best please post a linky.



    Everyone here thanks for helping this big noob, Hope in the future to make this a nice script, And to release more.

  23. #23
    Join Date
    Apr 2009
    Location
    California!
    Posts
    280
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Marco40 View Post
    How to set it to like 6 hours ? for example?. Or how to set it to run till i make it stop manually or when it fucks up?,



    And i keep using this topic for problems,

    Anyway tommorow if (After i tested this everything works fine) i take on the banking/walking.

    If you got any guids (On banking/walking) who you think is the best please post a linky.



    Everyone here thanks for helping this big noob, Hope in the future to make this a nice script, And to release more.
    Take a look at this.

    SCAR Code:
    Program Gold_Digga_0_1;
    {.include SRL\SRL.scar}
    {.include SRL\SRL\Skill\Mining.scar}
    //////////////////////////////////////////////////////////////////////
    //////////////////////////////////////////////////////////////////////
    /////////////////////////////Gold Digga V.01//////////////////////////
    ///////////////////////////// By Marco 40/////////////////////////////
    /////////////////////////////Enjoy and get////////////////////////////
    ////////////////////////////////GP!!!!!!!/////////////////////////////
    ////////////////////////////////Like it?//////////////////////////////
    ////////////////////////////////Rep+++++//////////////////////////////
    ////////////////////////////////Marco40///////////////////////////////
    ////////////////////////////////For Script////////////////////////////
    ////////////////////////////////Senrath///////////////////////////////
    ////////////////////////////////For help//////////////////////////////
    ////////////////////////////////Without him///////////////////////////
    ////////////////////////////////No script/////////////////////////////

    Const
      MineColor = 1343130;

    Var //Var= variable(Put all your Letters that represent numbers under here)
    x, y, MyTime: Integer; // (Like This. x, y, are both Integers(Numbers) in this script) Edit: Added MyTime because that is another variable that represents a number, this one is time, instead of coords. x, y.)

    function Wheresmymine : Boolean;
    begin
      if FindColor(x, y, MineColor, MSX1, MSY1, MSX2, MSY2) then
      begin
        GetMousePos(x, y);
        MMouse(x, y, 0, 0);
        Result := True; //This tells the script that it has found the color (True).
      end;
    end;

    procedure mineOre;
    begin
      if(Wheresmymine = True)then //Since "Wheresmymine" is a boolean, we have to make it equal to true or false (We want true cause, if it doesn't find the mine then it will log out, that's good)
        repeat
          Wait(2000 + Random(500));
          Mouse(x, y, 3, 3, True);
        until(InvFull);
    end;

    begin
      repeat //A simple repeat, can be changed later
      SetupSRL;
      MarkTime(MyTime) // I wouldn't do this but you get the idea. This Marks the time for the variable (MyTime) and starts counting in miliseconds. (So we can call it later)
      Wheresmymine;
      mineOre;
      until(TimeFromMark(MyTime) > 3500000) or (False); //This tells it to wait until the Variable, MyTime, is greater than 3,500 seconds (About 6 Hours), or Until (false) it "f**ks up".
    end.

    Hope it helps.

    Use these guides they helped me out ALOT "Getting started to learn how to script If you don't understand what's on there then you won't be able to make it walk. But when you do understand it then use this forum Map Waling - The Basics to the Advanced I STRONGLY suggest that you look at the first guide, and make sure you understand it before you try to Walk.
    Rep++?( If this helped press here and hit the button "Add To Reputation" )
    Thanks!
    Last edited by Mystic; 05-11-2009 at 09:36 PM.
    ~Penguin
    Semi-active
    http://i44.tinypic.com/33vk9aq.jpg
    SELL AUTOED GOODS AT MID-MAX! DON'T LET PRICES FALL AND GIVE US LESS PROFIT. (Put this in your sig)

  24. #24
    Join Date
    Jan 2008
    Posts
    94
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Oke thank you very much!, And how to run it for infinite ?

  25. #25
    Join Date
    Apr 2009
    Location
    California!
    Posts
    280
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Then just remove the
    SCAR Code:
    MarkTime(MyTime);
    then remove the
    SCAR Code:
    (TimeFromMark(MyTime) >3500000) or
    and you're left with..
    SCAR Code:
    Until(False);
    Read the tuts.
    Last edited by Mystic; 05-12-2009 at 07:00 AM.
    ~Penguin
    Semi-active
    http://i44.tinypic.com/33vk9aq.jpg
    SELL AUTOED GOODS AT MID-MAX! DON'T LET PRICES FALL AND GIVE US LESS PROFIT. (Put this in your sig)

Page 1 of 2 12 LastLast

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
  •