Jump to content

Scripting help


DarkScuzz

Recommended Posts

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 by DarkScuzz
Link to comment
Share on other sites

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

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