Results 1 to 6 of 6

Thread: Looking up prices....

  1. #1
    Join Date
    Jun 2006
    Posts
    694
    Mentioned
    0 Post(s)
    Quoted
    31 Post(s)

    Default Looking up prices....

    Looking up prices from the ge off the website.

    If the value is over 1k it error's.

    Help? Here's my tester....

    Simba Code:
    program new;

    const
      SteelBarID = 'http://services.runescape.com/m=itemdb_rs/Steel_bar/viewitem.ws?obj=2353';
      CannonballID = 'http://services.runescape.com/m=itemdb_rs/Cannonball/viewitem.ws?obj=2';

      var
      site : string;
      SteelBarPrice, CannonballPrice : integer;

    procedure GetPrice;
    begin
      site := getpage(CannonballID);
      site := trim(Between('<b>Current guide price:</b> ','<br>', site));
      CannonballPrice := StrToIntDef(site, -1);
      site := getpage(SteelBarID);
      site := trim(Between('<b>Current guide price:</b> ','<br>', site));
      SteelBarPrice := StrToIntDef(site, -1);
    end;

    begin
      GetPrice;
      if SteelBarPrice or CannonballPrice < 0 then
      //PRICE FAILS IF OVER 1K
        writeln('Failed to get bar')
      else
        writeln('worked');
        Writeln('ball '+inttostr(CannonballPrice)+'gp.');
        Writeln('bar '+inttostr(SteelBarPrice)+'gp.');
    end.

  2. #2
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    TomTuff helped me with these.

    Simba Code:
    Function CashStringToInt(S: string): Integer;  //Thanks TomTuff!
      Var
        i, ii: Integer;
        Numbs: TStringArray;
        Temp: string;
      begin
        Temp := '';
        Numbs := ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'k', 'm', 'b'];
        for i := 1 to High(S) do
          for ii := 0 to High(Numbs) do
            if S[i] = Numbs[ii] then
              case ii of
                0..9: Temp := Temp + Numbs[ii];
                10..12:
                begin
                  Result := StrToInt(Temp);
                  case ii of
                    10: Result := Result * 100;        //Since price is given to 1 decimal,
                    11: Result := Result * 100000;     //instead of multiplying by the entire
                    12: Result := Result * 100000000;  //factor, you must multiply by factor/10
                  end;
                end;
              end;
        if (Result = 0) then
          Result := StrToInt(Temp);
      end;

      Function GetPrice(ItemID: Integer): Integer;
      begin
        Result := CashStringToInt(Between('<b>Current guide price:</b>', '<br><br>', GetPage('http://services.runescape.com/m=itemdb_rs/Shark/viewitem.ws?obj=' + ToStr(ItemID))));
      end;

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  3. #3
    Join Date
    Jun 2006
    Posts
    694
    Mentioned
    0 Post(s)
    Quoted
    31 Post(s)

    Default

    Quote Originally Posted by Flight View Post
    TomTuff helped me with these.
    Ah thanks that worked.

    Simba Code:
    {worked
    ball 416gp.
    bar 1003gp.
    Successfully executed.}


    program new;

    const
      SteelBarID = 'http://services.runescape.com/m=itemdb_rs/Steel_bar/viewitem.ws?obj=2353';
      CannonballID = 'http://services.runescape.com/m=itemdb_rs/Cannonball/viewitem.ws?obj=2';

      var
      site : string;
      SteelBarPrice, CannonballPrice : integer;

    procedure GetPrice;
    begin
      site := getpage(CannonballID);
      site := trim(Between('<b>Current guide price:</b> ','<br>', site));
      CannonballPrice := StrToIntDef(site, -1);
      site := getpage(SteelBarID);
      site := trim(Between('<b>Current guide price:</b> ','<br>', site));
      SteelBarPrice := StrToIntDef(site, -1);
    end;



    Function CashStringToInt(S: string): Integer;  //Thanks TomTuff!
      Var
        i, ii: Integer;
        Numbs: TStringArray;
        Temp: string;
      begin
        Temp := '';
        Numbs := ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'k', 'm', 'b'];
        for i := 1 to High(S) do
          for ii := 0 to High(Numbs) do
            if S[i] = Numbs[ii] then
              case ii of
                0..9: Temp := Temp + Numbs[ii];
                10..12:
                begin
                  Result := StrToInt(Temp);
                  case ii of
                    10: Result := Result * 100;        //Since price is given to 1 decimal,
                    11: Result := Result * 100000;     //instead of multiplying by the entire
                    12: Result := Result * 100000000;  //factor, you must multiply by factor/10
                  end;
                end;
              end;
        if (Result = 0) then
          Result := StrToInt(Temp);
      end;

      Function GetPrice1(ItemID: Integer): Integer;
      begin
        Result := CashStringToInt(Between('<b>Current guide price:</b>', '<br><br>', GetPage('http://services.runescape.com/m=itemdb_rs/Shark/viewitem.ws?obj=' + ToStr(ItemID))));
      end;

    begin
    cleardebug;
      CannonballPrice := GetPrice1(2);
      SteelBarPrice := GetPrice1(2353);
      if SteelBarPrice or CannonballPrice < 0 then
        writeln('Failed to get bar')
      else
        writeln('worked');
        Writeln('ball '+inttostr(CannonballPrice)+'gp.');
        Writeln('bar '+inttostr(SteelBarPrice)+'gp.');
    end.

  4. #4
    Join Date
    Jun 2006
    Posts
    694
    Mentioned
    0 Post(s)
    Quoted
    31 Post(s)

    Default

    Well awesome....There using tables now for GE.

    Code:
    <h6>Pricing Information:</h6>
    <table>
    <tbody>
    <tr>
    <th scope="row">Current guide price:</th>
    <td>1,003</td>
    </tr>
    <tr>
    <th scope="row">Today's Change:</th>
    <td class="positive">+20</td>
    </tr>
    </tbody>
    <tr>
    <th scope="row">30 Day Change:</th>
    <td class="positive">+70.5%</td>
    </tr>
    <tr>
    <th scope="row">90 Day Change:</th>
    <td class="positive">+37.9%</td>
    </tr>
    <tr>
    <th scope="row">180 Day Change:</th>
    <td class="positive">+49.7%</td>
    </tr>
    </table>

  5. #5
    Join Date
    Feb 2006
    Posts
    3,044
    Mentioned
    4 Post(s)
    Quoted
    21 Post(s)

    Default

    Fixed it for you.



    Simba Code:
    {worked
    ball 416gp.
    bar 1003gp.
    Successfully executed.}


    program new;

    const
      SteelBarID = 'http://services.runescape.com/m=itemdb_rs/Steel_bar/viewitem.ws?obj=2353';
      CannonballID = 'http://services.runescape.com/m=itemdb_rs/Cannonball/viewitem.ws?obj=2';

      var
      site : string;
      SteelBarPrice, CannonballPrice : integer;

    procedure GetPrice;
    begin
      site := getpage(CannonballID);
      site := trim(Between('<b>Current guide price:</b> ','<br>', site));
      CannonballPrice := StrToIntDef(site, -1);
      site := getpage(SteelBarID);
      site := trim(Between('<b>Current guide price:</b> ','<br>', site));
      SteelBarPrice := StrToIntDef(site, -1);
    end;



    Function CashStringToInt(S: string): Integer;  //Thanks TomTuff!
      Var
        i, ii: Integer;
        Numbs: TStringArray;
        Temp: string;
      begin
        Temp := '';
        Numbs := ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'k', 'm', 'b'];
        for i := 1 to High(S) do
          for ii := 0 to High(Numbs) do
            if S[i] = Numbs[ii] then
              case ii of
                0..9: Temp := Temp + Numbs[ii];
                10..12:
                begin
                  Result := StrToInt(Temp);
                  case ii of
                    10: Result := Result * 100;        //Since price is given to 1 decimal,
                    11: Result := Result * 100000;     //instead of multiplying by the entire
                    12: Result := Result * 100000000;  //factor, you must multiply by factor/10
                  end;
                end;
              end;
        if (Result = 0) then
          Result := StrToInt(Temp);
      end;

      Function GetPrice1(ItemID: Integer): Integer;
      begin
        Result := CashStringToInt(Between('<td>', '</td>', GetPage('http://services.runescape.com/m=itemdb_rs/viewitem.ws?obj=' + IntToStr(ItemID))));
      end;




    begin
    cleardebug;
      CannonballPrice := GetPrice1(2);
      SteelBarPrice := GetPrice1(2353);
      if SteelBarPrice or CannonballPrice < 0 then
        writeln('Failed to get bar')
      else
        writeln('worked');
        Writeln('ball '+inttostr(CannonballPrice)+'gp.');
        Writeln('bar '+inttostr(SteelBarPrice)+'gp.');
    end.


    ~Home

  6. #6
    Join Date
    Jun 2006
    Posts
    694
    Mentioned
    0 Post(s)
    Quoted
    31 Post(s)

    Default

    Quote Originally Posted by Home View Post
    Fixed it for you.



    Simba Code:
    code was here


    ~Home
    Lol thanks. I already fixed it before hand; just complaining about Jagex being retarded .

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
  •