Results 1 to 8 of 8

Thread: FindDTMRotated

  1. #1
    Join Date
    Feb 2009
    Posts
    484
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default FindDTMRotated

    What is wrong with my line? It gives me the error "[Error] (28:76): Type mismatch at line 27
    Compiling failed."

    I'm using a DTM on the MiniMap for walking

    Simba Code:
    FindDTMRotated(Path1, X, Y, MMX1, MMY1, MMX2, MMY2, -180, 360, 50, C);

    Thanks in advance.

  2. #2
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    What is Path1? Can you post more code?



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

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

    Default

    I know exactly what your problem is, the start and end angles must be in radians. Besides that, path 1 must be declared as an integer at the beginning of your script and C has to be declared like this:

    Simba Code:
    var
    C: Extended;

    in your var section because C is an extended integer, use one of my DTMs as an example:

    Simba Code:
    if FindDTMRotated(P1, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) then

    I use my DTMs in if..then statements. It is like asking the client: "Do you see this DTM" if it sees, then you can proceed to do what you want and the coordinates of this DTM are stored in (x, y). P1 is just the name of your DTM, I used aFound instead of C but either works as long as you define either of them with the correct type, x and y also must be definted as integers so that they can be used throughout your script. This is how they are defined:

    Simba Code:
    var
    P1, x, y: Integer;
    aFound: Extended;

    Good luck pal, I am going to script solely on DTMs and already know plenty about them, so if you need extra help with them, send me private message with the link to the post with the question and I'll be more than happy to go on it and post an answer as soon as possible. =)

    P.S. Use 15 Tolerance for all your points in your DTM to adjust with the color changes. 15 works just perfect in my opinion: both flexible and accurate!
    Last edited by DemiseScythe; 12-18-2011 at 12:58 AM. Reason: P.S.

  4. #4
    Join Date
    Feb 2009
    Posts
    484
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by DemiseScythe View Post
    I know exactly what your problem is, the start and end angles must be in radians. Besides that, path 1 must be declared as an integer at the beginning of your script and C has to be declared like this:

    Simba Code:
    var
    C: Extended;

    in your var section because C is an extended integer, use one of my DTMs as an example:

    Simba Code:
    if FindDTMRotated(P1, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) then

    I use my DTMs in if..then statements. It is like asking the client: "Do you see this DTM" if it sees, then you can proceed to do what you want and the coordinates of this DTM are stored in (x, y). P1 is just the name of your DTM, I used aFound instead of C but either works as long as you define either of them with the correct type, x and y also must be definted as integers so that they can be used throughout your script. This is how they are defined:

    Simba Code:
    var
    P1, x, y: Integer;
    aFound: Extended;

    Good luck pal, I am going to script solely on DTMs and already know plenty about them, so if you need extra help with them, send me private message with the link to the post with the question and I'll be more than happy to go on it and post an answer as soon as possible. =)

    P.S. Use 15 Tolerance for all your points in your DTM to adjust with the color changes. 15 works just perfect in my opinion: both flexible and accurate!
    Thanks for that!

    Didn't really understand what radians were, I just used numbers.

    Now I know Radians must be Pi/x.

    Cheers!

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

    Default

    Glad it was of help and I agree, it took me a while to figure out what the client was asking for with regards to RotatedDTM, mainly the radians part.

    If you have time, check my script:

    http://villavu.com/forum/showthread.php?t=69351

    It walks solely on DTMs, no color or anything else. It is fast, accurate and human-like except for like the gate part, it pauses for a few seconds. I am still working on it but it has progress a lot and might help you understand walking with DTMs. =)

  6. #6
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    6,136
    Mentioned
    28 Post(s)
    Quoted
    17 Post(s)

    Default

    This is how I track a red-line door dtm on the minimap.
    Simba Code:
    WhichAngle: Extended;

     if FindDtmRotated(DoorDTM, x, y, MMx1, MMy1, MMx2, MMy2, rs_GetCompassAngleRadians-pi/2, rs_GetCompassAngleRadians+pi/2, 0.05,
       WhichAngle) then
       begin
         Mouse(x + Ox, y + Oy, 0, 0, True);
         FFlag(0);
         FTWait(1);
         Result := True;
         If FawkiDebug then writeln('Callibrate succesful');
         Exit;
       end
       else
       begin
        Result := False;
        writeln('Door DTMnot found');
       end;


    I usually use:

    between rs_GetCompassAngleRadians-pi/2 and rs_GetCompassAngleRadians+pi/2. Pi = 180, so it scans for the dtm -90 to +90 degrees,

    but also

    between rs_GetCompassAngleRadians-pi/4 and rs_GetCompassAngleRadians+pi/4, which scans it -45 til +45 degrees.

    WhichAngle returns the angle in radians iirc, I hardly ever use that. X and Y obviously contain the coordinates of the Hotspot of the DDTM, the DTMMainPoint.

    The function itself return either true or false.

    Finddtmrotated is a pretty neat tool to track small objects regardless of a compass angle.
    SRL is a Library of routines made by the SRL community written for the Program Simba.
    We produce Scripts for the game Runescape.

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

    Default

    When I tried using DTM to find the door, it would sometimes click the fence next to it instead, I will try this code when I release a new version of my script. Thank you.
    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%).

  8. #8
    Join Date
    Apr 2012
    Posts
    28
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I'm having a similar issue if someone could help
    http://villavu.com/forum/showthread.php?p=981761

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
  •