-
Posts
1495 -
Joined
-
Last visited
-
Days Won
1 -
Feedback
100%
Everything posted by Vilius
-
Yep, you do need to do that, or just create your own interaction.
-
I suppose it does, but I have no idea why would you want to check that, just do: if(!script.getBank().isOpen()){ //if closed open bank script.getBank().open(); }else{ //if open do banking, take stuff, deposit stuff. script.getBank().depositAll("Logs"); }
-
Check if the player is animating or not if(!script.myPlayer().isAnimating()){ //chop }
-
[HELP] Looking for someone who will help me out ! [Will PAY]
Vilius replied to Ornamental's topic in Scripting Help
Sure -
I just think his main class isnt extending Script.
-
Hero, please follow the simple code conventions given here, it will make our life easier: http://www.oracle.com/technetwork/java/codeconventions-135099.html
-
Make sure you have Java 8installed, http://java.com/download
-
How do i make my script STOP and not just stop moving
Vilius replied to Ornamental's topic in Scripting Help
Right I guess you dont want that, in that case do this: getBot().getScriptExecutor().setRunningScript(false); -
How do i make my script STOP and not just stop moving
Vilius replied to Ornamental's topic in Scripting Help
It is: stop(); -
Please give me some constructive criticism on my first script!
Vilius replied to GaetanoH's topic in Scripting Help
Its actually that that the cooking animation ends -> interp (-1) -> new cooking animation. Using a Timer allows it to skip that interp and if the idle is longer than say 1000ms then you would try to cook again/bank or what not. -
Please give me some constructive criticism on my first script!
Vilius replied to GaetanoH's topic in Scripting Help
Instead of: isCooking = myPlayer().getAnimation() != -1 ? true : isCooking; if(emeraldBenedict != null){ if(!bank.isOpen()){ emeraldBenedict.interact("Bank"); sleep(1500); if(bank.isOpen()){ bank.depositAll(); bank.withdraw("Raw trout", 28); bank.close(); sleep(random(300,400)); } } } you could do: isCooking = myPlayer().isAnimating(); if(emeraldBenedict != null){ if(!getBank().isOpen()){ emeraldBenedict.interact("Bank"); sleep(1500); }else{ getBank().depositAll(); getBank().withdraw("Raw trout", 28); getBank().close(); sleep(random(300,400)); } } Plus you shouldn't nest your if statements so often. And don't return null in your getState(), if something goes wrong you will get npe's just add a waiting state -
Timer class: public class Timer { private long period; private long start; public Timer(long period) { this.period = period; this.start = System.currentTimeMillis(); } public long getElapsed() { return System.currentTimeMillis() - this.start; } public long getRemaining() { return this.period - this.getElapsed(); } public boolean isRunning() { return this.getElapsed() <= this.period; } public void setPeriod(long period) { this.period = period; } public void reset() { this.start = System.currentTimeMillis(); } public static String format(long milliSeconds) { long secs = milliSeconds / 1000L; return String.format("%02d:%02d:%02d", new Object[] { Long.valueOf(secs / 3600L), Long.valueOf(secs % 3600L / 60L), Long.valueOf(secs % 60L) }); } }Then simply implement it like this: Timer timer = new Timer(4000); if(myPlayer().isAnimating()){ timer.reset(); } if(timer.getElapsed() > 4000){ //do stuff } That should work, just change the 4000 into the time it takes to cook the whole inventory in milisecondsActually change the time it takes to cook one and the delay in between, 4000ms should work.
-
Our mouse class public class Mouse implements MouseListener { //create a boolean public boolean hidePaint; @Override public void mouseClicked(MouseEvent e) { //create our point variable Point p = e.getPoint(); //create our rectangle Rectangle rec = new Rectangle(x,y,width,height); //check if the rectangle contains point and change booleans state if(rec.contains(p)) hidePaint = !hidePaint; } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { } } Main class public class Main extends Script{ //pas our mouse object Mouse mouse = new Mouse(); public void onStart(){ //add our mouse object as a mouse listener getBot().addMouseListener(mouse); } public void onPaint(Graphics2D g){ //check if our boolean is false if(!mouse.hidePaint){ //draw our stuff } } public int onLoop(){ return 0; } } Hope this helps
-
[Help Request] Get dynamic Area + Hover next Object?
Vilius replied to m6P9aRdAb4Z0's topic in Scripting Help
Find yourself a static object that doesnt change its position in any instance created and map out the areas from its position. For getting all objects you could use RS2Object[] objc = getObjects().getAll().stream().filter(o -> o != null && o.getId() == id && areaVar.contains(o)); -
The LAF might have changed, but it shouldnt affect any buttons with actions
-
getWalking().webWalk(new Position(x,y,z)); The webWalk method needs a Position object to be passed into its parameters. Someone didn't want to overload the method much more
-
http://hyperphysics.phy-astr.gsu.edu/hbase/cf.html http://www.s-cool.co.uk/a-level/physics/circular-motion/revise-it/angles-in-radians-and-angular-speed-versus-linear-speed goodluck
-
//interact with inventory getInventory().interact("Use", "item"); //check is item selected if(getInventory().isItemSelected()){ //get the fire object RS2Object fire = getObjects().closest("Fire"); //interact with fire fire.interact("Use"); } I'm guessing that is what you want to do.
-
ty for giveaway
-
Oh, and you should always look at the logger and see what line the error occurs one ;)
-
Just do this //position object Position pos = new Position(x,y,z); //Will check if name is right and will check if the position isnt the ignored one NPC fish = getNpcs().closest(o -> o.getName().equals("Fishing spot") && !o.getPosition().equals(pos)); //Interact with fish fish.interact("action");