August 19, 20178 yr Hi everyone, I need to know how to use multiple classes. I'm creating a little quester. I have a main class with the onloop() and i have a class for the cooks assistent quest called cookassistent. I want to script the whole procedure of cooks assistent in that class. How would i do that?
August 19, 20178 yr the simplest way to do this is to extend MethodProvider: class MyScriptStep extends MethodProvider { public void run() { getObjects().getAll()...; // Use OSBot API as you would in main script class } } Then in your script you would do class MyScript extends Script { // Define the MyScriptStep object private MyScriptStep scriptStep = new MyScriptStep(); // ... @Override public void onStart() { scriptStep.exchangeContext(getBot()); // Configure the MethodProvider to use this bot } // ... public int onLoop() { if (someCondition) { scriptStep.run(); // Run the step } } }
August 20, 20178 yr Author Hey @Lemons, Thank you for your quick reply! It worked like a charm :). Would this be the same method for a GUI class? EDIT:: Created a GUI the same way as you told me without extending the MethodProvider Thanks again dud. Edited August 20, 20178 yr by Sebastian
Create an account or sign in to comment