depwession 26 Share Posted February 25, 2019 (edited) code: https://pastebin.com/YCziUDcU First off, the current script logs out after finishing logging in and I can't figure out why. Secondly, I was trying to find a way to just pull player QP but couldn't find a way so I'm trying the 3 quests to see if it works (it'll hurt long term but once it works I'll learn to improve it). very simple script and I'll be adding a worldhopper once i get it going. (the script is just to setup the acct for the next script) But yeah I can't figure out why it just logs out on login (when said acct has said quests). I'm very new to scripting so literally anything would be helpful, especially good habits to get into for better organization and whatnot. Thank you in advance to anyone with any info Edited February 25, 2019 by depwession Link to comment Share on other sites More sharing options...
Banker 175 Share Posted February 25, 2019 I had this, you may need to open the Quest Tab before it actually registers them as complete, or check the PlayerSettings. Not sure how accurate it would be but I know I had an issue with this when I created a quester Don't hesitate to contact me on Discord if you need any help I think you already have me added, if not its in my signature. Link to comment Share on other sites More sharing options...
NovaGTX 106 Share Posted February 25, 2019 (edited) 1 hour ago, depwession said: I was trying to find a way to just pull player QP but couldn't find a way private int checkQP() { if (!getTabs().isOpen(Tab.QUEST)) getTabs().open(Tab.QUEST); String QP = getWidgets().getWidgetChild(399, 0).getText(); return (QP.length() == 15) ? Integer.parseInt(QP.substring(QP.length() - 1, QP.length())) : (QP.length() < 17) ? Integer.parseInt(QP.substring(QP.length() - 2, QP.length())) : Integer.parseInt(QP.substring(QP.length() - 3, QP.length())); } This will return the value of quest points. Could probably be cleaned up a bit, but I just whipped it up for you quickly. If this is confusing to you allow me to explain it... ? : This is called a ternary operator its basically a shortened if statement with other advantages. It allowed me to check the length of the string and return the parsed integer value of a substring if the length corresponding to the condition I gave (Length of 15 = 1 digit, 16 = 2 digits, 17 = 3 digits) Your overall layout could be improved by using an enum for the state you want to execute. I could get into nodes, this is probably out of scope for you currently, but I digress. Using enums for states is a less complicated and more entry-level method to sectioning your script rather than have it loop through conditionals in the onLoop each time. Declare your state: Private State state; Declare the enums: enum State { WALKING, TELEPORT } Next you need to define them using a function: private State getState() { if(!getLocalPlayer().isAnimating() && checkQP == 69){ return State.TELEPORT; } else if(!getLocalPlayer().getTile().equals(lumb)){ //You really should have a verification for teleporting, but for simplicity im omitting that return State.WALK; } else { return State.SLEEP; } } Then within your onloop you can use a Switch statement to check your state. public int onLoop() { state = getState(); //this is to avoid issues with calling the getState() function directly, can cause lag. switch(state){ case TELEPORT: //teleport here break; case WALK: //walk here break; } return 100; } Hopefully, this quick and dirty example can give you some insight that you can improve upon. Edited February 25, 2019 by NovaGTX depwession, Hashtag and Banker 2 1 Link to comment Share on other sites More sharing options...
depwession 26 Author Share Posted February 25, 2019 47 minutes ago, Banker said: I had this, you may need to open the Quest Tab before it actually registers them as complete, or check the PlayerSettings. Not sure how accurate it would be but I know I had an issue with this when I created a quester Don't hesitate to contact me on Discord if you need any help I think you already have me added, if not its in my signature. I added the check and I'll definitely be in touch when I get stuck or don't quite understand something Link to comment Share on other sites More sharing options...
depwession 26 Author Share Posted February 25, 2019 @NovaGTX Alright, there are a handful of different things I've yet to look into in this. Your explanation helped me get an understanding of State and the few parts I don't get are because I've yet to play with them. I've never used widgets, State, or parseInt though I had a feeling it would be easier if I learned to use them. I'm gonna look into and try to get an understanding on how/when to use all these and if I struggle on something I might slide in your DM's with some questions. Thank you immensely for all this information though, i really appreciate it! Link to comment Share on other sites More sharing options...
NovaGTX 106 Share Posted February 25, 2019 11 minutes ago, depwession said: if I struggle on something I might slide in your DM's with some questions Feel free to message me on discord, I'll respond much faster there. @ Nova#6953 depwession 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now