massih Posted March 9, 2015 Share Posted March 9, 2015 I'm trying to make my own script I have got some kind of a problem i don't really know how to solve... if (!LEVERAREA.contains(myPlayer())){ localWalker.walkPath(TOLEVER); if (LEVERAREA.contains(myPlayer())){ lever.interact("Pull"); if (dialogues.isPendingContinuation()){ dialogues.clickContinue(); if (dialogues.isPendingOption()){ dialogues.selectOption("Yes I'm brave."); if (players.myPlayer().isAnimating()){ sleep(random(1000,1500)); } } } } } So it does walk to the LEVERAREA and when i manually leave it, it walks back. But when it is AT the LEVERAREA it does not pull the lever... Quote Link to comment Share on other sites More sharing options...
Lemons Posted March 9, 2015 Share Posted March 9, 2015 you have your code setup in a bad way with all the nests. Move the area contains check outside the not area contains check, lever.interact() returns a boolean for a reason, and need some conditional sleeps for the dialogue stuff probably. Quote Link to comment Share on other sites More sharing options...
Twin Posted March 9, 2015 Share Posted March 9, 2015 I'm trying to make my own script I have got some kind of a problem i don't really know how to solve... if (!LEVERAREA.contains(myPlayer())){ localWalker.walkPath(TOLEVER); if (LEVERAREA.contains(myPlayer())){ lever.interact("Pull"); if (dialogues.isPendingContinuation()){ dialogues.clickContinue(); if (dialogues.isPendingOption()){ dialogues.selectOption("Yes I'm brave."); if (players.myPlayer().isAnimating()){ sleep(random(1000,1500)); } } } } } So it does walk to the LEVERAREA and when i manually leave it, it walks back. But when it is AT the LEVERAREA it does not pull the lever... if (!LEVERAREA.contains(myPlayer())) localWalker.walkPath(TOLEVER); if (LEVERAREA.contains(myPlayer())) lever.interact("Pull"); if (dialogues.isPendingContinuation()) dialogues.clickContinue(); if (dialogues.isPendingOption()) dialogues.selectOption("Yes I'm brave."); if (players.myPlayer().isAnimating()) sleep(random(1000,1500)); I could be wrong, but these are all nested if statements. Try spreading them out how I have it and see if that works. Quote Link to comment Share on other sites More sharing options...
massih Posted March 9, 2015 Author Share Posted March 9, 2015 you have your code setup in a bad way with all the nests. Move the area contains check outside the not area contains check, lever.interact() returns a boolean for a reason, and need some conditional sleeps for the dialogue stuff probably. Could you add me on skype? My Skype name is: massih-- Quote Link to comment Share on other sites More sharing options...
Precise Posted March 9, 2015 Share Posted March 9, 2015 I'm trying to make my own script I have got some kind of a problem i don't really know how to solve... if (!LEVERAREA.contains(myPlayer())){ localWalker.walkPath(TOLEVER); if (LEVERAREA.contains(myPlayer())){ lever.interact("Pull"); if (dialogues.isPendingContinuation()){ dialogues.clickContinue(); if (dialogues.isPendingOption()){ dialogues.selectOption("Yes I'm brave."); if (players.myPlayer().isAnimating()){ sleep(random(1000,1500)); } } } } } So it does walk to the LEVERAREA and when i manually leave it, it walks back. But when it is AT the LEVERAREA it does not pull the lever... I would not use nested IF statements like this as this causing you logical problems. Currently you're saying: If not in lever area, walk to lever area. But this will not execute the second if statement because you are now in fact in the lever area so the the first boolean returns false meaning no code is executed. Try: if (!LEVERAREA.contains(myPlayer())){ localWalker.walkPath(TOLEVER); } else if (LEVERAREA.contains(myPlayer())){ lever.interact("Pull"); } You might want to famaliarise yourself with if statements and if then else statements (Only changed part of the code because I am on my phone and so you can learn too) Precise Quote Link to comment Share on other sites More sharing options...
Twin Posted March 9, 2015 Share Posted March 9, 2015 I would not use nested IF statements like this as this causing you logical problems. Currently you're saying: If not in lever area, walk to lever area. But this will not execute the second if statement because you are now in fact in the lever area so the the first boolean returns false meaning no code is executed. Try: if (!LEVERAREA.contains(myPlayer())){ localWalker.walkPath(TOLEVER); } else if (LEVERAREA.contains(myPlayer())){ lever.interact("Pull"); } You might want to famaliarise yourself with if statements and if then else statements (Only changed part of the code because I am on my phone and so you can learn too) Precise To dsd into this I'd reccomend reading http://osbot.org/forum/topic/58775-a-beginners-guide-to-writing-osbot-scripts-where-to-get-started-by-apaec/. Definatly will give you a big helping hand. I'd get used to the format that script uses using states. Will make things a lot easier/cleaner to read. 1 Quote Link to comment Share on other sites More sharing options...