Sebastian Posted August 19, 2017 Share Posted August 19, 2017 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? Quote Link to comment Share on other sites More sharing options...
Lemons Posted August 19, 2017 Share Posted August 19, 2017 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 } } } 1 Quote Link to comment Share on other sites More sharing options...
Sebastian Posted August 20, 2017 Author Share Posted August 20, 2017 (edited) 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, 2017 by Sebastian Quote Link to comment Share on other sites More sharing options...