Results 1 to 9 of 9

Thread: How would I do this?

  1. #1
    Join Date
    Nov 2011
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default How would I do this?

    So I'm creating my first little bot, and I decided to use the easiest skill. Firemaking

    So I'm using just using bitmaps to click the logs, then move on to the tinderbox. That works fine. Then I use a repeat to check if the text "he fire" appears in the chatbox coords, which works fine, up until I already light one. Then it'll find it again the next go around, and keep using the tinderbox with the logs, because it see's the firemaking text from the last log it burned.

    I tried thinking of a way to circumvent, but I don't have any foolproof ideas unless I use a counter of how many times it's in the chatbox. And I don't know how to do that D:

    Here's the repeat portion of the procedure,

    Simba Code:
    repeat

      if(FindBitmap(Logs, x, y)) then
        Mouse(x, y, 4, 4, true);
      wait(Random(500));
      if(FindBitmap(Tindy, x, y)) then
        Mouse(x, y, 3, 3, true);
        repeat
          begin
            if(FindText(xi, yi, 'he fire', SmallChars, MCX1, MCY1, MCX2, MCY2))then
            begin
              break;
            end else
            begin
              Wait(Random(1000));
            end;
          end;
        until
          i > 1000;

      until
      InvCount = 2;
    First Script Progress
    {||||||||||}

  2. #2
    Join Date
    Feb 2011
    Location
    Earth
    Posts
    1,784
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    For the
    Simba Code:
    until
          i > 1000;

    What are you using for the value of i? Because, unless I'm misreading it, your code will keep repeating looking for the text in the chatbox until whatever the value of i is greater than 1000.

    Currently: Working on Defending&Attacking in my Castle-Wars Script
    Project Rebuild: 90M/170M

  3. #3
    Join Date
    Nov 2011
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I only put that in because I wanted it to repeat back through if the text didn't show up. Only so I could utilize the wait function and not have it checking for text every single loop without a wait, as I broke the loop if the text was found. And partially because I don't know what else I could do.
    First Script Progress
    {||||||||||}

  4. #4
    Join Date
    Mar 2006
    Location
    Behind you
    Posts
    3,193
    Mentioned
    61 Post(s)
    Quoted
    63 Post(s)

    Default

    Heh Firemaking is one of the harder starting scripts Goodluck to you sir!

    "Sometimes User's don't need the Answer spelled out with Code. Sometimes all they need is guidance and explanation of the logic to get where they are going."

  5. #5
    Join Date
    Nov 2011
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by BraK View Post
    Heh Firemaking is one of the harder starting scripts Goodluck to you sir!
    Really? D: I thought it'd be more easy since it's point and click.

    Oh wait, that's what all RS is ;D. But hell, i'm sticking with it and I'll finish it. Hopefully. Crossing fingers.
    First Script Progress
    {||||||||||}

  6. #6
    Join Date
    Feb 2011
    Location
    Earth
    Posts
    1,784
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    First you could remove some of the un-needed code just to shorten things up(i'm just kinda ocd about that).
    Simba Code:
    if(FindBitmap(Tindy, x, y)) then
        Mouse(x, y, 3, 3, true);
        repeat
            if(FindText(xi, yi, 'he fire', SmallChars, MCX1, MCY1, MCX2, MCY2))then
              break;
            else
            Wait(Random(1000));
        until
          i > 1000;

      until
      InvCount = 2;
    That should still compile.

    As to your problem, upon reading the description of FindText in the Include, you used it correctly, but your current parameters will search the entire chat box for the text.
    Description: Searches for text in specified box with specified font.
    Try changing the specified box to be only the bottom line if you want it to ignore the previous messages?

    Currently: Working on Defending&Attacking in my Castle-Wars Script
    Project Rebuild: 90M/170M

  7. #7
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    There's a function in text.scar, something like GetChatBoxLine...

    just use that to check what ur character is doing.

    'attempt to light'
    'lit a fire'

    That should get you through...

    Also, the last chatboxline is 8

    -RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  8. #8
    Join Date
    Nov 2011
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It didn't compile D:
    Code:
    [Error] (29:9): Identifier expected at line 28
    The error is at the else, right under break;

    I tried that, but it would still use the text already there from the previous logs that have been lighted, unless someone talks or something else takes the spot of that line. I think it'd just be a bit odd to have the character say something right after it lights a fire everytime ;D

    @Magician,

    I found something similar under chat.scar, would it do the same?
    First Script Progress
    {||||||||||}

  9. #9
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Quote Originally Posted by John S View Post
    So I'm using just using bitmaps to click the logs, then move on to the tinderbox. That works fine. Then I use a repeat to check if the text "he fire" appears in the chatbox coords, which works fine, up until I already light one. Then it'll find it again the next go around, and keep using the tinderbox with the logs, because it see's the firemaking text from the last log it burned.

    I tried thinking of a way to circumvent, but I don't have any foolproof ideas unless I use a counter of how many times it's in the chatbox. And I don't know how to do that D:
    if you want to know whether or not you successfully burnt a log, open up the XP counter on the Minimap and store the xp gained, then after clicking the tinderbox on the log wait until the xp gained increases.

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
  •