Log in

View Full Version : Invalid number of parameters...



Emaziz
02-15-2011, 08:51 PM
Code:
{*function getPrice, returns the guide price of the item with given ID*}
{*Original author: Da 0wner, modified by Emaziz. *}
function getPrice(ID : integer) : integer;
var
s, ss: string; Mid: variant;
Multiplicand, i: integer;
LetterArray: TStringArray;
begin
LetterArray := ['a','b','c','d','e','f','g','h','i','j','k','l','m ','n','o',
'p','q','r','s','t','u','v','w','x','y','z'];
s := GetPage('http://itemdb-rs.runescape.com/viewitem.ws?obj=' + IntToStr(ID));
if s = '' then
exit;
ss := Between('<b>Current guide price:</b> ', '<br><br>', s);
Mid := Replace(ss,#10,'', [rfReplaceAll]);
debug('Stupid getPrice shit fucked up');
Multiplicand := integer(pos('k', s) > 0) * 1000;
if not Multiplicand > 0 then
Multiplicand := integer(pos('m', s) > 0) * 1000000;
if Multiplicand = 0 then Multiplicand := 1;
for i := 0 to Length(LetterArray) - 1 do
Mid := Replace(Mid, LetterArray[i], '', [rfReplaceAll, rfIgnoreCase]);
Mid :=StrToFloat(Trim(Mid)) * Multiplicand;
Result := Mid;
end;
Error:
[Error] (338:44): Invalid number of parameters at line 337
Line 337 is "Mid := Replace(ss,#10,'', [rfReplaceAll]);"

I have absolutely no clue why this code gives an error. Help would be much appreciated!

Frement
02-15-2011, 08:54 PM
Try removing the last parameter.

Emaziz
02-15-2011, 08:59 PM
Try removing the last parameter.
Thanks, it worked! But it also confuses me. How come it works with a missing parameter?

Wizzup?
02-15-2011, 09:29 PM
I think SRL has it's own replace. It ``conflicts'' with Simba's replace. But it is there for compatibility.