Results 1 to 5 of 5

Thread: How Can I Detect a string of text in the RS chatbox?

  1. #1
    Join Date
    Mar 2012
    Posts
    36
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Thumbs up How Can I Detect a string of text in the RS chatbox?

    I'm writing an item buyer script and I want it to hop worlds when the shop runs out of stock of that item. I noticed that the chatbox at the bottom of the game screen responds with "The shop has run out of stock," but I want my script to detect this and hop worlds after it pops up.

    I suspect there's a built-in procedure for this, but I have yet to find it.

    Any help is appreciated

    TL;DR - SOLUTION:
    chat.GetChatBoxText(Line, TextCol: Integer) -returns a String of text on the specified line of the chatbox (1-8, 8 is bottom) with color TextCol
    OR
    chat.FindChatBoxText
    Last edited by ToinCoss; 03-10-2015 at 07:33 PM. Reason: post solution in original post for future readers
    Toss the coin. Don't let the coin toss you.

  2. #2
    Join Date
    Sep 2014
    Location
    Netherlands
    Posts
    264
    Mentioned
    11 Post(s)
    Quoted
    130 Post(s)

    Default

    "chatbox.getTextOnLine" should do what you are looking for.

  3. #3
    Join Date
    Jan 2015
    Posts
    78
    Mentioned
    0 Post(s)
    Quoted
    48 Post(s)

    Default

    Quote Originally Posted by ToinCoss View Post
    I'm writing an item buyer script and I want it to hop worlds when the shop runs out of stock of that item. I noticed that the chatbox at the bottom of the game screen responds with "The shop has run out of stock," but I want my script to detect this and hop worlds after it pops up.

    I suspect there's a built-in procedure for this, but I have yet to find it.

    Any help is appreciated
    chatbox.findTextOnLines(['Hello'], [0..3]); Replace hello with your text and you will be good to go for the detecting if the text is there or not

  4. #4
    Join Date
    Mar 2012
    Posts
    36
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Thanks, guys!
    Toss the coin. Don't let the coin toss you.

  5. #5
    Join Date
    Mar 2012
    Posts
    36
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Just a head's up - the chatbox include is not in the OSR-SRL folder, but there is a different one that achieves the same function (I did some digging through the files to find it):

    chat.GetChatBoxText(Line, TextCol: Integer) -returns a String of text on the specified line of the chatbox (1-8, 8 is bottom) with color TextCol

    Decided to post this as a PSA for anyone having the problem I was having

    Happy Scripting!
    Toss the coin. Don't let the coin toss you.

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
  •