DarkScuzz Posted September 22, 2023 Share Posted September 22, 2023 (edited) first of all im using IntellJ Im trying to use my main script to call, to a second script to keep it more clean / less code to go through I've tried mulitpul ways and i always find myself with errors my current error will no go away after many attemps Operator '!' cannot be applied to 'void' Error is this piece of code where is errors is while (!highLevelAlch.onExit()) { highLevelAlch.onLoop(); private void startSecondaryScript() { log("Starting Secondary Script..."); secondaryScriptThread = new Thread(() -> { HighLevelAlch highLevelAlch = new HighLevelAlch(getBot()); highLevelAlch.exchangeContext(getBot()); try { highLevelAlch.onStart(); while (!highLevelAlch.onExit()) { highLevelAlch.onLoop(); Thread.sleep(100); // Adjust the sleep duration as needed } } catch (InterruptedException e) { e.printStackTrace(); } }); secondaryScriptThread.start(); } public void stopSecondaryScript() { if (secondaryScriptThread != null && secondaryScriptThread.isAlive()) { secondaryScriptThread.interrupt(); } } @Override public void onExit() { log("Exiting Ethereum Bracelet Charging Script"); try { closeBank(); // Close the bank when the script exits } catch (InterruptedException e) { throw new RuntimeException(e); } } } Edited September 23, 2023 by DarkScuzz Quote Link to comment Share on other sites More sharing options...
DarkScuzz Posted September 23, 2023 Author Share Posted September 23, 2023 I think i figured it out but please correct me if im wrong i needed to add public boolean onExit; on my second script and on my main i changed it to this try { highLevelAlch.onStart(); while (highLevelAlch.onExit) { highLevelAlch.onLoop(); Thread.sleep(100); // Adjust the sleep duration as needed } } catch (InterruptedException e) { e.printStackTrace(); } }); seems to be fine, no errors atm.. going to test watch it breaks xD Quote Link to comment Share on other sites More sharing options...