Reflexd Posted February 10, 2016 Share Posted February 10, 2016 (edited) I'm trying to call a function in the main class from another class called CookFood, but it doesn't want to work. Everything inside the CookFood class works fine, like getting the food name and the actual cooking. CookFood: package reflexd; import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.api.ui.RS2Widget; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.MethodProvider; import reflexd.Main; public class CookFood { private Main main = new Main(); private String foodName = main.getFoodName(); // works public CookFood(Script s) throws InterruptedException { main.changeStatus("Moving camera"); // doesn't work } } The function in Main that I'm trying to access: public void changeStatus(String status) { scriptStatus = status; } How I'm initializing CookFood: case COOK: new CookFood(this); break; It doesn't spit out any errors or anything at all in the logger, don't really know what to do. Any help is greatly appreciated. Edited February 10, 2016 by Reflexd Quote Link to comment Share on other sites More sharing options...
Saiyan Posted February 10, 2016 Share Posted February 10, 2016 (edited) Cant read most of it cus it's white af Edited February 10, 2016 by Saiyan Quote Link to comment Share on other sites More sharing options...
Reflexd Posted February 10, 2016 Author Share Posted February 10, 2016 Cant read most of it cus it's white lel but is all im gonna say I wish u gl in your endeavors kk ty m9 1 Quote Link to comment Share on other sites More sharing options...
Saiyan Posted February 10, 2016 Share Posted February 10, 2016 kk ty m9 But why not just do cook food etc in the main class? Might be a bit more messy but if it dont work doing it separately just do it in one class? Quote Link to comment Share on other sites More sharing options...
Deceiver Posted February 10, 2016 Share Posted February 10, 2016 Try: public static String scriptStatus = ""; public CookFood(Script s) throws InterruptedException { main.scriptStatus = "Moving camera"; } Quote Link to comment Share on other sites More sharing options...
Reflexd Posted February 10, 2016 Author Share Posted February 10, 2016 Try: public static String scriptStatus = ""; public CookFood(Script s) throws InterruptedException { main.scriptStatus = "Moving camera"; } Damn, it works. Thanks a bunch, you're beautiful. 1 Quote Link to comment Share on other sites More sharing options...
ikk Posted February 10, 2016 Share Posted February 10, 2016 Also, if you're trying to do everything in separate classes, I suggest that you take a look at Booch's thread on Node frameworks. This is the way that I write my scripts and it's a very organized way of doing things. Link: http://osbot.org/forum/topic/48284-javatutorial-how-to-get-a-single-stage-node-framework-intermediate/ Quote Link to comment Share on other sites More sharing options...
Reflexd Posted February 10, 2016 Author Share Posted February 10, 2016 Also, if you're trying to do everything in separate classes, I suggest that you take a look at Booch's thread on Node frameworks. This is the way that I write my scripts and it's a very organized way of doing things. Link: http://osbot.org/forum/topic/48284-javatutorial-how-to-get-a-single-stage-node-framework-intermediate/ Thanks, I'll certainly look at that. Quote Link to comment Share on other sites More sharing options...
Saiyan Posted February 10, 2016 Share Posted February 10, 2016 Tasks ftwwwwwwwww Quote Link to comment Share on other sites More sharing options...
Devry123 Posted February 10, 2016 Share Posted February 10, 2016 if u trying to cook just cook using ur hand and watch video/series broski... is easy "unless u farming" :p Quote Link to comment Share on other sites More sharing options...