Results 1 to 22 of 22

Thread: First Script, First Post, Can't figure out what is wrong. It almost works...

  1. #1
    Join Date
    Sep 2014
    Location
    Upland, Ca.
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default First Script, First Post, Can't figure out what is wrong. It almost works...



    program MonsterWarlord;

    {$I SRL-6/SRL.Simba}

    procedure Heal;

    var
    HforHealth:Integer;

    begin

    SetupSRL;

    HforHealth := DTMFromString('mggAAAHicY2NgYGABYk4o5mBAAHYozQtl80 L5T58+ZXB0dGSIjIxk+PTpE0NtbS2Dt7c3Ay7AiANDAACyfwn+ ');

    If FindDTM(HforHealth) then

    begin;

    WriteLN ('Yay We Found It!');
    Mouse (320, 460, 7, 7, True);

    FreeDTM(HforHealth);

    end;

    end;







    begin
    MoveMouse (78, 423);
    Wait (600);
    HoldMouse (78, 423, 1);
    Wait (500);
    ReleaseMouse (78, 423, 1);
    Wait(4000);
    MoveMouse (355, 370);
    Wait (500);
    HoldMouse (355, 370, 1);
    Wait(500);
    ReleaseMouse (355, 370, 1);
    Wait(1000);
    MoveMouse (372, 496);
    Wait (3000);
    HoldMouse (371, 496, 1);
    Wait (500);
    ReleaseMouse (371, 496, 1);
    Wait (1500);

    Heal;


    end;



    ----------------------------



    Please no negative comments, I've spent almost 16 hours learning, reading, and writing this. Thank you, hopefully, someone can help.

    Thank you,

    Michelle

  2. #2
    Join Date
    Jan 2012
    Posts
    1,596
    Mentioned
    78 Post(s)
    Quoted
    826 Post(s)

  3. #3
    Join Date
    Dec 2011
    Posts
    2,147
    Mentioned
    221 Post(s)
    Quoted
    1068 Post(s)

    Default

    Could you explain what you are trying to do in this script, and what is going wrong when you try to run it?

    Also, you can use [simba] tags to surround simba code to make it easier to read:

    Simba Code:
    program MonsterWarlord;

    {$I SRL-6/SRL.Simba}

    procedure Heal;

    var
    HforHealth:Integer;

    begin

    SetupSRL;

    HforHealth := DTMFromString('mggAAAHicY2NgYGABYk4o5mBAAHYozQtl80 L5T58+ZXB0dGSIjIxk+PTpE0NtbS2Dt7c3Ay7AiANDAACyfwn+ ');

    If FindDTM(HforHealth) then

    begin;

    WriteLN ('Yay We Found It!');
    Mouse (320, 460, 7, 7, True);

    FreeDTM(HforHealth);

    end;

    end;







    begin
    MoveMouse (78, 423);
    Wait (600);
    HoldMouse (78, 423, 1);
    Wait (500);
    ReleaseMouse (78, 423, 1);
    Wait(4000);
    MoveMouse (355, 370);
    Wait (500);
    HoldMouse (355, 370, 1);
    Wait(500);
    ReleaseMouse (355, 370, 1);
    Wait(1000);
    MoveMouse (372, 496);
    Wait (3000);
    HoldMouse (371, 496, 1);
    Wait (500);
    ReleaseMouse (371, 496, 1);
    Wait (1500);

    Heal;


    end;

  4. #4
    Join Date
    Sep 2014
    Location
    Upland, Ca.
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    I play a game called Monster Warlord. I'm making this so it can click to "Battle". But a Heal Screen "pops up" when your health gets too low. (Why I can't only click and repeat the east part of the script.

    I decided to write into the script a DTM, that would allow the script to realize when the health screen has popped up. DTM works perfect. Once it realizes that the DTM is there, I used the Mouse (320, 460, 7, 7) so that it can click the health box.

    The error I am getting when I compile is:

    Exception in Script: Don't know which overloaded method to call with params (Int32) at line 15, column 6

  5. #5
    Join Date
    Dec 2011
    Posts
    2,147
    Mentioned
    221 Post(s)
    Quoted
    1068 Post(s)

    Default

    I don't know the protocol for using SRL-6 with non-Runescape games, but SRL-6 is designed specifically for RuneScape and you may have to tweak things to use it with other games. Other members will elaborate no doubt.

    Anyways, with your error, you need to specify the area to search in the FindDTM() function.

    The correct parameters for findDTM are findDTM(DTM you want to find, x, y, area to search);

    x and y are integers (leave as x and y), and area to search is a TBox. After findDTM runs and finds the DTM, the coordinate location will be saved to x and y.

    If you simply want to know if the DTM is present without the x and y, you can use DTMExists(); which returns true or false.

    Hope that helps, good luck!

  6. #6
    Join Date
    Sep 2014
    Location
    Upland, Ca.
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    DTM Exist ! Omg that's amazing! That makes it so much easier! That's exactly what I want.

    I just want the script to know if the DTM is present. I guess I can throw DTM Exist into an If, Then, Statement. If DTM exist, Mouse(coordinates).

    Yayyy.

    For the SRL, I am unsure of what to put of if I need it at all. I have trouble following as it seems there are many different things to type there. :/

  7. #7
    Join Date
    Dec 2011
    Posts
    2,147
    Mentioned
    221 Post(s)
    Quoted
    1068 Post(s)

    Default

    Quote Originally Posted by evenesence21 View Post
    DTM Exist ! Omg that's amazing! That makes it so much easier! That's exactly what I want.

    I just want the script to know if the DTM is present. I guess I can throw DTM Exist into an If, Then, Statement. If DTM exist, Mouse(coordinates).

    Yayyy.

    For the SRL, I am unsure of what to put of if I need it at all. I have trouble following as it seems there are many different things to type there. :/
    reformatted with new procedure:
    Simba Code:
    program MonsterWarlord;
    {$I SRL-6/SRL.Simba}

    procedure Heal;
    var
      HforHealth: Integer;
    begin
      SetupSRL;
      HforHealth := DTMFromString('mggAAAHicY2NgYGABYk4o5mBAAHYozQtl80 L5T58+ZXB0dGSIjIxk+PTpE0NtbS2Dt7c3Ay7AiANDAACyfwn+ ');
      if dtmExists(HforHealth) then
      begin
        WriteLN('Yay We Found It!');
        Mouse(320, 460, 7, 7, True);
        FreeDTM(HforHealth);
      end;
    end;

    begin
      MoveMouse(78, 423);
      Wait(600);
      HoldMouse(78, 423, 1);
      Wait(500);
      ReleaseMouse(78, 423, 1);
      Wait(4000);
      MoveMouse(355, 370);
      Wait(500);
      HoldMouse(355, 370, 1);
      Wait(500);
      ReleaseMouse(355, 370, 1);
      Wait(1000);
      MoveMouse(372, 496);
      Wait(3000);
      HoldMouse(371, 496, 1);
      Wait(500);
      ReleaseMouse(371, 496, 1);
      Wait(1500);
      Heal;
    end;

    When posting other code, it's generally nice to have it adhere to proper standards. If you don't want to do this yourself, you can use the formatter.sex extension available in View -> Extensions. Then enable the extension, then select Parser -> Format Script. Note that this deletes commented code.

  8. #8
    Join Date
    Sep 2014
    Location
    Upland, Ca.
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    I tried my hardest to make the code look pretty(standard).

    This is my first one.

    I have to add a lot more to it, but this is a great start.

    I learned a lot from YouTube, only trouble is that the video's are old and a lot of the code has changed, so it's difficult to memorize and then have to relearn it. :/


  9. #9
    Join Date
    Dec 2011
    Posts
    2,147
    Mentioned
    221 Post(s)
    Quoted
    1068 Post(s)

    Default

    Quote Originally Posted by evenesence21 View Post
    I tried my hardest to make the code look pretty(standard).

    This is my first one.

    I have to add a lot more to it, but this is a great start.

    I learned a lot from YouTube, only trouble is that the video's are old and a lot of the code has changed, so it's difficult to memorize and then have to relearn it. :/

    A good idea, eventually I want to come out with a new set of video tutorials that are more current
    Good luck with your first script, feel free to post with any more questions!

  10. #10
    Join Date
    Sep 2014
    Location
    Upland, Ca.
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Thank you, you are very nice.

    I will try plugging this new code in now.

  11. #11
    Join Date
    Dec 2011
    Posts
    2,147
    Mentioned
    221 Post(s)
    Quoted
    1068 Post(s)

    Default

    Actually, I was wrong about DTMExists. I've now found that "exists" doesn't mean if it can find it onscreen, but means if it has been loaded into memory. So it will always return true.
    Use "if findDTM(HForHealth, x, y, desiredAreaHere) then" and specify a specific area to look in as I mentioned above.

    Sorry about the mixup!

  12. #12
    Join Date
    Sep 2014
    Location
    Upland, Ca.
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Haha.

    Funny you should mention that.
    I've been running it, scrathching my head, wondering why it always runs! Hahaha. Oh, this is so much fun! I wish I would of started learning script long ago!

  13. #13
    Join Date
    Dec 2011
    Posts
    2,147
    Mentioned
    221 Post(s)
    Quoted
    1068 Post(s)

    Default

    Quote Originally Posted by evenesence21 View Post
    Haha.

    Funny you should mention that.
    I've been running it, scrathching my head, wondering why it always runs! Hahaha. Oh, this is so much fun! I wish I would of started learning script long ago!
    It's never too late Looking forward to seeing more of you around!

  14. #14
    Join Date
    Sep 2014
    Location
    Upland, Ca.
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Yes of course
    I'm going to make a basic script for this game for now. Then I'm going to see what other more complicated stuff I can do!
    The only thing is I don't know what else I can use script for.

  15. #15
    Join Date
    Sep 2014
    Location
    Upland, Ca.
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Quote Originally Posted by Clarity View Post
    Actually, I was wrong about DTMExists. I've now found that "exists" doesn't mean if it can find it onscreen, but means if it has been loaded into memory. So it will always return true.
    Use "if findDTM(HForHealth, x, y, desiredAreaHere) then" and specify a specific area to look in as I mentioned above.

    Sorry about the mixup!
    I don't understand. :x

    why do I have to have x and y? And by desired area, you mean the coordinates at which it finds the DMT?

  16. #16
    Join Date
    Dec 2011
    Posts
    2,147
    Mentioned
    221 Post(s)
    Quoted
    1068 Post(s)

    Default

    Quote Originally Posted by evenesence21 View Post
    I don't understand. :x

    why do I have to have x and y? And by desired area, you mean the coordinates at which it finds the DMT?
    Simba Code:
    findDTM(dtm, x, y, area);

    dtm: the DTM you want to find
    x and y: if the find function finds the DTM, it will assign the x and y coordinates of the found DTM to x and y.
    area: the area that you want the function to search inside for the DTM. This is declared using a TBox variable.

    SRL-6 has predefined areas such as mainscreen.getBounds(). If you are not playing RuneScape, you will need to set your own area, like so:
    Simba Code:
    IntToBox(X1, Y1, X2, Y2)

  17. #17
    Join Date
    Sep 2014
    Location
    Upland, Ca.
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    This DTM thing is going to kill me. xD

    It's the most complicated thing I've tried to learn so far.

    I'll figure it out eventually haha. :P

    I'm a visual learner, so trying to understand by reading is like teaching a fish to breathe with out water LOL. xD
    Grrr...

    Thank you.

    Oh and I took out the SRL from the script it didn't seem to be needed.

  18. #18
    Join Date
    Sep 2014
    Location
    Upland, Ca.
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Line 11: if findDTM(HforHealth x, y, 100, 460, 140, 480) then

    ---Exception in Script: Operator expected at line 11, column 25


    >
    so frustrating


    edit: I was missing a "," after HforHealth!!!!
    Small mistakes are always the hardest to find.
    Now time to see if it works hahahah
    Last edited by evenesence21; 09-22-2014 at 07:17 AM.

  19. #19
    Join Date
    Dec 2011
    Posts
    2,147
    Mentioned
    221 Post(s)
    Quoted
    1068 Post(s)

    Default

    Quote Originally Posted by evenesence21 View Post
    Line 11: if findDTM(HforHealth x, y, 100, 460, 140, 480) then

    ---Exception in Script: Operator expected at line 11, column 25


    >
    so frustrating


    edit: I was missing a "," after HforHealth!!!!
    Small mistakes are always the hardest to find.
    Now time to see if it works hahahah
    Should be findDTM(HforHealth, x, y, IntToBox(100, 460, 140, 480))

  20. #20
    Join Date
    Oct 2013
    Location
    East Coast USA
    Posts
    770
    Mentioned
    61 Post(s)
    Quoted
    364 Post(s)

    Default

    Quote Originally Posted by evenesence21 View Post
    This DTM thing is going to kill me. xD

    It's the most complicated thing I've tried to learn so far.
    Yohojo video

  21. #21
    Join Date
    Sep 2014
    Location
    Upland, Ca.
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Quote Originally Posted by Clarity View Post
    Should be findDTM(HforHealth, x, y, IntToBox(100, 460, 140, 480))
    I'll try that now

  22. #22
    Join Date
    Sep 2014
    Location
    Upland, Ca.
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Quote Originally Posted by bonsai View Post
    Yohojo video
    That's actually the video I got the idea from in the first place. The SRL doesn't work with my game.
    I don't know what should be put there instead. :/
    That's was the original problem.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •