Results 1 to 8 of 8

Thread: Why can't I get DTM to work.

  1. #1
    Join Date
    Mar 2007
    Location
    Mars, I thought all men were from Mars.
    Posts
    513
    Mentioned
    7 Post(s)
    Quoted
    124 Post(s)

    Default Why can't I get DTM to work.

    I been trying to figure this stuff out, but I only able to get it working about 5% of the time. Ok heres what I got:

    I have tried using regular DTM's w/tolerances and the DDTM's. I have tried different area sizes and even tolerances which i shouldn't even need because i set the color manually. Nothing works. I'm still a little rusty at srl, but learning quickly, is this an out dated way of map walking or something? If it isn't please direct me in the right direction. If this is the way, what am I doing wrong?

    I've tried several ways to make my DTM, none worked.

    The green dots are the points I tried.


    Here is the simple script I made to show you what method I'm using. This should click above the building to the east of Falador east bank, on the minimap, while standing in the bank.

    Simba Code:
    program New;
    {$DEFINE SMART}
    {$i srl/srl.scar}
    var x,y :integer;
    var LadderPT: array[0..2] of TDTMPointDef;
    var LadderMainPT: TDTMPointDef;
    var Ladder: TDTM;
    var Ladderx, Laddery: Integer;
    var LadderDTM: Integer;
    var Ang: Extended;
    const
    ////////////////////////////////////////////////////////////

    //Colors
    MMLadder = 602971;

    //Other options
    Tolerance = 1; //Tried this from 1-10
    AreaSize  = 1; //Tried this from 1-10
    AreaShape = 0;

    Login_44        = 0; // 0 = off; 1 = on;                                  //

    ////////////////////////////////////////////////////////////

    /////////////////////Player Info///////////////////////
    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
      Players[0].Name := ''; //Youe Rs username
      Players[0].Pass := ''; //Your RS password
      Players[0].Nick := ''; //3-4 letters from name
      Players[0].Active:= True;
      Players[0].Pin := '';
    end;

    ///////////////////////////////////////////////////////////

    ////////////////////////////////////////////////////////////
    ///////////////////Begining of Script///////////////////////
    ////////////////////////////////////////////////////////////

    procedure Check_Login;
    begin
    if((getcolor(361, 135)=12378347)and
       (getcolor(274, 165)=12378347))or
       (LobbyScreen)then
       begin
       if(Login_44 = 1)then
         begin
         if(LobbyScreen)then
           begin
           OpenWorldScreen;
           while (not Worldscreen) do sleep(100+random(100));
           wait(1000+random(1000));
           Mouse(123,125, 3, 3, true);//click world order arrow
           wait(500+random(1000));
           Mouse(686,157, 4, 0, true);//click scroll bar top
           wait(1000+random(1000));
           Mouse(687, 257, 3, 0, true);//click scroll bar to see world 44
           wait(1000+random(1000));
           Mouse(144, 281, 100, 8, true);//click world 44
           wait(2000+random(1000));
           Mouse(308, 452, 160, 19, true);//click login
           wait(2000+random(1000));
           while (not RSReady) do sleep(100+random(100));
           end else
           LoginPLayerToLob;
           while (not LobbyScreen) do sleep(100+random(100));
           OpenWorldScreen;
           while (not Worldscreen) do sleep(100+random(100));
           wait(1000+random(1000));
           Mouse(123,125, 3, 3, true);//click world order arrow
           wait(500+random(1000));
           Mouse(686,157, 4, 0, true);//click scroll bar top
           wait(1000+random(1000));
           Mouse(687, 257, 3, 0, true);//click scroll bar to see world 44
           wait(1000+random(1000));
           Mouse(144, 281, 100, 8, true);//click world 44
           wait(2000+random(1000));
           Mouse(308, 452, 160, 19, true);//click login
           wait(2000+random(1000));
           while (not RSReady) do sleep(100+random(100));
         end;
       end else LoginPLayer;
    end;

    procedure SetLadderDTM;
    begin
      //writeln('X is:'+inttostr(MPx)+' and Y is:'+inttostr(MPy))
      LadderMainPT.x:=692;           // Centre Of Minimap
      LadderMainPT.y:=70;
      LadderMainPT.areasize:=1;
      LadderMainPT.areashape:=0;
      LadderMainPT.color:=0;
      LadderMainPT.tolerance:=255;    // Any Color

      LadderPT[0].x:=688;
      LadderPT[0].y:=96;
      LadderPT[0].areasize:=AreaSize;
      LadderPT[0].areashape:=AreaShape;
      LadderPT[0].color:=MMLadder ;
      LadderPT[0].tolerance:=Tolerance;

      LadderPT[1].x:=689;
      LadderPT[1].y:=97;
      LadderPT[1].areasize:=AreaSize;
      LadderPT[1].areashape:=AreaShape;
      LadderPT[1].color:=MMLadder ;
      LadderPT[1].tolerance:=Tolerance;

      LadderPT[2].x:=688;
      LadderPT[2].y:=98;
      LadderPT[2].areasize:=AreaSize;
      LadderPT[2].areashape:=AreaShape;
      LadderPT[2].color:=MMLadder ;
      LadderPT[2].tolerance:=Tolerance;

      Ladder.MainPoint := LadderMainPT;
      Ladder.SubPoints := LadderPT;
    end;


    procedure Go_to_ore;
    begin
    SetLadderDTM;
    if(FindDtmRotated(LadderDTM, Ladderx, Laddery,
       663, 67, 705, 116, -PI*2, PI*2, 0.2, Ang))then
      begin
      writeln('Spot found');
      MMouse(Ladderx-2, Laddery-2,4,4)
      end else  writeln('Spot not found');
    FreeDTM(LadderDTM);
    end;


    begin
    Smart_Server := 61;
    SetupSRL();
    DeclarePlayers;
    while (not RSReady) do
      SleepAndMoveMouse(100 + Random(500));
    Check_Login;

    Go_to_ore;
    end.

  2. #2
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    Best thing to do would be to ACA the color.
    Minimap colors change A LOT.
    Also, you do not neeed tolerance of 255 on your main point, just have it also be ladder color/tolerance.

    http://villavu.com/forum/showthread.php?t=26944
    I'm going to make a tutorial on using that tool later ^. If you let me borrow the account or tell me the location in the next couple days I can do it for you.

    Also if you had some AREA tolerance it would help a lot. Remember the minimap always rotates slightly and nothing is in exactly same spot (unlike item outlines) so area shape/size is nice to have if doing main screen or minimap DTMs.

    This uiliity might also further help you out:
    http://villavu.com/forum/showthread.php?t=68112

    You could also try making a small bitmap of the ladder and using FindBitmapDeformed (or something like that) to find it.

    It's christmas, otherwise I'd help more, but I must leave soon, good luck

  3. #3
    Join Date
    Mar 2007
    Location
    Mars, I thought all men were from Mars.
    Posts
    513
    Mentioned
    7 Post(s)
    Quoted
    124 Post(s)

    Default

    Thx alot for the links. Alot of useful info. I will look into all this. A question though: I thought the colors only changed when I logged? I know I have check this because that was the first thing I thought was happening. I check to make sure the ladder was the same color as in the beginning and it was. Also I did try the area tolerance, to no avail. I will look into the info you gave me and see if I can't find the problem. Will report back , Thanks again.

    Edit: After reading the ObjectDTM link u gave me, and from what I could gather, it is a function that uses objects on the mini map as sub points instead of colors. So this tell me that the function can already recognize an object on the mini map. This would be very helpful to me if it will work with only one sub point. Will have to test and find out. But I think this is what I needed.

    Another thought: I don't know how the above mentioned function works but I think if I took a bmp of each object at every possible angle and allowed for color, it would work pretty good at any angle
    Last edited by bud_wis_er_420; 12-25-2011 at 06:39 PM.

  4. #4
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    It's tough and an art to make DTMs for main screen or minimap lots of fun and creativity involved!

    Oh minimap colors change like crazy! After you walk a certain distance the minimap 'loads' again I think it looks like a flash or lag? And colors change. Walk like back and forth (east to west) in like Varrock and keep picking road colors if you want to take the time and see. Wouldn't surprise me if you got 20+ unique colors!

    Tomorrow I can help you further with this.

    Also! It's nice to even use ALL of these methods I do something like it inonw of my scripts!

    Like

    If not method1 then
    If not method2 then
    If not method 3 then
    Begin
    Writeln('we can't find ladder')
    Logout;
    End;


    Something like that would be nice

  5. #5
    Join Date
    Mar 2007
    Location
    Mars, I thought all men were from Mars.
    Posts
    513
    Mentioned
    7 Post(s)
    Quoted
    124 Post(s)

    Default

    ok, great. I been taking a look at the ObjectDTMs, but I don't understand how to use them. The guide from the link you gave me seem to only show how to declare it not call on it. If you could maybe show me a quick example that would be great. I did look around in a few free scripts. But its a lot to go though without knowing what I'm looking for.

    I mean I did find this:
    Simba Code:
    function FindObjDTMEx(DTMToFind: String; out cx, cy: Integer;
     GroundLevel: Boolean; BaseObjects: Array of MMObj): Boolean;
    But I don't know how to set it up I need an example to pick apart.
    Last edited by bud_wis_er_420; 12-25-2011 at 11:11 PM.

  6. #6
    Join Date
    Nov 2011
    Posts
    1,268
    Mentioned
    17 Post(s)
    Quoted
    217 Post(s)

    Default

    Your stepping is wrong, instead of 0.2 try Pi/30 and lines are hard to get with DTMs because they get deformed depending on the angle
    GLH Tutorial ~ OpenGL Scripting
    http://villavu.com/forum/showthread.php?p=1292150

    GLH Scripts ~ Abyssal Scripts
    http://villavu.com/forum/showthread.php?p=1293187
    Current Projects:
    A) DemiseSlayer Pro (Released/100%).
    B) Demise Power Miner(Released/100%).
    C) Demise Pyramid Plunder(Planning Stage/0%).

  7. #7
    Join Date
    Mar 2007
    Location
    Mars, I thought all men were from Mars.
    Posts
    513
    Mentioned
    7 Post(s)
    Quoted
    124 Post(s)

    Default

    Makes no difference.

    I even made a dtm that is should have no problem finding but it still loses track of it after the colors change. It stops finding it. The DTM is so simple, this is all it is in formal format:

    Simba Code:
    MainPT.x:=686;
      MainPT.y:=78;
      MainPT.areasize:=1;
      MainPT.areashape:=0;
      MainPT.color:=0;
      MainPT.tolerance:=255;// Any Color

      PT[0].x:=686;
      PT[0].y:=84;
      PT[0].areasize:=0;
      PT[0].areashape:=0;
      PT[0].color:=RedColor ;
      PT[0].tolerance:=15;

      PT[1].x:=685;
      PT[1].y:=84;
      PT[1].areasize:=0;
      PT[1].areashape:=0;
      PT[1].color:=WhiteColor ;
      PT[1].tolerance:=15;

    notice the x points on the 2 sub points. They are right next to each other. And I tested it, no matter what angle, there is always a red and white pixel next to each other. That is all I want it to do, find a red pixel and white one right next to each other in a specific area. Even with tol on 15 it should find it. I have noticed that the colors on the door and building walls on the minimap change the lest. So what is going on.

    It was working fine. I almost got my destination procedure done. I was just walking back for one more test run to add one more point to finish it. When I tried starting it, it couldn't find the first Walk point DTM. The red and white pixel. They where there, it just couldn't find them. I Assume the colors changed, But with tol 15 it still should have found them. If I used the FindColorSpiralTolerance function with only a tolerance or 10 it works fine even after a reload. But I can't use this because of dropped items are red and I'm using the door as my locator point, which is red, because that is the only stationary unique color.

    This walking stuff is turning out to be alot harder than I thought...
    Last edited by bud_wis_er_420; 12-26-2011 at 02:03 AM.

  8. #8
    Join Date
    Mar 2007
    Location
    Mars, I thought all men were from Mars.
    Posts
    513
    Mentioned
    7 Post(s)
    Quoted
    124 Post(s)

    Default

    bump

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
  •