Results 1 to 10 of 10

Thread: Need help with my first basic script

  1. #1
    Join Date
    Jan 2012
    Location
    Sydney, Australia
    Posts
    877
    Mentioned
    12 Post(s)
    Quoted
    368 Post(s)

    Default Need help with my first basic script

    Hey all I am very new to scripting SRL (started last night Lol) and I am attempting to make a script that simply clicks ruby bolt tips, clicks addy bolts, waits and clicks the tip all option waits 5 seconds then repeats until all gone.

    At the moment it cannot seem to find anything Lol.

    Any help is appreciated!

    Simba Code:
    program DansRubyBolter;
    {$i srl/srl/misc/smart.scar} // This is how we include SMART; it HAS to be included BEFORE SRL!
    {.include SRL/SRL.scar}
    //{$i SRL\SRL.scar} // Be sure to add this to ALL your scripts!


    Procedure DeclarePlayers;
    begin
      HowManyPlayers:= 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer:= 0;

      Players[0].Name := ''; // Username
      Players[0].Pass := ''; // Password
      Players[0].Nick := ''; // 3-4 lowercase letters from username; used for random event detection
      Players[0].Active := True; // Set to true if you want to use Player 0
    end;

    Procedure MakeABolt;
    Var
      BoltTips, UnTippedBolts, x, y:Integer;
    begin
      BoltTips:=DTMFromString('78DA636C6161602866644006D9C6FA0CFC401' +
           'A26CAD80354D384AA06260B57530A54534D404D2D504D0A013513' +
           '806A32F1AB010097DC05D3');
      if FindDTM(BoltTips, x, y, MSX1, MSY1, MSX2, MSY2) then
      begin
        WriteLn('Found Bolt Tips!');
        MMouse(x, y, 4, 4);
        ClickMouse(x, y, 1);
      end else
      begin
        WriteLn('Cannot Find Bolt Tips!');
      End;
      UntippedBolts:= DTMFromString('78DA635CC7C2C050C8C8800C6CDC6CC0344C9' +
           '4713E504D25AA1A982C5CCD16A09A26026A7601D5E41050B30AA8' +
           '2615BF1A00DA200688');
      If FindDTM(UnTippedBolts, x, y, MSX1, MSY1, MSX2, MSY2) then
      begin
        WriteLn('Found Bolt Tips!');
        MMouse(x, y, 4, 4);
        ClickMouse(x, y, 1);
      end else
      begin
        WriteLn('Cannot Find Addy Bolts!');
      End;
      begin;
        WriteLn('Moving Mouse to make bolts');
        MMouse(x, y, 5, 5);
        ClickMouse(x, y, 1);
        Wait(5000);
      end;
    end;






    // Our main loop
    begin
      Smart_Server:= 49;
      Smart_Members:= True;
      Smart_Signed:= True;
      Smart_SuperDetail:= False;

      ClearDebug;
      SetupSRL;
      DeclarePlayers;
      Repeat
        MakeABolt;
      until(false);
      LoginPlayer;
    end.

  2. #2
    Join Date
    Nov 2011
    Posts
    1,532
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    FindDTM(UnTippedBolts, x, y, MSX1, MSY1, MSX2, MSY2)

    You're trying to find your stuff in the mainscreen.

    Try

    FindDTM(UnTippedBolts, x, y, MIX1, MIY1, MIX2, MIY2)

    E: You're also using SRL4. Update to SRL5 because it's more updated.
    Current activity: Recovering from vacation
    - Nulla pars vitae vacare officio potest -
    SRL membership? Can I buy that?
    Scripts - AGS - SWF - WAR - EMS - W100S-EM
    If you need scripting help, you can pm me. Remember, if you need help you have to ask for it properly though

  3. #3
    Join Date
    Dec 2011
    Posts
    124
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Little bit of a clarification on what nosaj said.

    The "MS" in MSX1, MSY1, ect, stands for Mainscreen. Each of those stand for a point on the screen. These are the points the script will be looking for, in this case, the DTMs

    The "MI" in MIX1, MIY1, ect, stands for Main Inventory. Same deal as MS, these stand for points on the screen, and create a boundary to search in.

  4. #4
    Join Date
    Jan 2012
    Location
    Sydney, Australia
    Posts
    877
    Mentioned
    12 Post(s)
    Quoted
    368 Post(s)

    Default

    Thankyou for the replies guys, how would I go about updating SRL4 to SRL5?

  5. #5
    Join Date
    Nov 2011
    Posts
    1,532
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    This should do. Declare at the beginning

    Simba Code:
    {$DEFINE SRL5}
    {$DEFINE SMART}
    {$I SRL/SRL.simba}

    E: You should also search the thread about SRL5 in the forum so that you know how to switch the code from SRL4 to SRL5.
    Current activity: Recovering from vacation
    - Nulla pars vitae vacare officio potest -
    SRL membership? Can I buy that?
    Scripts - AGS - SWF - WAR - EMS - W100S-EM
    If you need scripting help, you can pm me. Remember, if you need help you have to ask for it properly though

  6. #6
    Join Date
    Jan 2012
    Location
    Sydney, Australia
    Posts
    877
    Mentioned
    12 Post(s)
    Quoted
    368 Post(s)

    Default

    Excellent, so the mouse is detecting my Ruby bolt tips, but doesnt seem to find my adamant bolts

  7. #7
    Join Date
    Dec 2011
    Posts
    124
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Make sure the tolerance on your main point in your DTM is set to 255.

  8. #8
    Join Date
    Jan 2012
    Location
    Sydney, Australia
    Posts
    877
    Mentioned
    12 Post(s)
    Quoted
    368 Post(s)

    Default

    255 really? It said on the DTm tutorial that i need to set it to round 15-20 or so

  9. #9
    Join Date
    Dec 2011
    Posts
    124
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Well if you're using the same DTM for multiple items with a different color on that main point, a tolerance of 15-20 won't find the other item. 255 is max tolerance, meaning it will accept any color.

  10. #10
    Join Date
    Nov 2011
    Posts
    1,532
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I think in his application, 15-20 would work, but wouldnt matter to use 255. But when you use 255, beware of false positives.
    Current activity: Recovering from vacation
    - Nulla pars vitae vacare officio potest -
    SRL membership? Can I buy that?
    Scripts - AGS - SWF - WAR - EMS - W100S-EM
    If you need scripting help, you can pm me. Remember, if you need help you have to ask for it properly though

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
  •