Jump to content

Getting back on nodes, needing some help!


TheGreatests

Recommended Posts

Hello, I am reconstructing my script, and having just a tad of a issue with my brief code wondering if anyone has any time to give a hand or just put in your opinions on what is goiing on so I can troubleshoot it through that way.

 

 

Here is the code, I will Highlight the issues that my eclipse is reading.

package nodes;
import org.osbot.rs07.script.ScriptManifest;

import org.osbot.rs07.api.Client;
import org.osbot.rs07.api.Inventory;
import org.osbot.rs07.api.Objects;
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.model.Player;
import org.osbot.rs07.api.model.RS2Object;
import org.osbot.rs07.script.Script;

import data.Data;
import Scripts.Node;

public class ClayMine extends Node{
	final int clay = 7454;


	final String ClayOre = "Clay";
	Entity Ore = Objects.closest(data.clay);
	public ClayMine(Script sA) {
		super(sA);
		// TODO Auto-generated constructor stub
	}

	private Script s;
	private Data data;
	private Player me;
	private Inventory inv;
	@[member=Override]
	public boolean validate() throws InterruptedException {
		// TODO Auto-generated method stub
		return s.inventory.isEmpty() && data.ClayAreaN.contains(s.myPlayer());
		String status = "We're at north mining area";
	}

	@[member=Override]
	public boolean execute() throws InterruptedException {
		if(Ore != null && data.ClayAreaN.contains(s.myPlayer())){
			if(!s.myPlayer().isAnimating()){
				Ore.interact("Mine");
				String status = "Mining ore";
			}
			return random(250,400);
		}
		break;
	}
}

The issues are highlighted in red, I am not entirely sure why I have to create a random method when its in the script package, and also if I am declaring entity wrong because its giving me a suggestion but I am pretty sure I am doing it right. I am grabbing the Clay Int from the data class.

Link to comment
Share on other sites

sA.random(250,400)

or

MethodProvider.random(250, 400);



return s.inventory.isEmpty() && data.ClayAreaN.contains(s.myPlayer());

script is already pass through. just do

return sA.inventory.isEmpty() && data.ClayAreaN.contains(sA.myPlayer());

public boolean validate() throws InterruptedException {
		// TODO Auto-generated method stub
		return s.inventory.isEmpty() && data.ClayAreaN.contains(s.myPlayer());
		//String status = "We're at north mining area";
	}

status will never be reached i dont think

Edited by Chris
Link to comment
Share on other sites

im very confused by what youre doing

 

 theres a lot about what you're doing that i dont understand, but maybe this will help.

public class ClayMine extends Node{
	final int clay = 7454;
	final String ClayOre = "Clay";
        private String status = "";
        private Script sA;
	public ClayMine(Script sA) {
		super(sA);
                this.sA = sA; //you'll only need this if the parent class has
                //Script sA as private
	}

	@[member='Override']
	public boolean validate() throws InterruptedException {
           if(sA.inventory.isEmpty() && Data.ClayAreaN.contains(s.myPlayer()) {
		status = "We're at north mining area";
                return true;
           }
           return false;
	}

	@
	Override

	public boolean execute() throws InterruptedException {
              Entity ore = sA.objects.closest(data.clay);
		if(ore != null && Data.ClayAreaN.contains(sA.myPlayer())){
			if(!sA.myPlayer().isAnimating()){
				ore.interact("Mine");
				status = "Mining ore";
			}
			return random(250,400);
		}
		break;
	}
}

also, you're aware that you just keep defining a new string status, but never use it, right? this code needs to be seriously restructured and heavily changed, would recommend starting over tbh. also i would recommend making any data from 'Data' public and static instead of defining an object 'Data' without apparent purpose...

 

Edited by Imateamcape
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...