SRL Archive - OSR Help

Get Text from chatbox


seany

2014-11-12 11:31:20

hello, i made a shop buying script which uses

GetAmountBox(InvBox(1)) < 15000)

to make sure i have enough coins if not it will end the script, problem is its very buggy and very regularly will not detect the incorrect amount and end the script.

now im wondering if its possible to detect when in the chatbox it says "you dont have enough coins"

is this possible? how is it done?

please help if you can!

thanks

seany

Kyle

2014-11-12 11:44:42

From: seany
hello, i made a shop buying script which uses

GetAmountBox(InvBox(1)) < 15000)

to make sure i have enough coins if not it will end the script, problem is its very buggy and very regularly will not detect the incorrect amount and end the script.

now im wondering if its possible to detect when in the chatbox it says "you dont have enough coins"

is this possible? how is it done?

please help if you can!

thanks

seany


if findBlackChatMessage('enough') then
Blah

Although, the getAmountBox should work, I would almost guess something is messed up elsewhere in your script, as I use it in quite a few different scripts and have never had it mess up before.

seany

2014-11-12 12:04:52

From: elfyyy
if findBlackChatMessage('enough') then
Blah

Although, the getAmountBox should work, I would almost guess something is messed up elsewhere in your script, as I use it in quite a few different scripts and have never had it mess up before.


thanks for the reply,

really? well i even Writeln directly after calling it, and it outputs 0.

do fonts need to be included?

seany

Kyle

2014-11-12 12:23:34

From: seany
thanks for the reply,

really? well i even Writeln directly after calling it, and it outputs 0.

do fonts need to be included?

seany



No, should work how it is… Maybe try hard coding the location of the inventory slot incase the invBox globals got changed for that slot?

seany

2014-11-12 12:26:52

From: elfyyy
No, should work how it is… Maybe try hard coding the location of the inventory slot incase the invBox globals got changed for that slot?


im not sure how to do that,

is it not a static position anyway though?

its weird because it works fine for 30 mins - a few hours then fails once, then i restart the script and its working again..

Kyle

2014-11-12 12:38:01

From: seany
im not sure how to do that,

is it not a static position anyway though?

its weird because it works fine for 30 mins - a few hours then fails once, then i restart the script and its working again..


As in do this:


getAmountBox(intToBox(X1, Y1, X2, Y2))

Where (X1, Y1) is the top left of the item slot, (X2, Y2) is the bottom right of the slot. The invBox(1) could be just on the edge of the money and depending on the amount of coins it could overflow and read the incorrect amount. At least that's the only thing I can think of…

seany

2014-11-12 12:50:40

From: elfyyy
As in do this:


getAmountBox(intToBox(X1, Y1, X2, Y2))

Where (X1, Y1) is the top left of the item slot, (X2, Y2) is the bottom right of the slot. The invBox(1) could be just on the edge of the money and depending on the amount of coins it could overflow and read the incorrect amount. At least that's the only thing I can think of…



okay thankyou i have just tried that, now fingers crossed its going to work.

Kyle

2014-11-12 12:56:22

From: seany
okay thankyou i have just tried that, now fingers crossed its going to work.


Haha let's hope!!!

seany

2014-11-12 13:38:57

From: elfyyy
Haha let's hope!!!


i have just tried it and its doing the same thing, it will work fine and then suddenly stop working, if i now restart the script it will work again.

this is what i used:

GetAmountBox(intToBox(560, 207, 597, 244));

seany

Kyle

2014-11-12 14:24:48

DO you have a skype? Id so add me "elfyyy-" @seany;

Kave

2014-11-13 14:09:31

Try..

if FindTextTPA(clBlack, 0, MCX1, MCY1, MCX2, MCY2,' enough ', CharsNPC07, Nothing) then Logout;

levunit

2014-11-13 19:34:24

If none of those work for you, I have made and used a DTM to find chat messages before. It works pretty good, but you have to remember to search in the area of the last line of the chat box, otherwise, it may see it farther up in the chat.

Turpinator

2014-11-13 20:05:23

Hasnt something like this come up before? Does it /NEED/ to be 15k? would 10k suffice? if so, make a dtm of the smaller stack of money and just check for that. if found… get more, logout, etc.