January 27, 20179 yr My account needs to keep 4.3m gold in the inventory. The amount of gold before muling is a number above 4.3m. So I used the equation amount in inventory - 4.3m = amount to trade So in my code I put long x = getInventory().getAmount(995); long amountToTrade = x - 4300000; Now in my mule code, I put trade.offer(995, amountToTrade); Sadly this does not work even though all the math makes sense. I know the string requires an int but I cannot use int when i am getting the amount in the inventory. Any help or suggestions would be greatly appreciated
January 27, 20179 yr not sure if this is what you're looking for.. cast long to int trade.offer(995, Math.toIntExact(amountToTrade)); this will throw ArithmeticException if overflow (amountToTrade greater than 2,147,483,647)
January 27, 20179 yr Longs are not commonly used for this type of thing. Doubles would be easier. Also you can use Integer.ParseInt(input) to cast anything to an int, except I think BigInts. Which you should never need for OSRS
January 27, 20179 yr Author 1 hour ago, Stimpack said: not sure if this is what you're looking for.. cast long to int trade.offer(995, Math.toIntExact(amountToTrade)); this will throw ArithmeticException if overflow (amountToTrade greater than 2,147,483,647) Thanks it worked!
January 27, 20179 yr Yeah I was gonna say, an int should be fine so long as its under 2,147,483,647 gp which I would assume you don't make before trading to the mule; otherwise that'd be hella impressive
January 27, 20179 yr 13 minutes ago, Magarac said: Yeah I was gonna say, an int should be fine so long as its under 2,147,483,647 gp which I would assume you don't make before trading to the mule; otherwise that'd be hella impressive That is the max cash stack on rs so he cant really trade more than it
January 27, 20179 yr Just now, Tom said: That is the max cash stack on rs so he cant really trade more than it I feel dumb. Completely forgot about RS's own limits.
Create an account or sign in to comment