May 26, 20169 yr I want to be able to buy different items from a store, let's say a General store. And if they are out of said item, to hop worlds (p2p worlds). I tried digging through some tutorials, and using widgets myself, but its not working. Any ideas?
May 26, 20169 yr I want to be able to buy different items from a store, let's say a General store. And if they are out of said item, to hop worlds (p2p worlds). I tried digging through some tutorials, and using widgets myself, but its not working. Any ideas? There is a store class to handle most things for you It can be found here and it should hold everything you need
May 26, 20169 yr Author There is a store class to handle most things for you It can be found here and it should hold everything you need Omg that's great!! So much easier haha. Thanks a ton!
May 26, 20169 yr Omg that's great!! So much easier haha. Thanks a ton! You're welcome If you run into any issues let me know
May 26, 20169 yr Author You're welcome If you run into any issues let me know Hey, Solution. Could you help me with this? So in this case, I have it trade the NPC nearby and buy all of the supply of 4 different items. I want it to buy them all, and once out, to hop worlds and continue. I can't seem to make it work because the way I currently have it, it opens the Store but doesn't buy. If I put the buying code outside the trade if then it does it but once its out, it doesn't hop but rather keeps spam trading the NPC. Sorry if that's a bit unclear, I can explain more if need be. case BUY: if ((getNpcs().closest("NPC") !=null) && (!getStore().isOpen())) { getNpcs().closest("NPC").interact("Trade"); wait(100,200); if ((getStore().isOpen()) /*&& (getStore().contains("Item1" , "Item2" , "Item3" , "Item4"))*/) { if (getStore().getAmount("Item1") > 0) { getStore().buy("Item1", 10); wait(100, 200); } else if (getStore().getAmount("Item2") > 0) { getStore().buy("Item2", 10); wait(100, 200); } else if (getStore().getAmount("Item3") > 0) { getStore().buy("Item3", 10); wait(100, 200); } else if (getStore().getAmount("Item4") > 0) { getStore().buy("Item4" , 10); wait(100,200); } else { getStore().close(); wait(100,200); worlds.hopToP2PWorld(); } } } break;
May 26, 20169 yr Hey, Solution. Could you help me with this? So in this case, I have it trade the NPC nearby and buy all of the supply of 4 different items. I want it to buy them all, and once out, to hop worlds and continue. I can't seem to make it work because the way I currently have it, it opens the Store but doesn't buy. If I put the buying code outside the trade if then it does it but once its out, it doesn't hop but rather keeps spam trading the NPC. Sorry if that's a bit unclear, I can explain more if need be. case BUY: if ((getNpcs().closest("NPC") !=null) && (!getStore().isOpen())) { getNpcs().closest("NPC").interact("Trade"); wait(100,200); if ((getStore().isOpen()) /*&& (getStore().contains("Item1" , "Item2" , "Item3" , "Item4"))*/) { if (getStore().getAmount("Item1") > 0) { getStore().buy("Item1", 10); wait(100, 200); } else if (getStore().getAmount("Item2") > 0) { getStore().buy("Item2", 10); wait(100, 200); } else if (getStore().getAmount("Item3") > 0) { getStore().buy("Item3", 10); wait(100, 200); } else if (getStore().getAmount("Item4") > 0) { getStore().buy("Item4" , 10); wait(100,200); } else { getStore().close(); wait(100,200); worlds.hopToP2PWorld(); } } } break; Don't use "wait()" when you want the script to sleep. Use ConditionalSleep for dynamic sleeping open store new ConditionalSleep(5000 public boolean condition() { return store is open; } }.sleep(); //it will sleep maximum 5000 ms or until the store is open Your getState() or w/e it's called is flawed Edited May 26, 20169 yr by Woody
May 26, 20169 yr Author Don't use "wait()" when you want the script to sleep. Use ConditionalSleep for dynamic sleeping open store new ConditionalSleep(5000 public boolean condition() { return store is open; } }.sleep(); //it will sleep maximum 5000 ms or until the store is open Your getState() or w/e it's called is flawed Why do you say my getState() is flawed? I'm not sure what you mean by this.
May 26, 20169 yr Why do you say my getState() is flawed? I'm not sure what you mean by this. I think he is talking about your onLoop() because unless I am blind your getState() wasn't even provided. Here is an example of what I used in one of my scripts: NPC gerrant = getNpcs().closest("Gerrant"); if(gerrant == null){ log("[Error] Gerrant not found!"); return 1000; } if(gerrant.interact("Trade")){ new ConditionalSleep(6000){ @Override public boolean condition() throws InterruptedException { return getWidgets().isVisible(300); } }.sleep(); } I was using Widgets and not the store class.
May 26, 20169 yr Author I think he is talking about your onLoop() because unless I am blind your getState() wasn't even provided. Here is an example of what I used in one of my scripts: NPC gerrant = getNpcs().closest("Gerrant"); if(gerrant == null){ log("[Error] Gerrant not found!"); return 1000; } if(gerrant.interact("Trade")){ new ConditionalSleep(6000){ @Override public boolean condition() throws InterruptedException { return getWidgets().isVisible(300); } }.sleep(); } I was using Widgets and not the store class. Ohh well if that's the case, I just didn't copy down the getState() part onto here lol, I definitely have it in the script though. Hmm I'm gonna try to stick to using the store class. I was able to open the store, just not efficiently buy items :P
May 26, 20169 yr Ohh well if that's the case, I just didn't copy down the getState() part onto here lol, I definitely have it in the script though. Hmm I'm gonna try to stick to using the store class. I was able to open the store, just not efficiently buy items :P Want to post what you fixed so far? Also I am guessing you arn't actually putting "Item1" and instead the items id correct?
May 26, 20169 yr Author Want to post what you fixed so far? Also I am guessing you arn't actually putting "Item1" and instead the items id correct? Yes of course haha, just changed the items/npc to obscure it for now. I'm not home so can't post it, but the only thing I tried was creating separate cases for Buy and Talk(trade) so for one he'll trade with the npc, and then buy. It's just not going smoothly though. I must be messing something up when trying to buy multiple of different items.
May 26, 20169 yr Yes of course haha, just changed the items/npc to obscure it for now. I'm not home so can't post it, but the only thing I tried was creating separate cases for Buy and Talk(trade) so for one he'll trade with the npc, and then buy. It's just not going smoothly though. I must be messing something up when trying to buy multiple of different items. Shouldn't be necessary, my script buys and opens feather packs using three states BUY,OPEN,WAIT.
May 26, 20169 yr Author Shouldn't be necessary, my script buys and opens feather packs using three states BUY,OPEN,WAIT. Yeah I figured it doesn't need to be so complicated. Before I left I switched it back to just 3 simple Buy, Walk to Shop, and Bank. I'm gonna have to look at it and see what I can do when I get home. Currently clueless as to what to fix.
May 27, 20169 yr Yeah I figured it doesn't need to be so complicated. Before I left I switched it back to just 3 simple Buy, Walk to Shop, and Bank. I'm gonna have to look at it and see what I can do when I get home. Currently clueless as to what to fix. If you still need help after you have tried you can PM me your source and I will fix it.
May 27, 20169 yr Author If you still need help after you have tried you can PM me your source and I will fix it. Gonna test it when I get home. Thx!
Create an account or sign in to comment