Results 1 to 11 of 11

Thread: conversationBox question

  1. #1
    Join Date
    Jul 2014
    Location
    Europe
    Posts
    182
    Mentioned
    7 Post(s)
    Quoted
    103 Post(s)

    Question conversationBox question

    Unfortunately, I have another problem. I'm making a procedure that makes the player run from the bank to a place where it can pick up redberries. Because it's just a level 3 account it gets a message when it wants to go through the door at Varrock east because it may be dangerous out there. I want to make it continue so it can run to its destination. My plan is to make it run from the bank to just behind the door so the conversation box would show up. Make it click continue and everything it needs to disappear. Then make a new path to the redberries so it can run further from there. This is what I have so far:

    Simba Code:
    procedure runToRedberries();
    var
      pathToRedberries: TPointArray;
    begin
      if not isLoggedIn() then
        exit;

      pathToRedberries := [Point(100, 70), Point(101, 47), Point(112, 38), Point(127, 38), Point(142, 40), Point(159, 39), Point(172, 39), Point(192, 39)];
      SPS.walkPath(pathToRedberries);
      if conversationBox.findChat(['you are now leaving the starting area. Outside the starting area, things can get more dangerous.']) then
        begin
          wait(randomRange(350, 750));
          conversationBox.continue(true, true);
          writeLn('We continued');
        end;
      // and then some stuff to make it run to its destination
    end;

    So it has to continue when the following shows up, but it doesn't:




    I've recently installed the Direct-X plugin but I don't think that would be causing the problem, would it? I hope anyone could help me as fast as possible so I could get to work again, thanks in advance.

  2. #2
    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 Spaceblow View Post
    Unfortunately, I have another problem. I'm making a procedure that makes the player run from the bank to a place where it can pick up redberries. Because it's just a level 3 account it gets a message when it wants to go through the door at Varrock east because it may be dangerous out there. I want to make it continue so it can run to its destination. My plan is to make it run from the bank to just behind the door so the conversation box would show up. Make it click continue and everything it needs to disappear. Then make a new path to the redberries so it can run further from there. This is what I have so far:

    Simba Code:
    procedure runToRedberries();
    var
      pathToRedberries: TPointArray;
    begin
      if not isLoggedIn() then
        exit;

      pathToRedberries := [Point(100, 70), Point(101, 47), Point(112, 38), Point(127, 38), Point(142, 40), Point(159, 39), Point(172, 39), Point(192, 39)];
      SPS.walkPath(pathToRedberries);
      if conversationBox.findChat(['you are now leaving the starting area. Outside the starting area, things can get more dangerous.']) then
        begin
          wait(randomRange(350, 750));
          conversationBox.continue(true, true);
          writeLn('We continued');
        end;
      // and then some stuff to make it run to its destination
    end;

    So it has to continue when the following shows up, but it doesn't:


    I've recently installed the Direct-X plugin but I don't think that would be causing the problem, would it? I hope anyone could help me as fast as possible so I could get to work again, thanks in advance.
    I doubt it will be able to read that whole string of text exactly. Do you even need to check the text? If the convo box is open can't you just assume you need to click continue?

    Simba Code:
    if conversationBox.isOpen(5000) then
    begin
      writeLn('Found open conversation box');
      if conversationBox.continue(true, true) then
        writeLn('We continued');
    end;

  3. #3
    Join Date
    Jul 2014
    Location
    Europe
    Posts
    182
    Mentioned
    7 Post(s)
    Quoted
    103 Post(s)

    Default

    Quote Originally Posted by The Mayor View Post
    I doubt it will be able to read that whole string of text exactly. Do you even need to check the text? If the convo box is open can't you just assume you need to click continue?

    Simba Code:
    if conversationBox.isOpen(5000) then
    begin
      writeLn('Found open conversation box');
      if conversationBox.continue(true, true) then
        writeLn('We continued');
    end;
    Yep, that was the problem. Thank you very much for the quick reply, you've already helped me so much since the moment I registered on this website.

    But now I'm wondering what the '5000' in 'conversationBox.isOpen(5000)' does. I guess it's going to wait 5s before continuing but I tried it out with replacing it with 10000 and it doesn't wait 10s to continue.

  4. #4
    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 Spaceblow View Post
    Yep, that was the problem. Thank you very much for the quick reply, you've already helped me so much since the moment I registered on this website.

    But now I'm wondering what the '5000' in 'conversationBox.isOpen(5000)' does. I guess it's going to wait 5s before continuing but I tried it out with replacing it with 10000 and it doesn't wait 10s to continue.
    It is the max time to keep looking E.g:

    Simba Code:
    conversationBox.isOpen(5000)

    If the convo box is found after 2 seconds, it will exit and return true. If it's not found it will keep looking for 5 seconds. You can do the same with the other interfaces too. E.g:

    Simba Code:
    bankScreen.isOpen(5000)
    depositBox.isOpen(5000)

    For example, if I clicked a banker, I would want to wait a few sec for me to run to the bank and for the bank screen to pop up.

  5. #5
    Join Date
    Jul 2014
    Location
    Europe
    Posts
    182
    Mentioned
    7 Post(s)
    Quoted
    103 Post(s)

    Default

    Quote Originally Posted by The Mayor View Post
    It is the max time to keep looking E.g:

    Simba Code:
    conversationBox.isOpen(5000)

    If the convo box is found after 2 seconds, it will exit and return true. If it's not found it will keep looking for 5 seconds. You can do the same with the other interfaces too. E.g:

    Simba Code:
    bankScreen.isOpen(5000)
    depositBox.isOpen(5000)

    For example, if I clicked a banker, I would want to wait a few sec for me to run to the bank and for the bank screen to pop up.
    I'm a little bit confused and also embarrassed that I don't fully understand it. Is this used by many scripters?

  6. #6
    Join Date
    Mar 2013
    Location
    Freedomville.
    Posts
    155
    Mentioned
    2 Post(s)
    Quoted
    107 Post(s)

    Default

    Quote Originally Posted by Spaceblow View Post
    I'm a little bit confused and also embarrassed that I don't fully understand it. Is this used by many scripters?
    A maximum waiting time is often given for boolean functions such that the function doesn't get stuck in an infinite loop. So the answer to your question is yes, it is a very handy failsafe.

  7. #7
    Join Date
    Jul 2014
    Location
    Europe
    Posts
    182
    Mentioned
    7 Post(s)
    Quoted
    103 Post(s)

    Default

    Quote Originally Posted by sdf View Post
    A maximum waiting time is often given for boolean functions such that the function doesn't get stuck in an infinite loop. So the answer to your question is yes, it is a very handy failsafe.
    So for example, if I would be using this:
    Simba Code:
    bankScreen.isOpen(5000)
    And the bankscreen doesn't open for some reason, it would wait 5 seconds and then the script would just stop, right? And then it would just wait until the player logs out and that's it?

  8. #8
    Join Date
    Mar 2013
    Location
    Freedomville.
    Posts
    155
    Mentioned
    2 Post(s)
    Quoted
    107 Post(s)

    Default

    Quote Originally Posted by Spaceblow View Post
    So for example, if I would be using this:
    Simba Code:
    bankScreen.isOpen(5000)
    And the bankscreen doesn't open for some reason, it would wait 5 seconds and then the script would just stop, right? And then it would just wait until the player logs out and that's it?
    Not quite, since bankScreen.isOpen() returns true or false, it'd be more like this is you want it to log out and terminate if it fails.
    Simba Code:
    if bankScreen.isOpen(5000) then
      begin
       //procedures to complete if the bankscreen is open before maxwait
      end else
      begin
       //procedures to complete if the bankscreen is not open after maxwait
       writeln('Something went wrong, bank screen not found after maxwait! Attempting to log out and terminate!');
       if players[currentPlayer].logout() then
        terminateScript;
      end;

  9. #9
    Join Date
    Jul 2014
    Location
    Europe
    Posts
    182
    Mentioned
    7 Post(s)
    Quoted
    103 Post(s)

    Default

    Quote Originally Posted by sdf View Post
    Not quite, since bankScreen.isOpen() returns true or false, it'd be more like this is you want it to log out and terminate if it fails.
    Simba Code:
    if bankScreen.isOpen(5000) then
      begin
       //procedures to complete if the bankscreen is open before maxwait
      end else
      begin
       //procedures to complete if the bankscreen is not open after maxwait
       writeln('Something went wrong, bank screen not found after maxwait! Attempting to log out and terminate!');
       if players[currentPlayer].logout() then
        terminateScript;
      end;
    Hmm alright, but for other than that, what would maxwait be used for?

  10. #10
    Join Date
    Dec 2011
    Location
    East Coast, USA
    Posts
    4,231
    Mentioned
    112 Post(s)
    Quoted
    1869 Post(s)

    Default

    Quote Originally Posted by Spaceblow View Post
    Hmm alright, but for other than that, what would maxwait be used for?
    Any sort of time-based failsafe.

    Code:
    if x doesn't happen after y time, then do z which will help us recover from x's failure
    think of it like that
    GitLab projects | Simba 1.4 | Find me on IRC or Discord | ScapeRune scripts | Come play bot ScapeRune!

    <BenLand100> we're just in the transitional phase where society reclassifies guns as Badâ„¢ before everyone gets laser pistols

  11. #11
    Join Date
    Jul 2014
    Location
    Europe
    Posts
    182
    Mentioned
    7 Post(s)
    Quoted
    103 Post(s)

    Default

    Quote Originally Posted by KeepBotting View Post
    Any sort of time-based failsafe.

    Code:
    if x doesn't happen after y time, then do z which will help us recover from x's failure
    think of it like that
    Now I understand it a bit more. I think I'm going to make a simple script first, after I'm done with that I'll probably look more into antibans and failsafes as they are pretty important for not getting detected.

    Everyone who replied on this thread, thank you so much. I appreciate it, I really do.

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
  •