SRL Archive - RS3 Help

Returning an integer from a string?


KeepBotting

2014-06-25 20:18:10

Let's say I had a function that returns a string, how would I go about returning the integers (if any) from said string?

Ian

2014-06-25 20:20:10

From: KeepBotting
Let's say I had a function that returns a string, how would I go about returning the integers (if any) from said string?


So taking '5tr1n9' and getting '519'?

KeepBotting

2014-06-25 20:24:37

From: BMWxi
So taking '5tr1n9' and getting '519'?

Yes exactly

The Mayor

2014-06-25 21:02:42

From: KeepBotting
Yes exactly


just use extractFromStr using numbers


extractFromStr(string, numbers);

e.g:


program new;

const
string1 = 'h3ll0';

begin
writeLn(extractFromStr(string1, numbers));
end.

KeepBotting

2014-06-25 21:17:59

From: The Mayor
just use extractFromStr using numbers


extractFromStr(string, numbers);

e.g:


program new;

const
string1 = 'h3ll0';

begin
writeLn(extractFromStr(string1, numbers));
end.


Okay awesome thanks

Now I just need a way to return all the text on the last line of the chatbox, any idea how to do that? chatbox.findAnyText() allows you to set your own text to search for, and I don't want that. I just want to return the whole line.

Ian

2014-06-25 21:43:14

From: KeepBotting
Okay awesome thanks

Now I just need a way to return all the text on the last line of the chatbox, any idea how to do that? chatbox.findAnyText() allows you to set your own text to search for, and I don't want that. I just want to return the whole line.


You can use tesseractGetText.

For an example of how to use it see chatbox.getXP by Ashaman88: https://villavu.com/forum/showthread.php?t=107292

KeepBotting

2014-06-25 22:17:35

From: BMWxi
You can use tesseractGetText.

For an example of how to use it see chatbox.getXP by Ashaman88: https://villavu.com/forum/showthread.php?t=107292

Perfect that's exactly what I needed

Thanks all