Results 1 to 9 of 9

Thread: Beginner needs help

  1. #1
    Join Date
    Mar 2012
    Location
    Color :D
    Posts
    938
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Beginner needs help

    I have totally no knowledge of scripting. I wanted to have my own script for everything I wanted to bot, so I started to learn scripting 3 days ago by reading many of the tutorials and followed some videos and made a woodcutting script with Yohojo's video tut and I thought scripting isn't that hard, I was wrong.

    I am trying to make a construction bot that builds and remove wooden crude chair. I used DTM instead of colors because the colors of the chair is very similar to the walls of the house. TPA mind fucked me, kinda too advance for me now. But I just cant get the script to find the built chair and remove it. Need some advises and guidance from experts here.


    Code:
    program crudechair;
    //{$DEFINE SMART}
    {$i SRL/SRL.simba}
    
    Const
    
     SRLStats_Username = ''; // Your SRL Stats Username
     SRLStats_Password = ''; // Your SRL Stats Password
     NumbOfPlayers= 1;     //How many players are you using
     StartPlayer=   0;     //Player to start auoting with! (0 means first char)
     BreakEvery = ''       ;
     BreakFor = ''         ;
    
    
    procedure DeclarePlayers;
    var i:integer;
    begin
      NumberOfPlayers(NumbOfPlayers);
      CurrentPlayer := StartPlayer;
      for i := 0 to NumbOfPlayers-1 do
        Players[i].BoxRewards  := ['mote', 'ostume', 'XP', 'Gem'];
    
      with Players[0] do
      begin
        Name        := '';     //Player username.
        Pass        := '';     //Player password.
        Active      := True;
      end;
    
    end;
    
    
    Function FindChair: Boolean;
    var
    ChairDTM, x, y:Integer;
    
    Begin
      ChairDTM := DTMFromString('mlwAAAHicY2dgYGBjZGBgBWJhIBYBYg4g/g0U/w/EZ4D4CBAfB+JrQPwIiC8D8Wkg9nOUYDDXE2TIDTdg6C92YFjQ6MEwu9aVwcdegoELKI8LM+LBUAAAkTEO9w==');
    
      If FindDTM(ChairDTM, x, y, MSX1, MSY1, MSX2, MSY2) Then
      begin
        GetMousePos(x, y);
        IsUpText('Sit');
        Result:= True
      end;
    
      FreeDTM(ChairDTM);
    End;
    
    
    Procedure RemoveChair;
    var
      x, y:Integer;
    
    Begin
      If FindChair Then
      Begin
        writeln('Found Chair!');
        Mouse(x, y, 2, 2, False);
        WaitOption('Remove', 500);
      End;
    End;
    
    
    
    
    
    begin
    SetupSRL;
    ActivateClient;
    //Repeat
    RemoveChair;
    //Until
    end.

  2. #2
    Join Date
    Mar 2012
    Location
    Over there
    Posts
    840
    Mentioned
    4 Post(s)
    Quoted
    42 Post(s)

    Default

    Try using FindRotatedDTM or FindColorsSpiralTolerance with TPAs.

    Simba Code:
    var
      x, y : Integer;
      aFound : Extended;
    Begin
      if FindDTMRotated(ChairDTM, x, y, MSX1, MSY1, MSX2, MSY2, -Pi/4, Pi/4, Pi/60, aFound) then
    end;

    I'm not sure where the FindColorsSpiralTolerance tut is but I'm sure there are multiple out there.

    Don't know if you've seen this thread but it really helped me starting out. http://villavu.com/forum/showthread.php?t=76632
    Last edited by Total; 04-15-2012 at 03:47 PM.

  3. #3
    Join Date
    Mar 2012
    Location
    Color :D
    Posts
    938
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Isn't TPA using colors too? Is it not good since the colors of chair and the surroundings are very similar?

  4. #4
    Join Date
    Jan 2012
    Location
    Calgary, AB, Canada
    Posts
    1,819
    Mentioned
    5 Post(s)
    Quoted
    120 Post(s)

    Default

    Quote Originally Posted by CephaXz View Post
    Isn't TPA using colors too? Is it not good since the colors of chair and the surroundings are very similar?
    Yes and TPA's are a bit harder to grasp. Use a DTM instead as it will be more accurate in this case. TotalKillz has set it up for you all you have to do is incorporate that and make a DTM for the chair
    Current Project: Retired

  5. #5
    Join Date
    Mar 2012
    Location
    Over there
    Posts
    840
    Mentioned
    4 Post(s)
    Quoted
    42 Post(s)

    Default

    Well if you use FindColorsSpiralTolerance correctly it will start from the middle of the screen and go in a spiral outwards, so it will likely find whatever is closer to your character. Are you using ACA to get your color? If not you should use it and it should be set to CTS 2 for the most accurate color.

    Or that ^ haha.

  6. #6
    Join Date
    Mar 2012
    Location
    Color :D
    Posts
    938
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Gucci View Post
    Yes and TPA's are a bit harder to grasp. Use a DTM instead as it will be more accurate in this case. TotalKillz has set it up for you all you have to do is incorporate that and make a DTM for the chair
    I see DTM are more used in inventory and bank, where items has black outline. Chair has no black outlines and I can't find of any tut that finds objects on mainscreen with DTM, kind of a new thing to me.

    Quote Originally Posted by TotalKillz View Post
    Well if you use FindColorsSpiralTolerance correctly it will start from the middle of the screen and go in a spiral outwards, so it will likely find whatever is closer to your character. Are you using ACA to get your color? If not you should use it and it should be set to CTS 2 for the most accurate color.

    Or that ^ haha.

    I had thought about using spiral finding before, but TPA has more codes that I couldn't understand yet, so I used DTM instead. Is there any way I can understand more of the sangle,eangle,astep,afound? No point copy and paste the code you gave me and not understanding them. Thanks!

  7. #7
    Join Date
    Mar 2012
    Location
    Over there
    Posts
    840
    Mentioned
    4 Post(s)
    Quoted
    42 Post(s)

    Default

    Chapter 5 in this thread is where I learned it from. I don't even know exactly what the parameters are, all I know is that it rotates the DTM for a greater chance to find it. I use those end parameters for every FindRotatedDTM I use .
    If i were to guess, sangle is start angle, eangle is end angle, and astep is the interval in which it rotates between the angles.

  8. #8
    Join Date
    Jan 2012
    Location
    Calgary, AB, Canada
    Posts
    1,819
    Mentioned
    5 Post(s)
    Quoted
    120 Post(s)

    Default

    You don't need a black outline for making a DTM just chose a point on the chair if the chair is mostly highlighted and nothing but the chair is then it's good
    Current Project: Retired

  9. #9
    Join Date
    Mar 2012
    Location
    Color :D
    Posts
    938
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by TotalKillz View Post
    Chapter 5 in this thread is where I learned it from. I don't even know exactly what the parameters are, all I know is that it rotates the DTM for a greater chance to find it. I use those end parameters for every FindRotatedDTM I use .
    If i were to guess, sangle is start angle, eangle is end angle, and astep is the interval in which it rotates between the angles.
    I did read that thread, I believe there should be pictures in that thread but its not there for some reason so I can't fully understand it. I guess my DTM finding is a failure, maybe I should try out TPA. Thanks again

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
  •