Sebastian Posted September 9, 2016 Share Posted September 9, 2016 (edited) Hey everyone. I'm trying to use different classes for different quests. This is because i'm trying to make myself a questing script. What do i do wrong? I have 2 classes. The first is ofcourse the main class, second class is "SheepShearer". This is my code: package core; import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import quests.SheepShearer; import java.awt.*; @ScriptManifest(author = "Sebastian", info = "Quest like you've never quested before!", name = "JSQuester", version = 0, logo = "") public class Main extends Script { @[member='Override'] public void onStart() { log("Started"); } private enum State { SHEEPSHEARER, WAIT, QUESTTWO }; private State getState() { if (myPlayer().isAnimating()) return State.SHEEPSHEARER; return State.WAIT; } @[member='Override'] public int onLoop() throws InterruptedException { switch (getState()) { case SHEEPSHEARER: new SheepShearer(this); break; case QUESTTWO: break; case WAIT: break; } return random(200, 300); } @[member='Override'] public void onExit() { log("Stopped script.."); } @[member='Override'] public void onPaint(Graphics2D g) { } } package quests; import org.osbot.rs07.script.Script; public class SheepShearer { public SheepShearer(Script Quest_SheepShearer) throws InterruptedException { Quest_SheepShearer.log("test"); } } I can't get it to log the "test". What am i doing wrong? EDIT: Nevermind, for some reason it works now... [INFO][Bot #2][09/09 08:55:15 PM]: Started script : JSQuester [INFO][Bot #2][09/09 08:55:15 PM]: test [INFO][Bot #2][09/09 08:55:16 PM]: test [INFO][Bot #2][09/09 08:55:16 PM]: test [INFO][Bot #2][09/09 08:55:16 PM]: test [INFO][Bot #2][09/09 08:55:16 PM]: test [INFO][Bot #2][09/09 08:55:17 PM]: test [INFO][Bot #2][09/09 08:55:17 PM]: test [INFO][Bot #2][09/09 08:55:17 PM]: test [INFO][Bot #2][09/09 08:55:17 PM]: test Edited September 9, 2016 by Sebastian Quote Link to comment Share on other sites More sharing options...
Precise Posted September 9, 2016 Share Posted September 9, 2016 (edited) Hey everyone. I'm trying to use different classes for different quests. This is because i'm trying to make myself a questing script. What do i do wrong? I have 2 classes. The first is ofcourse the main class, second class is "SheepShearer". This is my code: package core; import org.osbot.rs07.api.model.Entity; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import quests.SheepShearer; import java.awt.*; @ScriptManifest(author = "Sebastian", info = "Quest like you've never quested before!", name = "JSQuester", version = 0, logo = "") public class Main extends Script { @[member='Override'] public void onStart() { log("Started"); } private enum State { SHEEPSHEARER, WAIT, QUESTTWO }; private State getState() { if (myPlayer().isAnimating()) return State.SHEEPSHEARER; return State.WAIT; } @[member='Override'] public int onLoop() throws InterruptedException { switch (getState()) { case SHEEPSHEARER: new SheepShearer(this); break; case QUESTTWO: break; case WAIT: break; } return random(200, 300); } @[member='Override'] public void onExit() { log("Stopped script.."); } @[member='Override'] public void onPaint(Graphics2D g) { } } package quests; import org.osbot.rs07.script.Script; public class SheepShearer { public SheepShearer(Script Quest_SheepShearer) throws InterruptedException { Quest_SheepShearer.log("test"); } } I can't get it to log the "test". What am i doing wrong? because you need to make an instance of the class for that to be executed in the onStart() yeah it worked because you made a new instance and called the log in the constructor Edited September 9, 2016 by Precise Quote Link to comment Share on other sites More sharing options...
Sebastian Posted September 9, 2016 Author Share Posted September 9, 2016 (edited) because you need to make an instance of the class for that to be executed in the onStart() yeah it worked because you made a new instance and called the log in the constructor Thanks for your reply. For some reason it worked after i posted this thread.. I didn't change anything in the onStart() tbh. Edited September 9, 2016 by Sebastian Quote Link to comment Share on other sites More sharing options...