Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package scripts.Merchanter;
- import org.tribot.api.General;
- import org.tribot.api.input.Mouse;
- import org.tribot.api2007.Interfaces;
- import org.tribot.api2007.Player;
- import org.tribot.api2007.Walking;
- import org.tribot.api2007.types.RSInterfaceChild;
- import org.tribot.api2007.types.RSInterfaceComponent;
- import org.tribot.api2007.types.RSTile;
- import org.tribot.script.Script;
- public class TradeRequestCheck extends Script implements Runnable {
- public String PlayerTraded;
- public RSTile OriginalTile;
- public void run() {
- if(WeBeenTraded())
- { OriginalTile = Player.getRSPlayer().getPosition();
- println("Trading with: " + PlayerTraded);
- Mouse.setSpeed(General.random(130,150));
- Mouse.move(General.random(22, 100), General.random(451, 452)); //clicks their name to trade
- Mouse.click(1);
- sleep(2000, 3000);
- OriginalTileCheck();
- Mouse.setSpeed(General.random(85, 95)); }
- }
- private boolean WeBeenTraded() {
- RSInterfaceChild i = Interfaces.get(137, 2); //chatbox
- for (int x = 199; x > -1; x--)
- { RSInterfaceComponent j = i.getChild(x);
- if (!j.getText().isEmpty())
- if (j.getText().contains(" wishes to trade with you."))
- { String Wishes = " wishes to trade with you.";
- int Length = j.getText().length() - Wishes.length();
- PlayerTraded = j.getText().substring(0, Length);
- return true; } }
- return false;
- }
- private void OriginalTileCheck() {//Complete. It keeps saying wrong area but its wrong. check this
- if (!Player.getRSPlayer().getPosition().equals(OriginalTile))
- { Walking.walkTo(OriginalTile);
- sleep(General.random(1403,3064)); }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment