Everything posted by Explv
-
Explv's Walker
Can't remember if I added it, will take a look later
-
having trouble script wont even start running
You are making API calls before onStart() is called. You can't do that, as the API has not been setup yet. Move this code that is currently above onLoop: final Position starting = myPlayer().getPosition(); Inside of onStart() or onLoop(). Or if it needs to be a global variable, declare it globally: Position starting; Then initialise it in onStart() starting = whatever Sorry about formatting, on phone.
- Wilderness Ditch Webwalking
-
NoClassDefFoundError
If it is on the SDN you will need to add the actual source code of the external library
-
Get Closest Bank
This is extremely overcomplicated. The only time you ever really need the closest bank is if you want to walk there. If you pass multiple areas to the web walking method it will automatically walk to the closest one, and will take into account actual path distance, rather than straight line distance which your method uses: getWalking().webWalk(bankAreas);
-
Fixing OSBot not starting.
Just use cd to navigate to the directory where the .jar is and run java -jar "OSBot whateveritis.jar" obviously replacing whateveritis with the OSBot version number
-
Can anyone help me pls ?
Why don't you just not use "states"
-
Anybody available to help with Gui? (window Builder)
There are already tonnes of GUI tutorials and examples online, the way you do it in OSBot is no different. Just Google Swing Tutorials
-
Anybody available to help with Gui? (window Builder)
If you can't connect the dots then you need to revisit the basics of Java. In particular OOP, assuming your GUI is in a separate class. I would recommend you don't use a GUI builder, so you can actually learn how it works.
-
Getting sprite ids
Perhaps there is another widget with the sprite? You could alternatively use the Spell Name attribute.
-
EntityAPI #closest Compiler Warning
You will find these warnings frequently with the OSBot API, just ignore them.
-
Casting Entity to RS2Object
Sorry I meant && getMouse().isOnCursor(obj)
-
Casting Entity to RS2Object
Pretty sure you can just filter objects using getObjects().closest() and the method isOnCursor() Sorry on phone but: getObjects().closest(obj -> obj.hasAction("Chop") && obj.isOnCursor())
-
A Simple Login Handler
You could try moving the lobby button check inside of the isLoggedIn check: @Override public final int execute() throws InterruptedException { if (!getBot().isLoaded()) { return 1000; } else if (getClient().isLoggedIn()) { if (getLobbyButton() != null) { clickLobbyButton(); } else { getBot().getScriptExecutor().resume(); setFinished(); } } else if (!getBot().getScriptExecutor().isPaused()) { getBot().getScriptExecutor().pause(); } else if (isOnWorldSelectorScreen()) { cancelWorldSelection(); } else if (!isPasswordEmpty()) { clickCancelLoginButton(); } else { login(); } return random(100, 150); }
-
C# Sorting a list by amount of occurring letters in a string
Alternative method (again i'm not that familiar with C#) would be to create a custom Comparer and then use the built in List sort method https://msdn.microsoft.com/en-us/library/234b841s(v=vs.110).aspx
-
C# Sorting a list by amount of occurring letters in a string
Shouldn't the pointsPerCharacter be a Dictionary<char, int> ? You could remove that .ToString() call if it was. Also i'm not sure you need to call .ToCharArray(), can't you just do: foreach (char c in word) { points += pointsPerCharacter[c]; } I'm sure you could make your code even more succinct using Linq, but i'm not really super familiar with C#.
-
Excel application
Do you have at least excel 2007? What version of excel are you running? Maybe the workbook is corrupted? You could try: File -> Open In the Open dialog box select the corrupted workbook. Click the arrow next to the Open button and click Open and Repair
-
A Simple Login Handler
If the event is async, it is non-blocking, therefore wouldn't onLoop() keep executing even while logged out if you don't pause the script executor? I didn't really test this much.
-
A Simple Login Handler
Did you update your LoginEvent to exactly what is in the thread? I added more than just setAsync
-
A Simple Login Handler
Probably. You would want to handle the cases where I call setFailed in some other way, e.g. if the account is banned then stop the script. If the script fails to enter input, just retry instead of failing. I will write an example later today if I have time
-
Enum with Switch troubles
Firstly your Lumbridge bank area is incorrect, I would recommend you use the constant Banks.LUMBRIDGE_UPPER instead. Secondly your logic in general seems weird. I would recommend not using the state pattern because it just confuses things.
-
A Simple Login Handler
Yeah, you could either create your own separate thread that executes a LoginEvent when necessary, or you could modify the LoginEvent to be an asynchronous event that is always running (never calls setFinished())
- How to exit a script
-
A Simple Login Handler
Not sure if there is a better way but you could have a login event always running in the background, it would do nothing if the player is logged in, but when the player logs out it would pause the script executor, log back in, and then resume the script executor. Consider looking at the code in the original post, shouldn't be hard to modify.
-
A Simple Login Handler
Updated the code on the thread, should probably fix.