Results 1 to 10 of 10

Thread: How to get the GE price of certain item?

  1. #1
    Join Date
    Nov 2014
    Posts
    44
    Mentioned
    0 Post(s)
    Quoted
    25 Post(s)

    Default How to get the GE price of certain item?

    What is the script for getting the GE price of certain item? The following script is extracted from iOak v1.1 from @KeepBotting;


    Simba Code:
    function getPrice(theItem:string):integer;
    var
      thePage, thePrice:string;
      t:TTimeMarker;
    begin
      t.start();
      thePage := getPage('http://runescape.wikia.com/wiki/Exchange:' + theItem);
      thePrice := between('GEPrice">', '</span>', thePage);
      thePrice := replace(thePrice, ',', '', [rfReplaceAll]);
      result := strToIntDef(thePrice, 0);
      t.pause();
      theItem := replace(theItem, '_', ' ', [rfReplaceAll]);
      writeDebug('Grabbed the price of ' + theItem + ' (' + thePrice + ') in ' + toStr(t.getTime()) + ' ms.');
    end;

    Is there a tutorial telling me what is happening in the above script? (I dunno what it is doing....)
    And another silly question...how to tag an user here?


    Bosco_FireRuneCrafter.png
    Attached Images Attached Images
    Last edited by boscolamhk; 12-31-2014 at 04:11 AM.

  2. #2
    Join Date
    Oct 2013
    Location
    East Coast USA
    Posts
    770
    Mentioned
    61 Post(s)
    Quoted
    364 Post(s)

    Default

    This is from Ross' tanner which is probably from something else....

    Simba Code:
    function getPrice(itemString: string): integer;
    var
      wikiaPage, priceString: string;
    begin
      wikiaPage := getPage('http://runescape.wikia.com/wiki/Exchange:' + itemString);
      priceString := between('GEPrice">', '</span>', wikiaPage);
      result := strToIntDef(ExtractFromStr(priceString, numbers), - 1);
      writeLn(itemString + ' price: ' + toStr(result));
    end;

  3. #3
    Join Date
    Nov 2014
    Posts
    44
    Mentioned
    0 Post(s)
    Quoted
    25 Post(s)

    Default

    Quote Originally Posted by bonsai View Post
    This is from Ross' tanner which is probably from something else....

    Simba Code:
    function getPrice(itemString: string): integer;
    var
      wikiaPage, priceString: string;
    begin
      wikiaPage := getPage('http://runescape.wikia.com/wiki/Exchange:' + itemString);
      priceString := between('GEPrice">', '</span>', wikiaPage);
      result := strToIntDef(ExtractFromStr(priceString, numbers), - 1);
      writeLn(itemString + ' price: ' + toStr(result));
    end;
    So how to use this function? For example, if I want to get the price of copper ore, should I just include the above function into my script and use:

    Simba Code:
    getPrice(copper_ore)

    like this?

  4. #4
    Join Date
    Jan 2012
    Posts
    1,596
    Mentioned
    78 Post(s)
    Quoted
    826 Post(s)

    Default

    Simba Code:
    copper_ore_price := getPrice('copper ore');

    but... you might have to do this...
    Simba Code:
    copper_ore_price := getPrice('copper%20ore');
    or maybe this...
    Simba Code:
    copper_ore_price := getPrice('copper_ore');

    You want to know what is happening? each line tells you whats going on.
    It grabs the entire webpage from rs wikia. gets whatever is between 'geprice>' and '<span'
    removes the commas, then turns that string of numbers into an integer.

  5. #5
    Join Date
    Nov 2014
    Posts
    44
    Mentioned
    0 Post(s)
    Quoted
    25 Post(s)

    Default

    Quote Originally Posted by Turpinator View Post
    Simba Code:
    copper_ore_price := getPrice('copper ore');

    but... you might have to do this...
    Simba Code:
    copper_ore_price := getPrice('copper%20ore');
    or maybe this...
    Simba Code:
    copper_ore_price := getPrice('copper_ore');

    You want to know what is happening? each line tells you whats going on.
    It grabs the entire webpage from rs wikia. gets whatever is between 'geprice>' and '<span'
    removes the commas, then turns that string of numbers into an integer.
    Oh...Thank you so much! I understand now.

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

    Default

    Nice, was wondering the same thing this morning

  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 bonsai View Post
    This is from Ross' tanner which is probably from something else....
    I think the original was by The Mayor, unsure though. If anyone knows, tell me and I'll update my script with credits accordingly

    Quote Originally Posted by Turpinator View Post
    Simba Code:
    copper_ore_price := getPrice('copper_ore');
    That one. It pulls from the RS Wikia which always uses underscores
    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

  8. #8
    Join Date
    Jan 2012
    Posts
    1,596
    Mentioned
    78 Post(s)
    Quoted
    826 Post(s)

    Default

    Quote Originally Posted by KeepBotting View Post
    I think the original was by The Mayor, unsure though. If anyone knows, tell me and I'll update my script with credits accordingly


    That one. It pulls from the RS Wikia which always uses underscores
    Buut... it needs to be 'Copper_ore'

    (writing one that fixes idiot's incorrect formatting)

    Here we go...
    Simba Code:
    function getGEPrice(itemName: string): integer;
    var
      wikiaPage, priceString: string;
      i, num: integer;
    begin
      num := ord(itemName[1]);
        if inRange(num, 97, 122) then
          itemName[1] := chr(num - 32);
      for i := 2 to length(itemName) do
      begin
        num := ord(itemName[i]);
        if inRange(num, 65, 90) then
          itemName[i] := chr(num + 32);
      end;

      itemName := replace(itemName, ' ', '_', [rfReplaceAll]);
      wikiaPage := getPage('http://runescape.wikia.com/wiki/Exchange:' + itemName);
      priceString := between('GEPrice">', '</span>', wikiaPage);
      result := strToIntDef(ExtractFromStr(priceString, numbers), -1);
      itemName := replace(itemName, '_', ' ', [rfReplaceAll]);
      writeLn(itemName + ' price: ' + toStr(result));
    end;

    i renamed it cause its more descriptive. rename it as you so desire.
    so this works with...
    Simba Code:
    getGEPrice('Copper_ore');
    getGEPrice('coPPer_oRe');
    getGEPrice('COPPER_ORE');
    getGEPrice('coPPer oRe');
    etc, etc...

  9. #9
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

  10. #10
    Join Date
    Nov 2014
    Posts
    44
    Mentioned
    0 Post(s)
    Quoted
    25 Post(s)

    Default

    Thanks for the original!
    so poowerful that it can also get high/low alch price!

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
  •