Page 1 of 3 123 LastLast
Results 1 to 25 of 51

Thread: GetPrice

  1. #1
    Join Date
    Jan 2012
    Posts
    1,104
    Mentioned
    18 Post(s)
    Quoted
    211 Post(s)

    Default GetPrice

    Here is a function for getting item prices from the zybez price guide. Calculates weighted average from the last X offers.
    API: http://forums.zybez.net/runescape-2007-prices/api/?info

    Simba Code:
    type
    Offer = record
      selling : Boolean;
      quantity : Integer;
      price : Integer;
      date : Integer;
      name : String;
      valid : Boolean;
      comment : String;
    end;



    function GetPrice(Item: String) : Integer;
    var
      str, templine, s1, s2 : String;
      Offers : Array[1..100] of Offer;
      explodes : Array of String;
      maxsamples, i, j,
      recentlow, recenthigh,  highalch  : Integer;
      buyquantity, sellquantity, buyvalue, sellvalue,
      buyprice, sellprice : Integer;
      DebugMode : Boolean;
    begin
      Result := 0;
      buyquantity := 0;
      sellquantity := 0;
      buyvalue := 0;
      sellvalue := 0;

      //DEBUG
      DebugMode := True;

      //last X offers
      maxsamples := 100;

      //getting page
      explodes := Explode(' ',Item);
      Item := Implode('+',explodes);

      str := GetPage('http://forums.zybez.net/runescape-2007-prices/api/' + Item);
      if (str = '{"error":"No results found."}') then
      begin
        Writeln('{"error":"No results found."}');
        Exit;
      end;

      explodes := Explode('+',Item);
      explodes[0] := Capitalize(explodes[0]);
      Item := Implode(' ',explodes);

      str := Between('"name":"'+Item+'"', ']}', str);
      str := str + ']}';

      recentlow := StrToInt(Between('recent_low":"', '"',str));
      recenthigh := StrToInt(Between('recent_high":"', '"',str));
      highalch := StrToInt(Between('high_alch":"', '"',str));

      str := Between('"offers":[', ']}', str);
      str := str + ',';

      //getting lines
      s1 := '{';
      s2 := '},';
      for i:=1 to maxsamples do
      begin
        templine := Between(s1, s2, str);
        s1 := templine + '},{';
        case Between('selling":"', '"', templine) of
          '0': Offers[i].selling := False;
          '1': Offers[i].selling := True;
        end;
        Offers[i].quantity  := CashStrToInt(Between('quantity":"', '"', templine));
        Offers[i].price     := CashStrToInt(Between('price":"', '"', templine));
        Offers[i].date      := CashStrToInt(Between('date":"', '"', templine));
        Offers[i].name      := Between('rs_name":"', '"', templine);
        Offers[i].valid     := True;
        Offers[i].comment   := '';
      end;

      //removing: name duplicates
      for i:=1 to maxsamples do
      begin
        j := 1;
        while (j < i) do
        begin
          if (Offers[i].name = Offers[j].name) then
          begin
            Offers[i].valid := False;
            Offers[i].comment := '[name duplicate]';
            Break;
          end;
          Inc(j);
        end;
      end;

      //removing: lower than 0.8*highalch
      for i:=1 to maxsamples do
      begin
        if (Offers[i].price < (highalch*0.8)) then
        begin
          Offers[i].valid := False;
          Offers[i].comment := '[lower than 0.8*highalch]';
        end;
      end;

      //removing: higher than 1.5*recenthigh
      for i:=1 to maxsamples do
      begin
        if not (recenthigh = 0) then
          if (Offers[i].price > (recenthigh*1.5)) then
          begin
            Offers[i].valid := False;
            Offers[i].comment := '[higher than 1.5*recenthigh]';
          end;
      end;

      //removing: overflow
      for i:=1 to maxsamples do
      begin
        if ((Offers[i].price * Offers[i].quantity) < 0) then
        begin
          Offers[i].valid := False;
          Offers[i].comment := '[overflow]';
        end;
      end;

      //Offers - DEBUG
      for i:=1 to maxsamples do
      begin
        Writeln('['+IntToStr(i)+'] '+ 'selling: '+BoolToStr(Offers[i].selling)+', quantity: '+IntToStr(Offers[i].quantity)+', price: '+IntToStr(Offers[i].price)+', date: '+IntToStr(Offers[i].date)+', name: '+Offers[i].name+', valid: '+BoolToStr(Offers[i].valid)+' '+Offers[i].comment);
      end;

      //getting quantities, prices
      for i:=1 to maxsamples do
      begin
        if (Offers[i].valid = True) then
        begin
          if (Offers[i].selling = True) then
          begin
            sellvalue := sellvalue + Offers[i].quantity * Offers[i].price;
            sellquantity := sellquantity + Offers[i].quantity;
          end;

          if (Offers[i].selling = False) then
          begin
            buyvalue := buyvalue + Offers[i].quantity * Offers[i].price;
            buyquantity := buyquantity + Offers[i].quantity;
          end;
        end;
      end;

      //calculating result
      if not (buyquantity = 0) then
        buyprice := buyvalue / buyquantity
      else
        buyprice := 0;
      if not (sellquantity = 0) then
        sellprice := sellvalue / sellquantity
      else
        sellprice := 0;
      Result := (buyprice + sellprice) / 2;

      //DEBUG
      if DebugMode then
      begin
        Writeln('buyprice: ' + IntToStr(buyprice));
        Writeln('buyvalue: ' + IntToStr(buyvalue));
        Writeln('buyquantity: ' + IntToStr(buyquantity));
        Writeln('sellprice: ' + IntToStr(sellprice));
        Writeln('sellvalue: ' + IntToStr(sellvalue));
        Writeln('sellquantity: ' + IntToStr(sellquantity));
      end;
    end;

    Simba Code:
    Writeln(IntToStr(GetPrice('rune scimitar')));

    (Working on this...)
    CalcInvPrice. Calculates the price of the inventory, using GetPrice or manual prices for each items.
    Simba Code:
    program PriceChecker;
    {$DEFINE SMART}
    {$I SRL-OSR/SRL.simba}

    {$IFDEF SMART}
      {$I SRL-OSR/SRL/misc/SmartGraphics.simba}
    {$ENDIF}
    const

      ManualPrice = False;
        //set it True if you want to set the prices yourself
        //set it False if you want to use zybez price guide prices


    type
    Item = record
      name : String;
      amount : Integer;
      price : Integer;
    end;



    function GetPrice(Item: String) : Integer;
    var
      str, templine, s1, s2 : String;
      name, selling, quantity, price : String;
      Lines, Names : Array[1..100] of String;
      maxsamples, i, j,
      buyquantity, sellquantity, buyvalue, sellvalue,
      buyprice, sellprice: Integer;
      match  : Boolean;
    begin
      Result := 0;
      //last X offers
      maxsamples := 50;

      buyquantity := 0;
      sellquantity := 0;
      buyvalue := 0;
      sellvalue := 0;

      //getting page
      str := GetPage('http://forums.zybez.net/runescape-2007-prices/api/' + Item);
      if (str = '{"error":"No results found."}') then Exit;
      str := Between('"offers":[', ']}]', str);
      str := str + ',';

      s1 := '{';
      s2 := '},';

      //getting lines
      for i:=1 to maxsamples do
      begin
        templine := Between(s1, s2, str);
        s1 := templine + '},{';
        Lines[i] := templine;
      end;

      //getting names, removing duplicates
      for i:=1 to maxsamples do
      begin
        name := Between('"rs_name":"', '"', Lines[i]);
        match := False;
        j := 1;
        while ((j < i) and (match = False)) do
        begin
          if (name = Names[j]) then
            match := True;
          Inc(j);
        end;
        if (match = False) then
          Names[i] := name
        else
          Lines[i] := '-------------------------------- DELETED, NAME DUPLICATES --------------------------------';
      end;

      //getting quantities, prices
      for i:=1 to maxsamples do
      begin
        templine := Lines[i];
        if not (templine = '') then
        begin
          selling := Between('"selling":"', '"', templine);
          quantity := Between('"quantity":"', '"', templine);
          price := Between('"price":"', '"', templine);

          if (selling = '1') then
          begin
            sellvalue := sellvalue + StrToInt(quantity) * StrToInt(price);
            sellquantity := sellquantity + StrToInt(quantity);
          end;

          if (selling = '0') then
          begin
            buyvalue := buyvalue + StrToInt(quantity) * StrToInt(price);
            buyquantity := buyquantity + StrToInt(quantity);
          end;
        end;
      end;
      if not (buyquantity = 0) then
        buyprice := Round(buyvalue / buyquantity)
      else
        buyprice := 0;
      if not (sellquantity = 0) then
        sellprice := Round(sellvalue / sellquantity)
      else
        sellprice := 0;
      Result := (buyprice + sellprice) / 2;

      //DEBUG
      //for i:=1 to maxsamples do
      //  Writeln('[' + IntToStr(i) + '] ' + Lines[i]);
      //Writeln('buyprice: ' + IntToStr(buyprice));
      //Writeln('buyvalue: ' + IntToStr(buyvalue));
      //Writeln('buyquantity: ' + IntToStr(buyquantity));
      //Writeln('sellprice: ' + IntToStr(sellprice));
      //Writeln('sellvalue: ' + IntToStr(sellvalue));
      //Writeln('sellquantity: ' + IntToStr(sellquantity));
    end;



    function FormatValue(value : Integer) : String;
    var
      kmod, mmod : Integer;
    begin
      if (value < 1000) then
        Result := IntToStr(value)
      else
      begin
        kmod := value mod 1000;
        Result := IntToStr((value-kmod)/1000) + 'k';
      end;
    end;



    procedure CalcInvPrice;
    var
      X,Y, i, sum, price : Integer;
      opts : Array of TOptions;
      text, input : String;
      Items : Array[1..28] of Item;
    begin
      for i:=1 to 28 do
      begin
        if ExistsItem(i) then
        begin
          Items[i].amount :=  GetAmountBox(InvBox(i));
        end;
      end;

      for i:=1 to 28 do
      begin
        if ExistsItem(i) then
        begin
          MouseItem(i,mouse_right);
          opts := GetChooseOptions;
          text := opts[High(opts)-1].str;

          text := Replace(text,'Examine ','');
          text := Replace(text,'Examine','');

          Items[i].name := text;
          ChooseOption('asd');
        end;
      end;

      sum := 0;
      for i:=1 to 28 do
      begin
        if not (Items[i].amount = 0) then
        begin
          if (Items[i].name = 'Coins') then
          begin
            Writeln(IntToStr(Items[i].amount) + ' x ' + Items[i].name + ' = ' + FormatValue(Items[i].amount));
            sum := sum + Items[i].amount;
          end else
          begin
            text := Items[i].name;
            text := Replace(text,' ','+');
            if ManualPrice then
              if InPutQuery('Price',Items[i].name + ':',input) then
                price := StrToInt(input)
              else
                price := GetPrice(text)
            else
              price := GetPrice(text);
            Writeln(IntToStr(Items[i].amount) + ' x ' + Items[i].name + ' = ' + IntToStr(Items[i].amount) + ' x ' + IntToStr(price) + ' = ' + FormatValue(Items[i].amount*price));
            sum := sum + Items[i].amount*price;
          end;
        end;
      end;

      Writeln('');
      Writeln('Total value: ' + FormatValue(sum));
    end;



    begin
      ClearDebug;
      SetupSRL;
      CalcInvPrice;
    end.
    Last edited by Shatterhand; 06-01-2013 at 09:08 AM. Reason: updated GetPrice.

  2. #2
    Join Date
    Mar 2013
    Posts
    35
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    The average price for the item on Zybez is 99% totally inaccurate. However, I do like this piece of code and will certainly be useful in fighter scripts.

  3. #3
    Join Date
    Feb 2013
    Posts
    26
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    This could be useful for getting gp/hr on scripts :P

  4. #4
    Join Date
    Mar 2013
    Location
    The Netherlands
    Posts
    185
    Mentioned
    2 Post(s)
    Quoted
    70 Post(s)

    Default

    This is going in my fishing script . Will credit you. This is awesome!
    Nothing to do here :l.

  5. #5
    Join Date
    Apr 2013
    Posts
    395
    Mentioned
    1 Post(s)
    Quoted
    177 Post(s)

    Default

    Wonder if you could exclude the unreasonable price and only find the average of the reasonable price. Let's say the item is buying/selling at the range of 140gp-160gp, but someone accidently typed 1500gp.

  6. #6
    Join Date
    Mar 2013
    Location
    The Netherlands
    Posts
    185
    Mentioned
    2 Post(s)
    Quoted
    70 Post(s)

    Default

    Yeah, sadly the prices aren't that accurate. I put the pricechecker in a script of mine and some of the fish are a little overpriced. , but other fish seem p. accurate.
    Nothing to do here :l.

  7. #7
    Join Date
    Jan 2012
    Posts
    1,104
    Mentioned
    18 Post(s)
    Quoted
    211 Post(s)

    Default

    Yea well its not that accurate, but better than nothing.

  8. #8
    Join Date
    Sep 2008
    Posts
    754
    Mentioned
    8 Post(s)
    Quoted
    275 Post(s)

    Default

    Very nice! Thank you!.

  9. #9
    Join Date
    Nov 2006
    Posts
    49
    Mentioned
    0 Post(s)
    Quoted
    18 Post(s)

    Default

    I was going to make something similar to this for my irc bot when the price guide first came out, then I noticed the price manipulation and thought it might be a better idea to work out a formula to grab all the buy/sell prices, remove outliers and then avg those for a more accurate market price.

  10. #10
    Join Date
    Jan 2012
    Posts
    1,104
    Mentioned
    18 Post(s)
    Quoted
    211 Post(s)

    Default

    Quote Originally Posted by pescados666 View Post
    I was going to make something similar to this for my irc bot when the price guide first came out, then I noticed the price manipulation and thought it might be a better idea to work out a formula to grab all the buy/sell prices, remove outliers and then avg those for a more accurate market price.
    Hmm. And how would you do that? What prices count as outliers? Like prices not between recent low and high? Or determining one price from the rest prices average +/- 10%, and mark as outlier if not in range?
    I need ideas.

    EDIT: Added new version.
    Last edited by Shatterhand; 05-13-2013 at 04:39 PM.

  11. #11
    Join Date
    May 2012
    Posts
    27
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    so how can i make it into a actual script for my clan chat?

  12. #12
    Join Date
    May 2012
    Posts
    27
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    and i added this
    program new;
    {$Define Smart}
    {$i srl/srl.simba}
    function GetPrice(Item: String) : Integer;
    var
    str, templine, s1, s2 : String;
    name, selling, quantity, price : String;
    Lines, Names : Array[1..100] of String;
    maxsamples, i, j,
    buyquantity, sellquantity, buyvalue, sellvalue,
    buyprice, sellprice: Integer;
    match : Boolean;
    begin
    //last X offers
    maxsamples := 50;

    buyquantity := 0;
    sellquantity := 0;
    buyvalue := 0;
    sellvalue := 0;

    //getting page
    str := GetPage('http://forums.zybez.net/runescape-2007-prices/api/' + Item);
    str := Between('"offers":[', ']}]', str);
    str := str + ',';

    s1 := '{';
    s2 := '},';

    //getting lines
    for i:=1 to maxsamples do
    begin
    templine := Between(s1, s2, str);
    s1 := templine + '},{';
    Lines[i] := templine;
    end;

    //getting names, removing duplicates
    for i:=1 to maxsamples do
    begin
    name := Between('"rs_name":"', '"', Lines[i]);
    match := False;
    j := 1;
    while ((j < i) and (match = False)) do
    begin
    if (name = Names[j]) then
    match := True;
    Inc(j);
    end;
    if (match = False) then
    Names[i] := name
    else
    Lines[i] := '-------------------------------- DELETED, NAME DUPLICATES --------------------------------';
    end;

    //getting quantities, prices
    for i:=1 to maxsamples do
    begin
    templine := Lines[i];
    if not (templine = '') then
    begin
    selling := Between('"selling":"', '"', templine);
    quantity := Between('"quantity":"', '"', templine);
    price := Between('"price":"', '"', templine);

    if (selling = '1') then
    begin
    sellvalue := sellvalue + StrToInt(quantity) * StrToInt(price);
    sellquantity := sellquantity + StrToInt(quantity);
    end;

    if (selling = '0') then
    begin
    buyvalue := buyvalue + StrToInt(quantity) * StrToInt(price);
    buyquantity := buyquantity + StrToInt(quantity);
    end;
    end;
    end;

    buyprice := buyvalue / buyquantity;
    sellprice := sellvalue / sellquantity;
    Result := (buyprice + sellprice) / 2;

    //DEBUG
    for i:=1 to maxsamples do
    Writeln('[' + IntToStr(i) + '] ' + Lines[i]);
    Writeln('Buy: ' + IntToStr(buyprice));
    Writeln('Sell: ' + IntToStr(sellprice));
    end;
    begin
    end.


    i know it's probabley 100% wrong i just started scripting can you help please?

  13. #13
    Join Date
    Jan 2012
    Posts
    1,104
    Mentioned
    18 Post(s)
    Quoted
    211 Post(s)

    Default

    Quote Originally Posted by mohammed49 View Post
    i know it's probabley 100% wrong i just started scripting can you help please?
    You have to call the function itself in the begin-end block at the bottom.

  14. #14
    Join Date
    May 2012
    Posts
    27
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    to be honest i just started learning i can only make simple scripts such as typers and stuff can you explain it to me or help me make it i need it to tell the price in the clan chat when a player says !pc rune scimitar ect you know what im talking about?

  15. #15
    Join Date
    May 2012
    Posts
    27
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    can you pm on how to make it or it i really dont wanna ask you to do it just a waste of time for you lol but help me out man

  16. #16
    Join Date
    May 2012
    Posts
    27
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    i need it asap man can you please show me how? im sorry im just not that good at this kind of stuff

  17. #17
    Join Date
    May 2012
    Posts
    27
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    this is what i came up with? still doesn't work
    program new;
    {$Define Smart}
    {$i srl/srl.simba}
    function GetPrice(Item: String) : Integer;
    var
    str, templine, s1, s2 : String;
    name, selling, quantity, price : String;
    Lines, Names : Array[1..100] of String;
    maxsamples, i, j,
    buyquantity, sellquantity, buyvalue, sellvalue,
    buyprice, sellprice: Integer;
    match : Boolean;
    begin
    //last X offers
    maxsamples := 50;

    buyquantity := 0;
    sellquantity := 0;
    buyvalue := 0;
    sellvalue := 0;

    //getting page
    str := GetPage('http://forums.zybez.net/runescape-2007-prices/api/' + Item);
    str := Between('"offers":[', ']}]', str);
    str := str + ',';

    s1 := '{';
    s2 := '},';

    //getting lines
    for i:=1 to maxsamples do
    begin
    templine := Between(s1, s2, str);
    s1 := templine + '},{';
    Lines[i] := templine;
    end;

    //getting names, removing duplicates
    for i:=1 to maxsamples do
    begin
    name := Between('"rs_name":"', '"', Lines[i]);
    match := False;
    j := 1;
    while ((j < i) and (match = False)) do
    begin
    if (name = Names[j]) then
    match := True;
    Inc(j);
    end;
    if (match = False) then
    Names[i] := name
    else
    Lines[i] := '-------------------------------- DELETED, NAME DUPLICATES --------------------------------';
    end;

    //getting quantities, prices
    for i:=1 to maxsamples do
    begin
    templine := Lines[i];
    if not (templine = '') then
    begin
    selling := Between('"selling":"', '"', templine);
    quantity := Between('"quantity":"', '"', templine);
    price := Between('"price":"', '"', templine);

    if (selling = '1') then
    begin
    sellvalue := sellvalue + StrToInt(quantity) * StrToInt(price);
    sellquantity := sellquantity + StrToInt(quantity);
    end;

    if (selling = '0') then
    begin
    buyvalue := buyvalue + StrToInt(quantity) * StrToInt(price);
    buyquantity := buyquantity + StrToInt(quantity);
    end;
    end;
    end;

    buyprice := buyvalue / buyquantity;
    sellprice := sellvalue / sellquantity;
    Result := (buyprice + sellprice) / 2;

    //DEBUG
    for i:=1 to maxsamples do
    Writeln('[' + IntToStr(i) + '] ' + Lines[i]);
    Writeln('Buy: ' + IntToStr(buyprice));
    Writeln('Sell: ' + IntToStr(sellprice));
    end;
    begin
    getprice;
    end.
    begin
    end.

  18. #18
    Join Date
    May 2012
    Posts
    27
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    latest thing i came up with it runs open runescape then stops
    program new;
    {$Define Smart}
    {$i srl/srl.simba}
    begin
    setupSRL;
    end.

    procedure GetPrice(Item: String) : Integer;
    var
    str, templine, s1, s2 : String;
    name, selling, quantity, price : String;
    Lines, Names : Array[1..100] of String;
    maxsamples, i, j,
    buyquantity, sellquantity, buyvalue, sellvalue,
    buyprice, sellprice: Integer;
    match : Boolean;
    begin
    //last X offers
    maxsamples := 50;

    buyquantity := 0;
    sellquantity := 0;
    buyvalue := 0;
    sellvalue := 0;

    //getting page
    str := GetPage('http://forums.zybez.net/runescape-2007-prices/api/' + Item);
    str := Between('"offers":[', ']}]', str);
    str := str + ',';

    s1 := '{';
    s2 := '},';

    //getting lines
    for i:=1 to maxsamples do
    begin
    templine := Between(s1, s2, str);
    s1 := templine + '},{';
    Lines[i] := templine;
    end;

    //getting names, removing duplicates
    for i:=1 to maxsamples do
    begin
    name := Between('"rs_name":"', '"', Lines[i]);
    match := False;
    j := 1;
    while ((j < i) and (match = False)) do
    begin
    if (name = Names[j]) then
    match := True;
    Inc(j);
    end;
    if (match = False) then
    Names[i] := name
    else
    Lines[i] := '-------------------------------- DELETED, NAME DUPLICATES --------------------------------';
    end;

    //getting quantities, prices
    for i:=1 to maxsamples do
    begin
    templine := Lines[i];
    if not (templine = '') then
    begin
    selling := Between('"selling":"', '"', templine);
    quantity := Between('"quantity":"', '"', templine);
    price := Between('"price":"', '"', templine);

    if (selling = '1') then
    begin
    sellvalue := sellvalue + StrToInt(quantity) * StrToInt(price);
    sellquantity := sellquantity + StrToInt(quantity);
    end;

    if (selling = '0') then
    begin
    buyvalue := buyvalue + StrToInt(quantity) * StrToInt(price);
    buyquantity := buyquantity + StrToInt(quantity);
    end;
    end;
    end;

    buyprice := buyvalue / buyquantity;
    sellprice := sellvalue / sellquantity;
    Result := (buyprice + sellprice) / 2;

    //DEBUG
    for i:=1 to maxsamples do
    Writeln('[' + IntToStr(i) + '] ' + Lines[i]);
    Writeln('Buy: ' + IntToStr(buyprice));
    Writeln('Sell: ' + IntToStr(sellprice));
    end;
    begin
    function Getprice;
    end.

  19. #19
    Join Date
    Mar 2013
    Location
    The Netherlands
    Posts
    185
    Mentioned
    2 Post(s)
    Quoted
    70 Post(s)

    Default

    Made you a pcer...

    Code:
    program Pricechecker;
    {$DEFINE SMART}
    {$I SRL-OSR/SRL.Simba}
    var
    LastT : string;
    
    function GetPrice(Item: String) : Integer; // Made by Shatterhand, you're awesome! :)
    var
      str : String;
    begin
      str := Between('"average":"','"',GetPage('http://forums.zybez.net/runescape-2007-prices/api/' + Item));
      Result := Round(StrToFloat(str));
    end;
    
    procedure Start;
    var
    I: integer;
    T : string;
    Expl : TStringArray;
    
    begin
      repeat
        T := lowercase(GetChatBoxText(8, 128));
        Expl := explode(' ', T)
    
        for I:=0 to high(Expl) do
        begin
          if (Expl[I] = '!pc') then
          begin
            T := replace(T, '!pc ', '');
            T := replace(T, ' ', '+');
    
            if not (T = LastT) then
            begin
              LastT := T;
              writeLn(T)
              TypeSend('/Pricechecked at ' + IntTostr(GetPrice(T)) + ' GP')
            end;
          end;
        end;
      until false;
    end;
    
    begin
      SetUpsrl;
      ActivateClient;
    
      Start;
    end.
    Nothing to do here :l.

  20. #20
    Join Date
    May 2012
    Posts
    27
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    omfg if this works i love you !

  21. #21
    Join Date
    May 2012
    Posts
    27
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Quote Originally Posted by jelknab View Post
    Made you a pcer...

    Code:
    program Pricechecker;
    {$DEFINE SMART}
    {$I SRL-OSR/SRL.Simba}
    var
    LastT : string;
    
    function GetPrice(Item: String) : Integer; // Made by Shatterhand, you're awesome! :)
    var
      str : String;
    begin
      str := Between('"average":"','"',GetPage('http://forums.zybez.net/runescape-2007-prices/api/' + Item));
      Result := Round(StrToFloat(str));
    end;
    
    procedure Start;
    var
    I: integer;
    T : string;
    Expl : TStringArray;
    
    begin
      repeat
        T := lowercase(GetChatBoxText(8, 128));
        Expl := explode(' ', T)
    
        for I:=0 to high(Expl) do
        begin
          if (Expl[I] = '!pc') then
          begin
            T := replace(T, '!pc ', '');
            T := replace(T, ' ', '+');
    
            if not (T = LastT) then
            begin
              LastT := T;
              writeLn(T)
              TypeSend('/Pricechecked at ' + IntTostr(GetPrice(T)) + ' GP')
            end;
          end;
        end;
      until false;
    end;
    
    begin
      SetUpsrl;
      ActivateClient;
    
      Start;
    end.
    i get this error
    rror: Exception: Invalid float at line 12
    help me anyone

  22. #22
    Join Date
    Mar 2013
    Location
    The Netherlands
    Posts
    185
    Mentioned
    2 Post(s)
    Quoted
    70 Post(s)

    Default

    Code:
    program Pricechecker;
    {$DEFINE SMART}
    {$I SRL-OSR/SRL.Simba}
    var
    LastT : string;
    
    function GetPrice(Item: String) : Integer; // Made by Shatterhand, you're awesome! :)
    var
      str : String;
    begin
      str := Between('"average":"','"',GetPage('http://forums.zybez.net/runescape-2007-prices/api/' + Item));
      if (str = '') then exit;
      Result := Round(StrToFloat(str));
    end;
    
    procedure Start;
    var
    I: integer;
    T : string;
    Expl : TStringArray;
    
    begin
      repeat
        T := lowercase(GetChatBoxText(8, 128));
        Expl := explode(' ', T)
    
        for I:=0 to high(Expl) do
        begin
          if (Expl[I] = '!pc') then
          begin
            T := replace(T, '!pc ', '');
            T := replace(T, ' ', '+');
    
            if not (T = LastT) then
            begin
              LastT := T;
              writeLn(T)
              TypeSend('/Pricechecked at ' + IntTostr(GetPrice(T)) + ' GP')
            end;
          end;
        end;
      until false;
    end;
    
    begin
      SetUpsrl;
      ActivateClient;
    
      Start;
    end.
    Nothing to do here :l.

  23. #23
    Join Date
    May 2012
    Posts
    27
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    look what i need is a pc bot that works on command !price (item) and can speak in clan chat does this do it?

  24. #24
    Join Date
    May 2012
    Posts
    27
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    How can i make it open eoc or sit in lobby and answer price checks

  25. #25
    Join Date
    May 2012
    Posts
    27
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    can u make it open up eoc i dont want my 07 banned
    Quote Originally Posted by jelknab View Post
    Code:
    program Pricechecker;
    {$DEFINE SMART}
    {$I SRL-OSR/SRL.Simba}
    var
    LastT : string;
    
    function GetPrice(Item: String) : Integer; // Made by Shatterhand, you're awesome! :)
    var
      str : String;
    begin
      str := Between('"average":"','"',GetPage('http://forums.zybez.net/runescape-2007-prices/api/' + Item));
      if (str = '') then exit;
      Result := Round(StrToFloat(str));
    end;
    
    procedure Start;
    var
    I: integer;
    T : string;
    Expl : TStringArray;
    
    begin
      repeat
        T := lowercase(GetChatBoxText(8, 128));
        Expl := explode(' ', T)
    
        for I:=0 to high(Expl) do
        begin
          if (Expl[I] = '!pc') then
          begin
            T := replace(T, '!pc ', '');
            T := replace(T, ' ', '+');
    
            if not (T = LastT) then
            begin
              LastT := T;
              writeLn(T)
              TypeSend('/Pricechecked at ' + IntTostr(GetPrice(T)) + ' GP')
            end;
          end;
        end;
      until false;
    end;
    
    begin
      SetUpsrl;
      ActivateClient;
    
      Start;
    end.

Page 1 of 3 123 LastLast

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
  •