February 10, 201610 yr 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, 201610 yr by Reflexd
February 10, 201610 yr Cant read most of it cus it's white af Edited February 10, 201610 yr by Saiyan
February 10, 201610 yr Author 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
February 10, 201610 yr 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?
February 10, 201610 yr Try: public static String scriptStatus = ""; public CookFood(Script s) throws InterruptedException { main.scriptStatus = "Moving camera"; }
February 10, 201610 yr Author Try: public static String scriptStatus = ""; public CookFood(Script s) throws InterruptedException { main.scriptStatus = "Moving camera"; } Damn, it works. Thanks a bunch, you're beautiful.
February 10, 201610 yr 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/
February 10, 201610 yr Author 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.
February 10, 201610 yr if u trying to cook just cook using ur hand and watch video/series broski... is easy "unless u farming" :p
Create an account or sign in to comment