Jump to content

Script getting stuck


Kramnik

Recommended Posts

Hello, have been experiencing this issue for sometime now and fail to find why it is happening. My script just randomly throws this error: [WARN][Bot #1][11/19 06:28:37 AM]: Script executor is taking too long to suspend; restarting now... and pretty much script crashes, stands for 5 minutes, logs out and that's it. Also it happens very randomly, e.g. the last time this happened script ran for 10 hours without issues, but it also could happened within hour or so. 

The logger goes like this before crashing:

[INFO][Bot #1][11/19 06:23:29 AM]: Trading NPC
[INFO][Bot #1][11/19 06:23:30 AM]: Check amount
[INFO][Bot #1][11/19 06:23:30 AM]: Buy item at first try
[WARN][Bot #1][11/19 06:28:37 AM]: Script executor is taking too long to suspend; restarting now...
[INFO][Bot #1][11/19 06:41:46 AM]: Terminating script Ironmanbuyer...

if (gpAmount > 1000) {

            final int feathers = (int)this.getInventory().getAmount(new String[] { "Item" });
         
            getNpcs().closest("NPC").interact("Trade");
            log("Trading NPC");
            new ConditionalSleep(8000, 1000) {
                @Override
                public boolean condition() throws InterruptedException {
                    return getStore().isOpen();
                }
            }.sleep();
            log("Check amount");
            if(getStore().isOpen() && getStore().getAmount("Item") > 5){
                log("Buy item at first try");
                if(getStore().getItem("Item") != null){
                    getStore().buy("Item",5);
                }
                log("Bought");
                new ConditionalSleep(5000, 1000) {
                    @Override
                    public boolean condition() throws InterruptedException {
                        return getInventory().contains("Item");
                    }
                }.sleep();
                log("Closing store");
                getStore().close();
                new ConditionalSleep(5000, 1000) {
                    @Override
                    public boolean condition() throws InterruptedException {
                        return !getStore().isOpen();
                    }
                }.sleep();
            }

 

 

So the last logger are always "Buy item at first try" and after it crashes I never find it with the item in inventory. So the issue must be in this part, but I don't know why is this is wrong. Can it be client itself issue since these issues were not happening with previous versions? 🤔 Thanks everyone for input :)

if(getStore().getItem("Item") != null){ getStore().buy("Item",1); }

Edited by Kramnik
Link to comment
Share on other sites

"Item" has to be a name of the item in case you didn't know, Feathers for example

Also the logic is fairly flawed and unstable.
You should try to only do 1 or max 2 actions in 1 loop.

A better format would be:

if (gp > 1000){
	if(store is open){
		if(store contains more than 5 items){
			buyItems();
		}
	}else{
		openstore()
	}
}


If you are hopping or whatever you should close the bank ik there :)

Link to comment
Share on other sites

7 hours ago, Khaleesi said:

"Item" has to be a name of the item in case you didn't know, Feathers for example

Also the logic is fairly flawed and unstable.
You should try to only do 1 or max 2 actions in 1 loop.

A better format would be:



if (gp > 1000){
	if(store is open){
		if(store contains more than 5 items){
			buyItems();
		}
	}else{
		openstore()
	}
}


If you are hopping or whatever you should close the bank ik there :)

Hi, yes I am aware of it, I changed it to "Item" when I pasted :D I changed a code to be more like you said, but still the issue is happening. Happened two times, one after 6 hours of using it other after 10 minutes.

Currently using this code:

getNpcs().closest("NPC").interact("Trade");
                log("Trading NPC");
                new ConditionalSleep(8000, 1000) {
                    @Override
                    public boolean condition() throws InterruptedException {
                        return getStore().isOpen();
                    }
                }.sleep();
                log("Store is open now");
                if(getStore().isOpen()) {
                    log("Store is open");
                    if (getStore().getAmount("Item") > 5) {
                        log("Amount is good, buying");
                        getStore().buy("Item", 1);
                        new ConditionalSleep(5000, 1000) {
                            @Override
                            public boolean condition() throws InterruptedException {
                                return getInventory().contains("Item");
                            }
                        }.sleep();
                        log("Closing store");
                        getStore().close();
                        new ConditionalSleep(5000, 1000) {
                            @Override
                            public boolean condition() throws InterruptedException {
                                return !getStore().isOpen();
                            }
                        }.sleep();

And still bugs with this in logger:
[INFO][Bot #1][11/19 03:15:40 PM]: Opening store
[INFO][Bot #1][11/19 03:15:40 PM]: Trading NPC
[INFO][Bot #1][11/19 03:15:41 PM]: Store is open now
[INFO][Bot #1][11/19 03:15:41 PM]: Store is open
[INFO][Bot #1][11/19 03:15:41 PM]: Amount is good, buying
[WARN][Bot #1][11/19 03:20:48 PM]: Script executor is taking too long to suspend; restarting now...

And when I log into account I can see that it haven't bought the item. Any ideas what could be wrong here? 🤔

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