Results 1 to 21 of 21

Thread: Help with DTMs, OSRS

  1. #1
    Join Date
    Feb 2012
    Location
    Florida
    Posts
    153
    Mentioned
    1 Post(s)
    Quoted
    7 Post(s)

    Question Help with DTMs, OSRS

    Hi, I was following YoHoJo's video on DTMs but an error comes up: Exception in Script: File "SRL\SRL.simba" not found at line 3, column 5

    Do I use Lape or PascalScript.. and Do I use srl\srl.simba or osr-srl\srl.simba ?

    This is the script


    Program DTMTest;

    {$I SRL\SRL.simba}

    var
    WizardRobe, X, Y: Integer;




    Begin

    SetupSRL;

    WizardRobe := DTMFromString('mwQAAAHic42RgYHBigmBHIPYDYh8gNgdiMy C2AGJfIH4EVPcGiG8C8WMgfgfE74H4KRDfgWI+7wIgyYiCDRQU 0MQIA0YiMBwAAHhZC7o=');

    if FindDTM(WizardRobe, X, Y, MIX1, MIX2, MSY1, MSY2) then
    begin
    WriteLn('You found the item!');
    MoveMouse(X, Y, 7, 7);
    If IsUpText('ard') then
    Mouse(X, X, 0, 0, true);
    end;

    FreeDTM(WizardRobe);

    End.




    When I include {$I SRL-OSR\SRL.simba} instead of SRL\SRL.simba get this error: [Error] C:\Simba\Scripts\DTMTest.simba(21:26): Invalid number of parameters at line 21.

    Line 21: If IsUpText('ard') then


    Help please!

    EDITED: All is working fine minus the clicking.

  2. #2
    Join Date
    Mar 2007
    Posts
    5,125
    Mentioned
    275 Post(s)
    Quoted
    901 Post(s)

    Default

    Try this:

    Simba Code:
    program DTMTest;
    {$I SRL-OSR\SRL.simba}

    var
      WizardRobe, X, Y: Integer;
    begin
      SetupSRL;
      WizardRobe := DTMFromString('mwQAAAHic42RgYHBigmBHIPYDYh8gNgdiMy C2AGJfIH4EVPcGiG8C8WMgfgfE74H4KRDfgWI+7wIgyYiCDRQU 0MQIA0YiMBwAAHhZC7o=');
      if FindDTM(WizardRobe, X, Y, MIX1, MIY1, MIX2, MIY2) then
      begin
        WriteLn('You found the item!');
        MMouse(X, Y, 7, 7);
        if IsUpText('ard') then
          Mouse(X, X, 0, 0, true);
      end;
      FreeDTM(WizardRobe);
    end

    Changes:
    {$I SRL\SRL.simba} -> {$I SRL-OSR\SRL.simba}
    if FindDTM(WizardRobe, X, Y, MIX1, MIX2, MSY1, MSY2) then -> if FindDTM(WizardRobe, X, Y, MIX1, MIY1, MIX2, MIY2) then
    MoveMouse(X, Y, 7, 7); -> MMouse(X, Y, 7, 7);

    Forum account issues? Please send me a PM

  3. #3
    Join Date
    Feb 2012
    Location
    Florida
    Posts
    153
    Mentioned
    1 Post(s)
    Quoted
    7 Post(s)

    Default

    Hi, thanks for replying. I got a strange error this time..

    After starting your script I got this error.

    [Error] (1:1): period ('.') expected at line 1
    Compiling failed.


    so I added a period after end (the last line). After starting the script I got this:

    Error: Exception: FindDTMs: DTM[] is not valid. at line 9
    The following DTMs were not freed: [SRL - Lamp bitmap, SRL - Book of Knowledge, 2]
    The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Minimap Mask bitmap]

  4. #4
    Join Date
    Feb 2012
    Location
    Florida
    Posts
    153
    Mentioned
    1 Post(s)
    Quoted
    7 Post(s)

    Default

    Bump still looking for some help

  5. #5
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    Quote Originally Posted by Timba View Post
    Bump still looking for some help
    there's a space in the dtm's string

    Creds to DannyRS for this wonderful sig!

  6. #6
    Join Date
    Feb 2012
    Location
    Florida
    Posts
    153
    Mentioned
    1 Post(s)
    Quoted
    7 Post(s)

    Default

    Quote Originally Posted by Sjoe View Post
    there's a space in the dtm's string
    Hi, thanks for your help. I backspaced that part in the DTM string but I'm still getting this error

    Error: Exception: FindDTMs: DTM[] is not valid. at line 9
    The following DTMs were not freed: [SRL - Lamp bitmap, SRL - Book of Knowledge, 2]
    The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Minimap Mask bitmap]


    The script compiles.. it just gives me the error when I run it.

  7. #7
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    Quote Originally Posted by Timba View Post
    Hi, thanks for your help. I backspaced that part in the DTM string but I'm still getting this error

    Error: Exception: FindDTMs: DTM[] is not valid. at line 9
    The following DTMs were not freed: [SRL - Lamp bitmap, SRL - Book of Knowledge, 2]
    The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Minimap Mask bitmap]


    The script compiles.. it just gives me the error when I run it.
    yh sorry, didn't see the second one (there were 2 spaces)

    Creds to DannyRS for this wonderful sig!

  8. #8
    Join Date
    Sep 2012
    Location
    Here.
    Posts
    2,007
    Mentioned
    88 Post(s)
    Quoted
    1014 Post(s)

    Default

    Oh I see the issue. There needs to be a '.' at the end of the script.

    Simba Code:
    program DTMTest;
    {$I SRL-OSR\SRL.simba}

    var
      WizardRobe, X, Y: Integer;
    begin
      SetupSRL;
      WizardRobe := DTMFromString('mwQAAAHic42RgYHBigmBHIPYDYh8gNgdiMy C2AGJfIH4EVPcGiG8C8WMgfgfE74H4KRDfgWI+7wIgyYiCDRQU 0MQIA0YiMBwAAHhZC7o=');
      if FindDTM(WizardRobe, X, Y, MIX1, MIY1, MIX2, MIY2) then
      begin
        WriteLn('You found the item!');
        MMouse(X, Y, 7, 7);
        if IsUpText('ard') then
          Mouse(X, X, 0, 0, true);
      end;
      FreeDTM(WizardRobe);
    end.


    edit: @Sjoe pointed out i was dumb and slow on this issue. gimme a minute.

    edit edit: Did you get rid of every space in the dtm string, or just the one?

  9. #9
    Join Date
    Feb 2012
    Location
    Florida
    Posts
    153
    Mentioned
    1 Post(s)
    Quoted
    7 Post(s)

    Default

    Quote Originally Posted by Kevin View Post
    Oh I see the issue. There needs to be a '.' at the end of the script.

    Simba Code:
    program DTMTest;
    {$I SRL-OSR\SRL.simba}

    var
      WizardRobe, X, Y: Integer;
    begin
      SetupSRL;
      WizardRobe := DTMFromString('mwQAAAHic42RgYHBigmBHIPYDYh8gNgdiMy C2AGJfIH4EVPcGiG8C8WMgfgfE74H4KRDfgWI+7wIgyYiCDRQU 0MQIA0YiMBwAAHhZC7o=');
      if FindDTM(WizardRobe, X, Y, MIX1, MIY1, MIX2, MIY2) then
      begin
        WriteLn('You found the item!');
        MMouse(X, Y, 7, 7);
        if IsUpText('ard') then
          Mouse(X, X, 0, 0, true);
      end;
      FreeDTM(WizardRobe);
    end.


    edit: @Sjoe pointed out i was dumb and slow on this issue. gimme a minute.

    edit edit: Did you get rid of every space in the dtm string, or just the one?

    Hi, I got rid of every space and still get the error. I started messing around with the spacing but I'm not sure if that is the issue.
    This line is underlined in Orange if FindDTM(WizardRobe, X, Y, MIX1, MIY1, MIX2, MIY2) then

  10. #10
    Join Date
    Feb 2012
    Location
    Florida
    Posts
    153
    Mentioned
    1 Post(s)
    Quoted
    7 Post(s)

    Default

    I think I fixed the DTM error; it is working fine written like this
    WizardRobe: =DTMFromString('mwQAAAHic42RgYHBigmBHIPYDYh8gNgdiM y C2AGJfIH4EVPcGiG8C8WMgfgfE74H4KRDfgWI+7wIgyYiCDRQU 0MQIA0YiMBwAAHhZC7o=');

    Now I'm getting a new error

    [Error] (9:13): Assignment expected at line 9
    Line 9: if FindDTM (WizardRobe, X, Y, MIX1, MIY1, MIX2, MIY2) then

    EDITED.

  11. #11
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    Quote Originally Posted by Timba View Post
    Hi, I got rid of every space and still get the error. I started messing around with the spacing but I'm not sure if that is the issue.
    This line is underlined in Orange if FindDTM(WizardRobe, X, Y, MIX1, MIY1, MIX2, MIY2) then
    Yeah shouldn't have any spaces, try re-making your dtm

    Creds to DannyRS for this wonderful sig!

  12. #12
    Join Date
    Feb 2012
    Location
    Florida
    Posts
    153
    Mentioned
    1 Post(s)
    Quoted
    7 Post(s)

    Default

    Thanks for the help so far guys. I fixed/updated the DTM and it does everything it needs to do, except it doesn't click the item. Any ideas?

  13. #13
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    Quote Originally Posted by Timba View Post
    Thanks for the help so far guys. I fixed/updated the DTM and it does everything it needs to do, except it doesn't click the item. Any ideas?
    tolerance on your mainpoint? Use something like 15
    Use the black of the inventory item for your subpoints, since that color is static u can leave tolerance 0 .

    Creds to DannyRS for this wonderful sig!

  14. #14
    Join Date
    Feb 2012
    Location
    Florida
    Posts
    153
    Mentioned
    1 Post(s)
    Quoted
    7 Post(s)

    Default

    Quote Originally Posted by Sjoe View Post
    tolerance on your mainpoint? Use something like 15
    Use the black of the inventory item for your subpoints, since that color is static u can leave tolerance 0 .
    Did just that, and added 15 tolerance to the main point. I used the outline of the item as sub-points but still I'm seeing it doesn't click on the robe.. :s

  15. #15
    Join Date
    Oct 2006
    Posts
    6,752
    Mentioned
    95 Post(s)
    Quoted
    532 Post(s)

    Default

    Quote Originally Posted by Timba View Post
    Did just that, and added 15 tolerance to the main point. I used the outline of the item as sub-points but still I'm seeing it doesn't click on the robe.. :s
    Is it moving the mouse to it? Because if it is, then your DTM is fine, probably just a problem with the uptext...
    “The long-lived and those who will die soonest lose the same thing. The present is all that they can give up, since that is all you have, and what you do not have, you cannot lose.” - Marcus Aurelius

  16. #16
    Join Date
    Feb 2012
    Location
    Florida
    Posts
    153
    Mentioned
    1 Post(s)
    Quoted
    7 Post(s)

    Default

    Quote Originally Posted by elfyyy View Post
    Is it moving the mouse to it? Because if it is, then your DTM is fine, probably just a problem with the uptext...
    Yeah. It moves to the item, then Simba tells me it found it, and then sometimes moves the mouse way down but never clicks.

  17. #17
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    Quote Originally Posted by Timba View Post
    Yeah. It moves to the item, then Simba tells me it found it, and then sometimes moves the mouse way down but never clicks.
    instead of
    Simba Code:
    if IsUpText('ard') then

    use this:
    Simba Code:
    if WaitUptext('ard', 300) then

    It could be that you're not giving simba enough time to read the uptext.
    Last edited by Sjoe; 01-23-2014 at 02:38 PM.

    Creds to DannyRS for this wonderful sig!

  18. #18
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Quote Originally Posted by Sjoe View Post
    instead of If
    Simba Code:
    IsUpText('ard') then

    use this:
    Simba Code:
    if WaitUptext('ard', 300) then

    It could be that you're not giving simba enough time to read the uptext.
    That's good advice. One of the methods I actively use for determining which part in a piece of code isn't working correctly is step-by-step printing to indicate exactly which stage as been reached. It's hard to explain so I'll use Justin's piece of code as an example.

    Simba Code:
    program DTMTest;
    {$I SRL-OSR\SRL.simba}

    var
      WizardRobe, X, Y: Integer;
    begin
      SetupSRL;
      WizardRobe := DTMFromString('mwQAAAHic42RgYHBigmBHIPYDYh8gNgdiMy C2AGJfIH4EVPcGiG8C8WMgfgfE74H4KRDfgWI+7wIgyYiCDRQU 0MQIA0YiMBwAAHhZC7o=');
      if FindDTM(WizardRobe, X, Y, MIX1, MIY1, MIX2, MIY2) then
      begin
        Writeln('A');                // The DTM was found, moving on
        MMouse(X, Y, 7, 7);
        Writeln('B');                // Mouse was moved to the DTM's X/Y coordinate
        if IsUpText('ard') then
        begin
          Writeln('C');              // Uptext was found
          Mouse(X, X, 0, 0, true);
        end;
      end;
      FreeDTM(WizardRobe);
    end.

    If Simba writes 'A' in the debug then we know the DTM-finding part was successful, if 'B' is written we know the mouse was successfully moved to that coordinate, and if 'C' was written then it's certain the UpText-finding was also successful. If any of these are not printed then we know exactly which part was unsuccessful. Actively debugging is essential when first making a procedure/function.

    Edit:
    Oh yeah, if UpText is your problem I suggest you take a look at Warpie's OCR Engine for a much more accurate way of reading UpText.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  19. #19
    Join Date
    Feb 2012
    Location
    Florida
    Posts
    153
    Mentioned
    1 Post(s)
    Quoted
    7 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    That's good advice. One of the methods I actively use for determining which part in a piece of code isn't working correctly is step-by-step printing to indicate exactly which stage as been reached. It's hard to explain so I'll use Justin's piece of code as an example.

    Simba Code:
    program DTMTest;
    {$I SRL-OSR\SRL.simba}

    var
      WizardRobe, X, Y: Integer;
    begin
      SetupSRL;
      WizardRobe := DTMFromString('mwQAAAHic42RgYHBigmBHIPYDYh8gNgdiMy C2AGJfIH4EVPcGiG8C8WMgfgfE74H4KRDfgWI+7wIgyYiCDRQU 0MQIA0YiMBwAAHhZC7o=');
      if FindDTM(WizardRobe, X, Y, MIX1, MIY1, MIX2, MIY2) then
      begin
        Writeln('A');                // The DTM was found, moving on
        MMouse(X, Y, 7, 7);
        Writeln('B');                // Mouse was moved to the DTM's X/Y coordinate
        if IsUpText('ard') then
        begin
          Writeln('C');              // Uptext was found
          Mouse(X, X, 0, 0, true);
        end;
      end;
      FreeDTM(WizardRobe);
    end.

    If Simba writes 'A' in the debug then we know the DTM-finding part was successful, if 'B' is written we know the mouse was successfully moved to that coordinate, and if 'C' was written then it's certain the UpText-finding was also successful. If any of these are not printed then we know exactly which part was unsuccessful. Actively debugging is essential when first making a procedure/function.

    Edit:
    Oh yeah, if UpText is your problem I suggest you take a look at Warpie's OCR Engine for a much more accurate way of reading UpText.





    Just read your post Flight, thanks for your help looking into this now.

    A, B, and C came out in the log but still didn't click the robe. o_O

  20. #20
    Join Date
    Feb 2006
    Location
    Australia
    Posts
    628
    Mentioned
    15 Post(s)
    Quoted
    105 Post(s)

    Default

    You've used the X variable in place of the Y, it's in all of the code posted on this page. This is the line in question:
    Mouse(X, X, 0, 0, true);
    Last edited by Krazy_Meerkat; 01-30-2014 at 07:51 AM. Reason: Be less threatening

  21. #21
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    Quote Originally Posted by Krazy_Meerkat View Post
    You've used the X variable in place of the Y, it's in all of the code posted on this page. This is the line in question:
    Mouse(X, X, 0, 0, true);
    Wow, can't believe nobody saw that. Even I didn't see it when I looked at this thread a few days back

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
  •