Jump to content

Need some help.


Reflexd

Recommended Posts

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. smile.png

Edited by Reflexd
Link to comment
Share on other sites

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/

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...