Winterbay
Active member
I tried having a script function that buys up to 5 of a number of things if I have less and not otherwise. The call looked like this:
	
	
	
		
where $item is exchanged for whatever it is I want to buy atm.
I thought it would stop buying things when I had 5 or more but it appears to not do this. I then tried some different commands and realised that if you send a negative amount or 0 to buy it will do odd things.
	
	
	
		
Is this the intended behaviour?
				
			
		Code:
	
	 cli_execute("buy " + (5 - item_amount($item)) + " " + $item);where $item is exchanged for whatever it is I want to buy atm.
I thought it would stop buying things when I had 5 or more but it appears to not do this. I then tried some different commands and realised that if you send a negative amount or 0 to buy it will do odd things.
		Code:
	
	> buy -1 bottle of gin
buy 9 bottle of gin for 151 each from 809809 on 20100812
You acquire bottle of gin (9)
---
> ash cli_execute("buy " + max(0,-1) + " bottle of gin");
buy 19 bottle of gin for 151 each from 809809 on 20100812
You acquire bottle of gin (19)Is this the intended behaviour?
 
	 
 
		