Lewis Posted November 28, 2016 Posted November 28, 2016 Hey, im looking to add cli parameters to my script. im looking for it to withdraw items that are on the cli parameters such as: test:log,apple,mind rune
Explv Posted November 28, 2016 Posted November 28, 2016 (edited) Hey, im looking to add cli parameters to my script. im looking for it to withdraw items that are on the cli parameters such as: test:log,apple,mind rune You get the script parameters string using the getParameters() method in the Script class String parameters = getParameters(); Edited November 28, 2016 by Explv
House Posted November 28, 2016 Posted November 28, 2016 do it? on a more serious note i'm guessing you are looking to find out how to do it? Should probably include a question then public String getParameterString(int i) { String[] parameters = getParameters().split("-"); return parameters[i].replace("_", " "); } public int getParameterInteger(int i) { String[] parameters = getParameters().split("-"); return Integer.parseInt(parameters[i]); } Example usage: -script AIOGodwarsDungeon:bandons-brews-1000
Lewis Posted November 28, 2016 Author Posted November 28, 2016 do it? on a more serious note i'm guessing you are looking to find out how to do it? Should probably include a question then i thought the thread being in script help would be pretty self explanatory also, what would i add to say, banking method such as: withdraw parameter 1
Explv Posted November 28, 2016 Posted November 28, 2016 (edited) i thought the thread being in script help would be pretty self explanatory also, what would i add to say, banking method such as: withdraw parameter 1 You can withdraw items from the bank using: getBank().withdraw(String itemName, int amount); Consider reading the API documentation: http://osbot.org/api/org/osbot/rs07/api/Bank.html#withdraw-java.lang.String-int- Edited November 28, 2016 by Explv
Lewis Posted November 28, 2016 Author Posted November 28, 2016 (edited) You can withdraw items from the bank using: getBank().withdraw(String itemName, int amount); i want to withdraw using parameters lol, i know how to withdraw normally lol such as bank.withdrawAll(PARAMETER_1); bank.withdrawAll(PARAMETER_2); Edited November 28, 2016 by Lewis
Explv Posted November 28, 2016 Posted November 28, 2016 i want to withdraw using parameters lol, i know how to withdraw normally lol such as bank.withdrawAll(PARAMETER_1); bank.withdrawAll(PARAMETER_2); I have shown you how to get the parameters String, parse the information you need from that String using whatever format you want. If you don't know what to do after that, I would recommend that you spend some more time learning Java, because this isn't really a scripting help question, it's just basic programming.
Lewis Posted November 28, 2016 Author Posted November 28, 2016 I have shown you how to get the parameters String, parse the information you need from that String using whatever format you want. If you don't know what to do after that, I would recommend that you spend some more time learning Java, because this isn't really a scripting help question, it's just basic programming. im sure this a help section for a reason lol
Explv Posted November 28, 2016 Posted November 28, 2016 (edited) im sure this a help section for a reason lol Yes and I have helped you, this is the scripting help section, not the teaching basics of Java section You get the parameters String using: String parameters = getParameters(); Parse the information you need from the String, store the results. Then when you want to withdraw from the bank you use getBank().withdraw(String itemName, int amount); Using your stored information. I am not going to write down every line of code to do that, because you should be able to do it if you have basic knowledge of Java. Which is why I am recommending, that if you DONT know how to do that, then you should learn some more Java then come back to Scripting. Edited November 28, 2016 by Explv
Lewis Posted November 28, 2016 Author Posted November 28, 2016 I have shown you how to get the parameters String, parse the information you need from that String using whatever format you want. If you don't know what to do after that, I would recommend that you spend some more time learning Java, because this isn't really a scripting help question, it's just basic programming. feel free to link me the appropriate info. Ive been googling it for the past 3 hours
Explv Posted November 28, 2016 Posted November 28, 2016 feel free to link me the appropriate info. Ive been googling it for the past 3 hours String class: https://docs.oracle.com/javase/8/docs/api/java/lang/String.html A tutorial on variables: https://www.tutorialspoint.com/java/java_variable_types.htm 1
Lewis Posted November 28, 2016 Author Posted November 28, 2016 Yes and I have helped you, this is the scripting help section, not the teaching basics of Java section I am not going to write down every line of code to do that, because you should be able to do it if you have basic knowledge of Java. Which is why I am recommending, that if you DONT know how to do that, then you should learn some more Java then come back to Scripting. no need to be a douche about it?
Explv Posted November 28, 2016 Posted November 28, 2016 no need to be a douche about it? I'm a douche for not writing your script for you? I don't see how recommending that you spend some more time learning Java to help yourself makes me a douche either. 3
Saiyan Posted November 28, 2016 Posted November 28, 2016 no need to be a douche about it? I'm a douche for not writing your script for you? I don't see how recommending that you spend some more time learning Java to help yourself makes me a douche either. Seeing as you have a indication in the right direction, going to close this. 1