Everything posted by Explv
-
Finished my new script, but how do I type faster?
For some reason getKeyboard().pressKey(c); getKeyboard().releaseKey(c); Does not work for me (maybe I am doing something wrong) However this does: private void typeStringInstant(String output){ for(int i = 0; i < output.length(); i ++){ char c = output.charAt(i); int code = KeyEvent.getExtendedKeyCodeForChar(c); // Type the character getBot().getKeyEventHandler().generateBotKeyEvent(400, System.currentTimeMillis(), 0, code, c); } // Press enter getBot().getKeyEventHandler().generateBotKeyEvent(401, System.currentTimeMillis(), 0, 10, '\u0000', 1); // Release enter getBot().getKeyEventHandler().generateBotKeyEvent(402, System.currentTimeMillis(), 0, 10, '\u0000', 1); } Edit: GIF demonstration: https://gyazo.com/36757b8e49c1abbcc4b0a4090bb6322e
-
Local script won't show
Make sure your script is correct, and that 'compiled output' is added to your .jar Sometimes deleting the OSBot folder, restarting OSBot, and then copying the .jar into the newly created OSBot/Scripts folder works for me
-
Need Potion IDs
It's just because if Fagex change the IDs you'll have to change all your scripts. But each to their own i guess ^_^
-
Need Potion IDs
Why aren't you just using the names e.g. "Stamina potion(1)" ??? ^_^
-
Need Potion IDs
Stamina mix(1) : 12635 Stamina mix(2) : 12633 Stamina potion(1) : 12631 Stamina potion(2) : 12629 Stamina potion(3) : 12627 Stamina potion(4) : 12625 Don't know why you would need the IDs though
-
GUI on Start
But how is that any different
-
GUI on Start
"As far as other APIs are concerned, they are typically made to bridge the gap between no knowledge and full knowledge (at least mine is). There are a lot of things that OSBot's API does that it shouldn't do" That IS what it should do, it makes sense in your program to write NPC dwarf = getNpcs().closest("Dwarf"); if( dwarf != null ) dwarf.interact("Attack"); So that you can then handle the case where there isn't a Dwarf nearby. NPC dwarf = getNpcs().closest("Dwarf"); if( dwarf != null ) dwarf.interact("Attack"); else log("Where's he gone??"); It doesn't make sense to create a seperate method in an API to handle the null case, just sayin' ;)
-
GUI on Start
Read about Java Swing and how to use its components.
-
How to store a chat message into a variable
List<String> messages = getChatbox().getMessages(MessageType.PLAYER); it returns a list of messages, not a single message. Edit: If you are trying to get the most recent message you would use something like: List<String> messages = getChatbox().getMessages(MessageType.PLAYER); String message = messages.get(messages.size() - 1);
-
Explv's Location Assistant
I have now implemented some changes like this, the SDN script should be updated
-
Explv's Location Assistant
Sounds like a good idea, I will implement something like this today Thanks for the feedback
-
Explv's Location Assistant
These changes have been made and committed
-
Explv's Location Assistant
Thanks for checking it out I'll get on with fixing those things
-
Explv's Tutorial Island [Free] [Random Characters]
The script does resume Tutorial Island from where it left off. If sometimes this does not work, I think it may be due to the configs in the client not loading properly.
-
Explv's Tutorial Island [Free] [Random Characters]
I will take a look now, thanks I have added some more checks into the Fishing section which should hopefully prevent that from happening. I could not however recreate the mining bug, I will continue to test and see if it happens. For now I will post an update for the fishing bug. Please let me know if the problems still occur, thanks
-
Differentiating between chests
So would I if you want it to look nice, just trying to show its more commonly understood alternative
-
Differentiating between chests
You could use the IDs of the different chests, although this might break if the IDs ever change. Or yes use Loud packs technique, where you just create two positions, one for each Chest, and interact with the chest in the relevant position: Without the use of a filter, to loot "Chest 1" would look like: Position chest1 = new Position(x, x, x); for ( RS2Object obj : getObjects() ){ if (obj.getPosition() == chest1 ){ obj.interact(); break; } } Or with a filter: getObjects().closest(o -> o.getPosition().equals(new Position(x, x, x))).interact();
- Explv's Location Assistant
-
Check if user is in clan.
I made a little class that will hopefully deal with this ( not properly tested ) import org.osbot.rs07.api.ui.RS2Widget; import org.osbot.rs07.api.ui.Tab; import org.osbot.rs07.script.Script; import java.util.Random; public class ClanChatter{ private Script script; public ClanChatter(Script script){ this.script = script; } public boolean notInClanChat(){ RS2Widget notInChat = script.getWidgets().getWidgetContainingText("Not in chat"); return (notInChat != null && notInChat.isVisible()); } public void openClanChatTab(){ script.getTabs().open(Tab.CLANCHAT); } public boolean isClanChatTabOpen(){ return Tab.CLANCHAT.isOpen(script.getBot()); } public boolean isInClanChat(){ RS2Widget talkingIn = script.getWidgets().getWidgetContainingText("Talking in:"); return (talkingIn != null && talkingIn.isVisible() && !talkingIn.getMessage().contains("Not in chat")); } public void joinClanChat(String name){ //RS2Widget enterName = getWidgets().getWidgetContainingText("Enter the player name whose channel you wish to join:"); RS2Widget enterName = script.getWidgets().get(162, 32); RS2Widget joinChat = script.getWidgets().getWidgetContainingText("Join Chat"); if (enterName != null && enterName.isVisible()){ script.getKeyboard().typeString(name); sleep(4000, 5000); } else if (joinChat != null && joinChat.isVisible()) clickOnWidget(joinChat); } public void leaveClanChat(){ RS2Widget leaveWidget = script.getWidgets().getWidgetContainingText("Leave Chat"); if (leaveWidget != null && leaveWidget.isVisible()) clickOnWidget(leaveWidget); } public boolean isInClan(String name){ RS2Widget talkingIn = script.getWidgets().getWidgetContainingText("Talking in:"); return talkingIn.getMessage().contains(name); } public boolean isOwner(String name){ RS2Widget owner = script.getWidgets().getWidgetContainingText("Owner:"); return owner.getMessage().contains(name); } public void talkInClanChat(String output){ script.getKeyboard().typeString(String.format("/%s", output)); sleep(1500, 2000); } private void clickOnWidget(RS2Widget widget){ widget.hover(); script.getMouse().click(false); sleep(1500, 2000); } private void sleep(int min, int max){ try{ script.sleep(new Random().nextInt(max-min) + min); } catch(Exception e){ script.log(e); } } }
-
Explv's Tutorial Island [Free] [Random Characters]
Consider these bugs squashed.
-
Explv's Tutorial Island [Free] [Random Characters]
That's strange, it's worked for me every time. I'm sure there's still some bugs that need fixing in small places. I'm currently working on some new features, but will take a look at that straight after. Thanks for letting me know
-
Explv's Tutorial Island [Free] [Random Characters]
I think Tutorial Island is generally a banning hotspot. But don't worry i'm working on some more antiban stuff as we speak, update will be later today. Hopefully will improve
-
Explv's Tutorial Island [Free] [Random Characters]
Put it into the OSBot/Scripts folder, then reload OSBot
-
Explv's Tutorial Island [Free] [Random Characters]
Weird, I'll have to work on some nice antiban features
- Explv's Location Assistant