SRL Archive - Discussions and Debates

Is the amount function broken?


krunkjuice

2006-12-08 20:55:43

I tried using it on many occasions and all of the scripts act like it's not there. For instance i say
if(amount('shop',7)) >= (10+random(10)) then Mouse(blah blah blah); 

And also phantombmx uses it in his featherbuyer script and it has recently broke. I tried updating it and got it to compile, however it does the same thing. So it lead me to believe that it is the amount that is messing everything up. Is anyone else having this problem?

Boreas

2006-12-08 22:59:40

I dunno but did you call setupsrl? Because anything with text needs that to load the fonts.

Cheesehunk

2006-12-08 23:38:44

If it is trying to count coin amounts, it's hard. Coins are in stacks, so a Bitmap of the coin is hard to work with. If the script is using Colours for the Coin's amount, then make sure the colour is write.

Anyways, last time I checked, The amount functions were working.

Yakman

2006-12-09 07:18:56

i remember using this function a while ago, its not in amount.scar, i think its called "CountInvSpot" probably in inventory.scar

krunkjuice

2006-12-09 09:45:18

Well Im looking for items in the shop, specifically feeathers. But I didnt use the setup srl so that is probably my problem. I try it out. Thanks

masquerader

2006-12-09 22:05:38

amount.scar uses the tradechars font, which it loads on the run :p

i'll check if it still works really quick

im never quite sure if the coin bmp works or not, but the shop thing should work for sure

edit:
nope,

writeln(inttostr(amount('shop',7)));

still worked in the fishing shop for me

maybe its a problem with your usage
maybe this will help you: http://www.villu-reborn.com/srl_manual/index.php?title=Amount.scar

krunkjuice

2006-12-09 23:15:37

So then what am I doing wrong with this procedure?

procedure feather;
begin


if(amount('shop',7)>=(960+random(10)))then
begin;
wait(200+random(100))
mouse(379,83,5,5,false);
Wait(100+random(100));
if(IsUpText('Buy 10')) then
ClickOption('Buy 10', 1 )
feathercount:=feathercount+10
wait(100+random(100));

end;

And here is my main loop
begin
setupsrl;
loadbmps;
repeat
feather;
until(feathercount<=featherstobuy);

end.

Edit: sorry there may be some compiling errors just ignore them, it is my usage of the amount function that need to be adresses lol.

Bam Bam

2006-12-12 15:58:35

From: krunkjuice
So then what am I doing wrong with this procedure?

procedure feather;
begin


if(amount('shop',7)>=(960+random(10)))then
begin;
wait(200+random(100))
mouse(379,83,5,5,false);
Wait(100+random(100));
if(IsUpText('Buy 10')) then
ClickOption('Buy 10', 1 )
feathercount:=feathercount+10
wait(100+random(100));

end;

And here is my main loop
begin
setupsrl;
loadbmps;
repeat
feather;
until(feathercount<=featherstobuy);

end.

Edit: sorry there may be some compiling errors just ignore them, it is my usage of the amount function that need to be adresses lol.


you need another end;?
But other than that the usage looks correct to me…

I noticed a few possible syntactical errors, this is how I think it should look:


procedure feather;
begin
if(amount('shop',7)>=(960+random(10)))then
begin;
wait(200+random(100))
mouse(379,83,5,5,false);
Wait(100+random(100));
if(IsUpText('Buy 10')) then
begin
ClickOption('Buy 10', 1 );
feathercount:=feathercount+10
wait(100+random(100));
end;
end;
end;