leethacks27 Posted February 10, 2017 Share Posted February 10, 2017 Hello, Im new to scripting and cannot seem to work out how I can create a variable "money" which will be the amount of money/gold in my inventory. Any help? Quote Link to comment Share on other sites More sharing options...
Solution Posted February 10, 2017 Share Posted February 10, 2017 Try items by names or IDs. From the top of my head, the ID of coins is 995. Just take a look at the item api :P Quote Link to comment Share on other sites More sharing options...
Saiyan Posted February 10, 2017 Share Posted February 10, 2017 to store the amount of coins in a long variable it'd be long coinCount = getInventory().getAmount("Coins"); note if the inventory tab is not the current open tab it will be 0 i think 1 Quote Link to comment Share on other sites More sharing options...
Vilius Posted February 10, 2017 Share Posted February 10, 2017 2 hours ago, Saiyan said: to store the amount of coins in a long variable it'd be long coinCount = getInventory().getAmount("Coins"); note if the inventory tab is not the current open tab it will be 0 i think it should be int rather than long, because max cash stack is the value of the maximum int value. 1 Quote Link to comment Share on other sites More sharing options...
Juggles Posted February 10, 2017 Share Posted February 10, 2017 (edited) 18 minutes ago, Vilius said: it should be int rather than long, because max cash stack is the value of the maximum int value. Int won't work with that. You can use Math.toIntExact(coinCount) though to convert it getAmount(); only works with a long variable Edited February 10, 2017 by Juggles 2 Quote Link to comment Share on other sites More sharing options...
Hayase Posted February 10, 2017 Share Posted February 10, 2017 Since you say the gold is in your inventory why not just use getItem() and go from there? int geepees = getInventory().getItem(995).getAmount(); No need to use the Math class ^.^ 1 Quote Link to comment Share on other sites More sharing options...