Results 1 to 7 of 7

Thread: Returning an integer from a string?

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

    Default Returning an integer from a string?

    Let's say I had a function that returns a string, how would I go about returning the integers (if any) from said string?
    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

  2. #2
    Join Date
    Jun 2012
    Posts
    4,867
    Mentioned
    74 Post(s)
    Quoted
    1663 Post(s)

    Default

    Quote Originally Posted by KeepBotting View Post
    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'?

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

    Default

    Quote Originally Posted by BMWxi View Post
    So taking '5tr1n9' and getting '519'?
    Yes exactly
    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

  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 KeepBotting View Post
    Yes exactly
    just use extractFromStr using numbers

    Simba Code:
    extractFromStr(string, numbers);

    e.g:

    Simba Code:
    program new;

    const
      string1 = 'h3ll0';

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

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

    Default

    Quote Originally Posted by The Mayor View Post
    just use extractFromStr using numbers

    Simba Code:
    extractFromStr(string, numbers);

    e.g:

    Simba Code:
    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.
    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

  6. #6
    Join Date
    Jun 2012
    Posts
    4,867
    Mentioned
    74 Post(s)
    Quoted
    1663 Post(s)

    Default

    Quote Originally Posted by KeepBotting View Post
    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

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

    Default

    Quote Originally Posted by BMWxi View Post
    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
    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

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
  •