cuntismcgee 0 Share Posted April 7, 2016 really stuck on this getShop().purchaseTen("Bucket"); just doesnt seem to be working... the mouse just jitters around. any ideas? Link to comment Share on other sites More sharing options...
martiiinn 1 Share Posted April 7, 2016 i called dreamlicker to come help you dont worry fham Link to comment Share on other sites More sharing options...
Dreamlicker 750 Share Posted April 7, 2016 See if you can use the widget ID of the item in the shop to interact with it instead. That seems like it'd work. If you can't do it with the widget ID, Shop may need to be updated. Posting the full code will also help (Any surrounding code/if statements/whatever) Link to comment Share on other sites More sharing options...
cuntismcgee 0 Author Share Posted April 7, 2016 i called dreamlicker to come help you dont worry fham for some reason i thought you were joking til i noticed he did reply XD See if you can use the widget ID of the item in the shop to interact with it instead. That seems like it'd work. If you can't do it with the widget ID, Shop may need to be updated. Posting the full code will also help (Any surrounding code/if statements/whatever) ah dude, freggin sweet. i never would have thought of that. it actually did work. thank you good sir Edit: nvm lol the mouse gets stuck again and just moves around in random motions and so does the camera o.o heres the code: private void shop() { count = getInventory().count(Item); NPC shopKeeper = getNpcs().closest("Shop keeper"); if (shopKeeper != null) { if (!getInventory().isFull()) { if (getInventory().contains("Coins")) { if (!getLocalPlayer().isInteracting(shopKeeper)) { if (shopKeeper.interact("Trade")) { sleepUntil(() -> getShop().isOpen(), Calculations.random(1000, 3000)); if (getShop().isOpen() && getShop().contains("Bucket")) { sleepUntil(() -> getWidgets().getChildWidget(300, 2) != null, 0); getWidgets().getChildWidget(300, 1).interact("Buy 10"); sleepUntil(() -> !getLocalPlayer().isInteracting(shopKeeper), Calculations.random(2000, 3500)); } } } } } else { state = 1; } } } Link to comment Share on other sites More sharing options...
Hashtag 8774 Share Posted April 7, 2016 Hey, I would recommend you to format your code differently. Right now you have all of the code in the same if statements. This might be causing problems because the code is looping over and over again and when it does some of those booleans inside if might be false and then code will not run. Try using this format, it will serve you better with the looping If inventory is not full If shop is open Purchase items Else Interact with shop npc Else State = 1 In your code you are interacting first with the npc and then checking if the shop is open. In the next loop it will try to interact with the npc even though the shop is already open. Link to comment Share on other sites More sharing options...
Diddy 265 Share Posted April 7, 2016 do what hashtag says because your code can't possibly work atm :/ try something like if(getShop().isOpen){ buystuff} else { shopkeeper.interact Link to comment Share on other sites More sharing options...
cuntismcgee 0 Author Share Posted April 7, 2016 Hey, I would recommend you to format your code differently. Right now you have all of the code in the same if statements. This might be causing problems because the code is looping over and over again and when it does some of those booleans inside if might be false and then code will not run. Try using this format, it will serve you better with the looping If inventory is not full If shop is open Purchase items Else Interact with shop npc Else State = 1 In your code you are interacting first with the npc and then checking if the shop is open. In the next loop it will try to interact with the npc even though the shop is already open. thank you guys that was the problem. i wrote that after staying up like 24 hours and now that I've woken up the next day I can tell doing it that way was a terrible idea lol Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.