Everything posted by Explv
-
Compiling code
https://www.cs.utexas.edu/~scottm/cs307/handouts/Eclipse%20Help/jarInEclipse.htm Ignore the .zip part at the end
-
Faster typing!
See my post here for a working solution: http://osbot.org/forum/topic/85684-finished-my-new-script-but-how-do-i-type-faster/?p=952925 I would paste the code but I'm on my phone Edit (pasted code here): 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); }
-
Parsing private messages and clan chat
String values are compared using .equals() not == Also the message will not contain / It should be: if(messageReceived.equals("!Test")){ log("Test received.."); getKeyboard().typeString("/Success!", true); }
-
Parsing private messages and clan chat
I think it might be ID 9 for clan chat: @Override public void onMessage(Message message){ if(message.getTypeId() == 9){ // do something } }
-
Parsing private messages and clan chat
The only MessageTypes available are: GAME PLAYER RECEIVE_TRADE So GAME will include clan chat messages.
-
Parsing private messages and clan chat
@Override public void onMessage(Message message){ if(message.getType() == Message.MessageType.PLAYER){ String text = message.getMessage(); } } That should get you started
-
[Tutorial] Simple but Effective Tips
The real problem with those variables is that most of them are obsolete. Start xp doesn't need to be stored because all xp gain calculations can be accessed through ExperienceTracker. NPCs and Widgets shouldn't be stored globally because they are most likely going to need to be refreshed every time the method that uses them is called, same with run time. Let us all bow our heads and pray that he at least uses OOP. /roast
-
RSlayer [AIO]
Code looks clean but pretty awful
-
Accounts compromised.
Did you use any scripts from the Local section? They are not checked by OSBot staff.
-
How to determine when an action is completed.
Shoot him! But seriously you do it in your scripts too
-
How to determine when an action is completed.
Your states should be based on some boolean condition, not set when you think they should be. Otherwise when an action fails your script will be rekt. Also you should use the getBank().open() method. enum State{ OPEN_BANK, BANK } private State getState(){ return getBank() != null && getBank().isOpen() ? State.BANK : State.OPEN_BANK; } @Override public int onLoop() throws InterruptedException{ switch (getState()) { case OPEN_BANK: getBank().open(); break; case BANK: //Dostuff break; } return random(200, 250); }
-
getNearestBank();
This is not correct though, as the distance between two positions is not the same as walking distance. Therefore it can easily return a bank that is further away, as it is closer, but the route is longer. Also if you are in a dungeon it will return an incorrect bank due to the way the map is laid out.
-
Explv's Tutorial Island [Free] [Random Characters]
This has been fixed
-
Paint disappearing when minimizing client, will only show when I hover over it ?
Well it has no impact on performance. If imgur fucks up your script will still work. onPaint runs on a separate thread so I think there could also be a point at the start where img is null
-
Paint disappearing when minimizing client, will only show when I hover over it ?
Not relevant to your problem but in your onPaint you should also do a null check for your image. if(img != null) g.drawImage(img, null, 0, 335);
-
[req] profit/hr cod3
- Walking A Path --> Newer API
If you want to make a list like that it would be a lot cleaner to do: private final List<Position> TO_BANK = Arrays.asList(new Position[]{ new Position(random(3323, 3320), random(3137,3141), 0)); new Position(random(3318, 3321), random(3144,3147), 0); new Position(random(3307,3313), random(3146, 3152), 0); new Position(random(3301,3305), random(3149,3152), 0); new Position(random(3288,3297), random(3147, 3150), 0); new Position(random(3280, 3289), random(3150, 3153), 0); new Position(random(3276, 3279), random(3155, 3158), 0); new Position(random(3273, 3278), random(3160, 3163), 0); new Position(random(3269, 3272), random(3162,3170), 0); }); But yeah, use the web walker instead: getWalking().webWalk(new Position(0, 0, 0));- GE Script Question
No code after a return statement will be executed.- Explv's Walker
Yeah the script is broken rn, haven't had the time to fix it.- [Windows XP(newPC)]
Update Java to the latest version. You should really update your OS too.- Where can I improve?
1) For your runeCheck method you should use a switch not if else statements. 2) When comparing Strings, like in your runeCheck method you should use .equals() not == For Strings, == compares references, where as .equals() compares the values. 3) Your runeCheck method can be replaced with, getMagic().canCast(teleport); 4) Formatting. 5) Stop using this. where you don't need to. This. is a reference to the current object. It is not needed to refer to fields in the current object, unless you have a parameter with the same name. 6) Use my time formatting method, it looks nicer public String formatTime(long ms){ long s = ms / 1000, m = s / 60, h = m / 60, d = h / 24; s %= 60; m %= 60; h %= 24; return d > 0 ? String.format("%02d:%02d:%02d:%02d", d, h, m, s) : h > 0 ? String.format("%02d:%02d:%02d", h, m, s) : String.format("%02d:%02d", m, s); } 7) You don't need to store currentXp, or timeRan, or any variables like that. This information can be calculated when needed, or obtained using the ExperienceTracker and are not used in any other methods. For example there is the gainedLevels and gainedXp methods in ExperienceTracker. 8) Seriously, formatting.- Furnace animation delay
Just do a really long ConditionalSleep. For example if you are smelting Gold bars you could do something like: private final ConditionalSleep SMELTING_SLEEP = new ConditionalSleep(100_000) { @Override public boolean condition() throws InterruptedException { return !getInventory().contains("Gold ore"); } }; When you start smelting, you can call: SMELTING_SLEEP.sleep(); And it will then sleep for up to 100 seconds, or until the inventory no longer contains Gold Ore- Need some help/advice
- Never really coded in java, where to start
getWalking().walk(position); or getWalking().webWalk(position);- Never really coded in java, where to start
Or just go to http://www.javadecompilers.com/ - Walking A Path --> Newer API