TorRS Posted August 19, 2020 Share Posted August 19, 2020 (edited) I am new to scripting and so far when I created a script, I put it all in one class and things went pretty smoothly. But now I wanted to learn how to script while also using different classes and Ive tried stuff but nothing worked and I couldn't fin a tutorial on this anywhere. Would be awesome if someone could link a tutorial or something Edited August 19, 2020 by TorRS Quote Link to comment Share on other sites More sharing options...
Nbacon Posted August 19, 2020 Share Posted August 19, 2020 Hello, There are many ways of doing this. The Most Lazy Static Var of MethodProvider in Script public class TopLevel extends Script { public static MethodProvider methodProvider; public void onStart() throws InterruptedException { methodProvider =this; } .... Call it anywere with TopLevel.methodProvider Lazy way when you make a new class hand it the MethodProvider and store it in the class like so public class SomeClass{ final MethodProvider mp; public SomeClass(final MethodProvider mp){ this.mp = mp; } public void someMethod(){ mp.getBank().open(); } } The more "Professional" away were you extend MethodProvider and exchange Context. public class SomeClass extends MethodProvider { } public class TopLevel extends Script { MethodProvider something; public void onStart() throws InterruptedException { something = new SomeClass(); something.exchangeContext(getBot()); } .... 1 Quote Link to comment Share on other sites More sharing options...
TorRS Posted August 19, 2020 Author Share Posted August 19, 2020 Thanks a lot Quote Link to comment Share on other sites More sharing options...