SRL Archive - OSR Help

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


ToinCoss

2015-03-09 15:55:35

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

SlipperyPickle

2015-03-09 15:57:12

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

Battousai

2015-03-09 15:57:41

From: ToinCoss
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

ToinCoss

2015-03-09 16:47:39

Thanks, guys!

ToinCoss

2015-03-10 15:31:19

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!