Dab in a Lab Posted May 20, 2018 Share Posted May 20, 2018 Why is my log giving this error? I made some changes, so it only has like a ~2 second delay to continue its action now, but its still kinda annoying. I saw that it provided more info about true or false and null methods, but I don't quite understand how that's relevant Logger: https://gyazo.com/bfd0d678cf7449a15894023b594844d3 Snippet of script: https://gyazo.com/d16de96eb83d637888a0fc5e6e8cebfc Quote Link to comment Share on other sites More sharing options...
Chris Posted May 20, 2018 Share Posted May 20, 2018 23 minutes ago, Dab in a Lab said: Why is my log giving this error? I made some changes, so it only has like a ~2 second delay to continue its action now, but its still kinda annoying. I saw that it provided more info about true or false and null methods, but I don't quite understand how that's relevant Logger: https://gyazo.com/bfd0d678cf7449a15894023b594844d3 Snippet of script: https://gyazo.com/d16de96eb83d637888a0fc5e6e8cebfc *Correction fixed brackets apply to both if statements 25 minutes ago, Dab in a Lab said: Why is my log giving this error? I made some changes, so it only has like a ~2 second delay to continue its action now, but its still kinda annoying. I saw that it provided more info about true or false and null methods, but I don't quite understand how that's relevant Logger: https://gyazo.com/bfd0d678cf7449a15894023b594844d3 Snippet of script: https://gyazo.com/d16de96eb83d637888a0fc5e6e8cebfc if (condition) statement1; statement2; //statement2 is not part of the if statement, but it looks like it because of wrong indentation 1 Quote Link to comment Share on other sites More sharing options...
Dab in a Lab Posted May 20, 2018 Author Share Posted May 20, 2018 6 minutes ago, Chris said: *Correction fixed brackets apply to both if statements if (condition) statement1; statement2; //statement2 is not part of the if statement, but it looks like it because of wrong indentation Thank you! I kinda just assumed the null check would skip any log statements. If I were to get rid of the log under the null check, that would have fixed the issue too right? Quote Link to comment Share on other sites More sharing options...
Charlotte Posted May 20, 2018 Share Posted May 20, 2018 8 minutes ago, Dab in a Lab said: Thank you! I kinda just assumed the null check would skip any log statements. If I were to get rid of the log under the null check, that would have fixed the issue too right? No. Log is for log check/ error checking. You need to make use of curly braces. 1 Quote Link to comment Share on other sites More sharing options...
Dab in a Lab Posted May 20, 2018 Author Share Posted May 20, 2018 (edited) @Chris I added the brackets but the script seems to skip over that snippet and run through the rest of the code. Then loops back and performs the action. Could that be because of how the rest of my script is written? Edited May 20, 2018 by Dab in a Lab Quote Link to comment Share on other sites More sharing options...
Charlotte Posted May 20, 2018 Share Posted May 20, 2018 4 minutes ago, Dab in a Lab said: @Chris I added the brackets but the script seems to skip over that snippet and run through the rest of the code. Then loops back and performs the action. Could that be because of how the rest of my script is written? First you need to understand that the code runs continuously and sometimes it skips certain parts, hence this where I will make use of conditional sleep. Quote Link to comment Share on other sites More sharing options...
Dab in a Lab Posted May 20, 2018 Author Share Posted May 20, 2018 (edited) 4 minutes ago, Charlotte said: First you need to understand that the code runs continuously and sometimes it skips certain parts, hence this where I will make use of conditional sleep. I have conditional sleeps https://gyazo.com/07f3d1bba0ef6246ae6db8abcb83b917 Edited May 20, 2018 by Dab in a Lab Quote Link to comment Share on other sites More sharing options...
Charlotte Posted May 20, 2018 Share Posted May 20, 2018 3 minutes ago, Dab in a Lab said: I have conditional sleeps https://gyazo.com/07f3d1bba0ef6246ae6db8abcb83b917 Don't see it for interaction, which is what you said was skipped. Curly braces still not used. Quote Link to comment Share on other sites More sharing options...
Dab in a Lab Posted May 20, 2018 Author Share Posted May 20, 2018 3 minutes ago, Charlotte said: Don't see it for interaction, which is what you said was skipped. Curly braces still not used. I added brackets to where Chris said, but the interaction is still a NullPointException. The place the brackets seemed to work was where I had them in the previous picture https://gyazo.com/e41c968d49aafb68f7ee3d4694e07f04 And I have the conditional sleep return if the widget I'm interacting with exists. Should I instead have it return the interaction? Quote Link to comment Share on other sites More sharing options...
Charlotte Posted May 20, 2018 Share Posted May 20, 2018 2 minutes ago, Dab in a Lab said: I added brackets to where Chris said, but the interaction is still a NullPointException. The place the brackets seemed to work was where I had them in the previous picture https://gyazo.com/e41c968d49aafb68f7ee3d4694e07f04 And I have the conditional sleep return if the widget I'm interacting with exists. Should I instead have it return the interaction? Wrong use of curly braces. if (T_AREA.contains(myPlayer())) { NPC t = getNpcs().closest("Ellis"); if (t != null) { t.interact("Trade"); } } 2 Quote Link to comment Share on other sites More sharing options...
Dab in a Lab Posted May 20, 2018 Author Share Posted May 20, 2018 7 minutes ago, Charlotte said: Wrong use of curly braces. if (T_AREA.contains(myPlayer())) { NPC t = getNpcs().closest("Ellis"); if (t != null) { t.interact("Trade"); } } Ahhhh, ok. Thank you! Quote Link to comment Share on other sites More sharing options...