Results 1 to 18 of 18

Thread: Need Help With My First Script =)

  1. #1
    Join Date
    Jun 2007
    Posts
    140
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Need Help With My First Script =)

    SCAR Code:
    program SimpleOakCutter;

    {.include SRL\SRL.scar}

    var
      x, y : Integer;

    const //Pic all of these colors
    BankGold = 4115428; //MiniMap bank gold color
    RockLight = 4805203; //Lightest rock color on MiniMap
    Dirt = 5665918; //dirt on main screen
    Tree = 10277; //a dark pixle of a tree
    BankBoothGlass = 6584189; //color of the Bank booth glass
    OakInvLog = 2839929; //Color of an oak log in your invintoy

    procedure WalkToTree;
    begin
      If(Findcolor(x, y, RockLight, 518, 0, 760, 166)) then
      begin
        mmouse(x, y, 2, 2);
        mouse(x, y, 1, 1, true);
        Wait(15000+random(3000));
        Findcolor(x, y, Dirt, 0, 0, 515, 337);
        mmouse(x, y, 2, 2);
        mouse(x, y, 1, 1, true);
        Wait(7000+random(2000));
        else logout;
      end;
    end;


    procedure FindTree;
    Begin
      If(Findcolor(x, y, Tree, 0, 0, 515, 337)) then
        mmouse(x, y, 2, 2);
      if IsUptext('oak') then mouse(x, y, 1, 1, true) else
      if IsUptext('oak') then mouse(x, y, 1, 1, true) else
      if IsUptext('oak') then mouse(x, y, 1, 1, true) else
      if IsUptext('oak') then mouse(x, y, 1, 1, true) else
      if IsUptext('oak') then mouse(x, y, 1, 1, true) else LogOut;
    end;

    Procedure GetFullInv;
    Begin
      if InvFull then exit else FindTree;
    end;

    Procedure WalkToBank;
    Begin
      If(Findcolor(x, y, RockLight, 518, 0, 760, 166)) then
        mmouse(x, y, 2, 2);
        mouse(x, y, 1, 1, true);
        Wait(10000+random(2000));
        Findcolor(x, y, BankGold, 518, 0, 760, 166);
        mmouse(x, y, 2, 2);
        mouse(x, y, 1, 1, true);
      else LogOut;
    end;

    Procedure BankLogs;
    Begin
      If(Findcolor(x, y, BankBoothGlass, 0, 0, 515, 338)) then
        mmouse(x, y, 2, 2);
      if IsTextUp('Bank booth') = true then
        mouse(x, y, 1, 1, True);
        Wait(1500+random(300));
        Mouse(302, 453, 30, 3, True);
        Wait(2500+random(500));
        Mouse(263, 395, 3, 40, True;
        Wait(2500+random(500));
        Mouse(880, 279, 1, 1, False);
        Wait(1000+random(500));
        Mouse(876, 345, 20, 0, True);
      Else
      Begin
        BankLogs
      end;
    end;

    begin
      WalkToTree;
      FindTree;
      GetFullInv;
      WalkToBank;
      BankLogs;
    end.

    Ok, Well Theres the script... What did i screw up lol Thanks

    Line 27: [Error] (12258:1): Identifier expected in script

  2. #2
    Join Date
    Mar 2006
    Posts
    13,241
    Mentioned
    228 Post(s)
    Quoted
    267 Post(s)

    Default

    We can't help you if you don't tell us what's wrong...
    STOP PM'ING ME

  3. #3
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    yeah it looks okay i think its a oak cutter and banker
    ~Hermen

  4. #4
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    procedure WalkToTree;
    begin
    If(Findcolor(x, y, RockLight, 518, 0, 760, 166)) then
    mmouse(x, y, 2, 2);
    mouse(x, y, 1, 1, true);
    Wait(15000+random(3000));
    Findcolor(x, y, Dirt, 0, 0, 515, 337);
    mmouse(x, y, 2, 2);
    mouse(x, y, 1, 1, true);
    Wait(7000+random(2000));
    else
    Mouse(642,486,10,10,True);
    Wait(1000+Random(200));
    FindColor(x,y,0,570, 358, 712, 394);
    Mouse(x,y,0,0,True);
    end;
    end;
    end;
    end;
    Omg 4 ends per 1 begin? Start from making it compile

  5. #5
    Join Date
    Jun 2007
    Posts
    140
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    oo arnt dont you just keep doing end; till you get to the end...

    SCAR Code:
    Program End;
      Begin
        Writeln('Sample');
      end;
    end;
    Thats how you script with standers right?

    Also, I get "dupuclite idetifier x in line 10..."

  6. #6
    Join Date
    Aug 2007
    Posts
    429
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Lol no you put an end everywhere you have a begin

    SCAR Code:
    Procedure End;
    begin
      DoThis;
      if ThisIsTrue then
      begin
        DoThisToo;
        AndThis;
      end;
    end;

    see how the begins match up with the ends

    begin
    |
    | begin
    | |
    | | begin
    | | |
    | | end;
    | |
    | end;
    |
    end;

    and um make sure you are using SCAR Divi 3.11 with SRL 4

  7. #7
    Join Date
    Jun 2007
    Posts
    140
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ok, let me fix it up... and yes, I am using scar 3.11 with srl 4 beta

  8. #8
    Join Date
    Aug 2007
    Posts
    429
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    k few things now...

    #1.
    SCAR Code:
    procedure WalkToTree;
      begin
        If(Findcolor(x, y, RockLight, 518, 0, 760, 166)) then
          mmouse(x, y, 2, 2);
          mouse(x, y, 1, 1, true);
          Wait(15000+random(3000));
          Findcolor(x, y, Dirt, 0, 0, 515, 337);
          mmouse(x, y, 2, 2);
          mouse(x, y, 1, 1, true);
          Wait(7000+random(2000));
        else
          Mouse(642,486,10,10,True);
        Wait(1000+Random(200));
        FindColor(x,y,0,570, 358, 712, 394);
        Mouse(x,y,0,0,True);
      end;

    NOTE that when you want to do MORE THAN ONE THING after an if statement you need a begin and an end else
    So the above would be:

    SCAR Code:
    procedure WalkToTree;
      begin
        If(Findcolor(x, y, RockLight, 518, 0, 760, 166)) then
        begin
          mmouse(x, y, 2, 2);
          mouse(x, y, 1, 1, true);
          Wait(15000+random(3000));
          Findcolor(x, y, Dirt, 0, 0, 515, 337);
          mmouse(x, y, 2, 2);
          mouse(x, y, 1, 1, true);
          Wait(7000+random(2000));
        end else
        begin
          Mouse(642,486,10,10,True);
          Wait(1000+Random(200));
          FindColor(x,y,0,570, 358, 712, 394);
          Mouse(x,y,0,0,True);
        end;
      end;

    #2. IsTextUp is actually IsUpText

    #3.
    SCAR Code:
    if IsUptext('oak') = true then
            mouse(x, y, 1, 1, true);
       Else
    do not include a semicolon after what to do in an if statement if you are going to use an ELSE
    should be:
    SCAR Code:
    if IsUptext('oak') = true then
            mouse(x, y, 1, 1, true)
       Else //you could even make it one line =]]

    if IsUptext('oak') then mouse(x, y, 1, 1, true) else

    #4. You might not be able to catch this error took me a while to figure it out =]] but theres an extra parenthesis in
    SCAR Code:
    Findcolor(x, y, BankGold, 518, 0, 760, 166))
    but it will say identifier expected..

    Good Luck fixing up your FIRST SCRIPT =]]

  9. #9
    Join Date
    Jun 2007
    Posts
    140
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    thanks, ill fix it up and see if it works. Also
    SCAR Code:
    else
          Mouse(642,486,10,10,True);
        Wait(1000+Random(200));
        FindColor(x,y,0,570, 358, 712, 394);
        Mouse(x,y,0,0,True);
      end;
    Thats so if it does not find the road and dirt, it logs out

  10. #10
    Join Date
    Aug 2007
    Posts
    429
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    You can just say

    SCAR Code:
    else LogOut;

    ?

  11. #11
    Join Date
    Jun 2007
    Posts
    140
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Cool, thanks. Also, in
    SCAR Code:
    Procedure GetFullInv;
      Begin
        if(FindColor(x, y, OakInvLog, 948, 483, 979, 508) then
      end;
        else
          FindTree
        end;

    How would I make it so if the last inv space has a log in, it goes to walk to bank, and if its not full, it keeps chopping tree till it is full?

  12. #12
    Join Date
    Aug 2007
    Posts
    429
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    SCAR Code:
    if InvFull then Exit else FindTree;

  13. #13
    Join Date
    Jun 2007
    Posts
    140
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Cool. I'm going to sleep tonight, I will fix it up in the morning and see if i can get it to compile...

  14. #14
    Join Date
    Jun 2007
    Posts
    140
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by ckeboss View Post
    SCAR Code:
    program SimpleOakCutter;

    {.include SRL\SRL.scar}

    var
      x, y : Integer;

    const //Pic all of these colors
    BankGold = 4115428; //MiniMap bank gold color
    RockLight = 4805203; //Lightest rock color on MiniMap
    Dirt = 5665918; //dirt on main screen
    Tree = 10277; //a dark pixle of a tree
    BankBoothGlass = 6584189; //color of the Bank booth glass
    OakInvLog = 2839929; //Color of an oak log in your invintoy

    procedure WalkToTree;
    begin
      If(Findcolor(x, y, RockLight, 518, 0, 760, 166)) then
      begin
        mmouse(x, y, 2, 2);
        mouse(x, y, 1, 1, true);
        Wait(15000+random(3000));
        Findcolor(x, y, Dirt, 0, 0, 515, 337);
        mmouse(x, y, 2, 2);
        mouse(x, y, 1, 1, true);
        Wait(7000+random(2000));
        else logout;
      end;
    end;


    procedure FindTree;
    Begin
      If(Findcolor(x, y, Tree, 0, 0, 515, 337)) then
        mmouse(x, y, 2, 2);
      if IsUptext('oak') then mouse(x, y, 1, 1, true) else
      if IsUptext('oak') then mouse(x, y, 1, 1, true) else
      if IsUptext('oak') then mouse(x, y, 1, 1, true) else
      if IsUptext('oak') then mouse(x, y, 1, 1, true) else
      if IsUptext('oak') then mouse(x, y, 1, 1, true) else LogOut;
    end;

    Procedure GetFullInv;
    Begin
      if InvFull then exit else FindTree;
    end;

    Procedure WalkToBank;
    Begin
      If(Findcolor(x, y, RockLight, 518, 0, 760, 166)) then
        mmouse(x, y, 2, 2);
        mouse(x, y, 1, 1, true);
        Wait(10000+random(2000));
        Findcolor(x, y, BankGold, 518, 0, 760, 166);
        mmouse(x, y, 2, 2);
        mouse(x, y, 1, 1, true);
      else LogOut;
    end;

    Procedure BankLogs;
    Begin
      If(Findcolor(x, y, BankBoothGlass, 0, 0, 515, 338)) then
        mmouse(x, y, 2, 2);
      if IsTextUp('Bank booth') = true then
        mouse(x, y, 1, 1, True);
        Wait(1500+random(300));
        Mouse(302, 453, 30, 3, True);
        Wait(2500+random(500));
        Mouse(263, 395, 3, 40, True;
        Wait(2500+random(500));
        Mouse(880, 279, 1, 1, False);
        Wait(1000+random(500));
        Mouse(876, 345, 20, 0, True);
      Else
      Begin
        BankLogs
      end;
    end;

    begin
      WalkToTree;
      FindTree;
      GetFullInv;
      WalkToBank;
      BankLogs;
    end.

    Ok, Well Theres the script... What did i screw up lol Thanks

    Line 27: [Error] (12258:1): Identifier expected in script
    Ok, still wont compile...

  15. #15
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    if you do what they said then it will compile!
    ~Hermen

  16. #16
    Join Date
    Jun 2007
    Posts
    140
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I di do what they said... It still does not work

  17. #17
    Join Date
    Nov 2006
    Location
    NSW, Australia
    Posts
    3,487
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    program SimpleOakCutter;

    {.include SRL\SRL.scar}

    var
      x, y : Integer;

    const //Pic all of these colors
    BankGold = 4115428; //MiniMap bank gold color
    RockLight = 4805203; //Lightest rock color on MiniMap
    Dirt = 5665918; //dirt on main screen
    Tree = 10277; //a dark pixle of a tree
    BankBoothGlass = 6584189; //color of the Bank booth glass
    OakInvLog = 2839929; //Color of an oak log in your invintoy

    procedure WalkToTree;
    begin
      If(Findcolor(x, y, RockLight, 518, 0, 760, 166)) then
      begin
        mmouse(x, y, 2, 2);
        mouse(x, y, 1, 1, true);
        Wait(15000+random(3000));
        Findcolor(x, y, Dirt, 0, 0, 515, 337);
        mmouse(x, y, 2, 2);
        mouse(x, y, 1, 1, true);
        Wait(7000+random(2000));
      end else
      Logout;
    end;


    procedure FindTree;
    Begin
      If(Findcolor(x, y, Tree, 0, 0, 515, 337)) then
        mmouse(x, y, 2, 2);
      if IsUptext('oak') then mouse(x, y, 1, 1, true) else
      if IsUptext('oak') then mouse(x, y, 1, 1, true) else
      if IsUptext('oak') then mouse(x, y, 1, 1, true) else
      if IsUptext('oak') then mouse(x, y, 1, 1, true) else
      if IsUptext('oak') then mouse(x, y, 1, 1, true) else LogOut;
    end;

    Procedure GetFullInv;
    Begin
      if InvFull then exit else FindTree;
    end;

    Procedure WalkToBank;
    Begin
      If(Findcolor(x, y, RockLight, 518, 0, 760, 166)) then
        begin
        mmouse(x, y, 2, 2);
        mouse(x, y, 1, 1, true);
        Wait(10000+random(2000));
        Findcolor(x, y, BankGold, 518, 0, 760, 166);
        mmouse(x, y, 2, 2);
        mouse(x, y, 1, 1, true);
        end
      else LogOut;
    end;

    Procedure BankLogs;
    Begin
      If(Findcolor(x, y, BankBoothGlass, 0, 0, 515, 338)) then
        mmouse(x, y, 2, 2);
      if IsUpText('Bank booth') then
        begin
        mouse(x, y, 1, 1, True);
        Wait(1500+random(300));
        Mouse(302, 453, 30, 3, True);
        Wait(2500+random(500));
        Mouse(263, 395, 3, 40, True);
        Wait(2500+random(500));
        Mouse(880, 279, 1, 1, False);
        Wait(1000+random(500));
        Mouse(876, 345, 20, 0, True);
       end else
      BankLogs;
    end;

    begin
      WalkToTree;
      FindTree;
      GetFullInv;
      WalkToBank;
      BankLogs;
    end.
    [CENTER][img]http://signatures.mylivesignature.com/54486/113/4539C8FAAF3EAB109A3CC1811EF0941B.png[/img][/CENTER]
    [CENTER][BANANA]TSN ~ Vacation! ~ says :I Love Santy[/BANANA][/CENTER]

    [CENTER][BANANA]Raymond - Oh rilie? says :Your smart[/BANANA][/CENTER]

  18. #18
    Join Date
    Jun 2007
    Posts
    140
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yay! it compiles! What did you change?

    EDIT
    I get a runtime... in mouse.scar!

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
  •