crashbashash
Members-
Posts
2 -
Joined
-
Last visited
Content Type
Profiles
Forums
Articles
Store
Everything posted by crashbashash
-
How do I make a bot world hop?
crashbashash replied to Berserker's topic in Software & Script Development Discussion
There are a couple of ways you can do this. Firstly you can make a list of valid worlds and then hop to either of those. import com.epicbot.api.shared.util.Random; import com.epicbot.api.shared.script.ScriptManifest; import com.epicbot.api.shared.GameType; @ScriptManifest(name = "World Hopper", gameType = GameType.OS) public class WorldHopper extends LoopScript { private int[] AVAILABLE_WORLDS = {501, 562, 544, 499, 502}; @Override protected int loop() { // Get the current world int previousWorld = getAPIContext().world().getCurrent(); // Select random world from AVAILABLE WORLDS int randomWorld = AVAILABLE_WORLDS[Random.nextInt(0, AVAILABLE_WORLDS.length - 1)]; // Hop to random world getAPIContext().world().hop(randomWorld); // Sleep till world changes Time.sleep(5000, 15000, () -> getAPIContext().world().getCurrent() != previousWorld); return 0; } } Another method would be to use the world().hopToF2P() or world().hopToP2P() import com.epicbot.api.shared.script.ScriptManifest; import com.epicbot.api.shared.GameType; @ScriptManifest(name = "World Hopper", gameType = GameType.OS) public class WorldHopper extends LoopScript { @Override protected int loop() { // Get the current world int previousWorld = getAPIContext().world().getCurrent(); // Hop to F2P world (switch F2P for P2P for members) getAPIContext().world().hopToF2P(); // Sleep till the world changes Time.sleep(5000, 15000, () -> getAPIContext().world().getCurrent() != previousWorld); return 0; } } -
UI for epic bot parameters
crashbashash replied to miqibot's topic in Software & Script Development Discussion
public class PrivateWalkerGUI extends JFrame { private JPanel panel; private JLabel label; private JComboBox<String> comboBox; private JButton button; private String areaName; private Area area; private enum Areas { VARROCK ("Varrock", new Area(new Tile(3210, 3422, 0), new Tile(3218, 3433, 0))), LUMBRIDGE ("Lumbridge", new Area(new Tile(3221, 3221, 0), new Tile(3226, 3216, 0))); private final String name; private final Area area; Areas(String _name, Area _area) { this.name = _name; this.area = _area; } } public PrivateWalkerGUI(PrivateWalkerBot bot) { setTitle("Private Walker"); setSize(300, 100); setLocationRelativeTo(null); setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new BorderLayout()); panel = new JPanel(); panel.setLayout(new FlowLayout()); label = new JLabel("Select an area to walk to: "); panel.add(label); comboBox = new JComboBox<String>(); for (Areas a : Areas.values()) { comboBox.addItem(a.name); } panel.add(comboBox); button = new JButton("Walk"); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { areaName = (String) comboBox.getSelectedItem(); for (Areas a : Areas.values()) { if (a.name.equals(areaName)) { area = a.area; } } bot.setArea(area); } }); panel.add(button); add(panel); setVisible(true); } } This is a very basic implementation of the GUI system in EpicBot. Epic bot automatically sets the look and feel (laf) of the Java Swing GUI. So you don't really need to worry about it too much.