Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • dreamwiver

    Scripter
    • Posts

      69
    • Joined

    • Last visited

    Everything posted by dreamwiver

    1. Noted, thank you so much for the suggestion. I will add a menu at the begining of the script so users can optionally choose what is the minimum of value, to avoid picking up ashes and other cheap stuff.
    2. Stays only in one world. I would consider it as a feature for newer versions, however I don't see too many people in the Grand Exchange outside world 1. I currently don't have any account with membership, no idea if its the same in member worlds.
    3. Thank you! Again if anyone has any issues with the script or wants to suggest features, let me know in this threat.
    4. Right! I may be writing a small guide later on how to use listeners on a scrip made on TaskScript.
    5. Hello @alexios1 I'm afraid the client was frozen due to a bug of mine. If anyone is interested here is the working code of the issue: package Trader; import org.dreambot.api.methods.Calculations; import org.dreambot.api.methods.trade.Trade; import org.dreambot.api.script.ScriptManager; import org.dreambot.api.script.TaskNode; import org.dreambot.api.script.listener.ChatListener; import org.dreambot.api.wrappers.widgets.message.Message; public class AccepterNode extends TaskNode { private boolean incomingTrade = false; private String trader; @Override public int priority(){ return 2; } AccepterNode(){ ScriptManager.getScriptManager().addListener(new ChatListener() { @Override public void onTradeMessage(Message message) { incomingTrade = true; trader = message.getUsername(); } }); } @Override public boolean accept() { return incomingTrade; } @Override public int execute() { Trade.tradeWithPlayer(trader); sleepUntil(()-> Trade.isOpen(), 5000, 500); incomingTrade = false; return Calculations.random(200, 1000); } } This Node will listen for trade requests, and accept them once one is received. I have another Node which is activated when the Trade screen is open, using this code: @Override public boolean accept() { return Trade.isOpen(1); }
    6. Hello @Genius, @Pandemic Thank you for the fast response. However I don't understand how can I use the onLoop method since i'm using TaskScript and all my logic is done in the Nodes. I have a Node which is activated when the trade screen is open, and another one when the second trade screen is open. Is there any way I can activate a node "manually" from the onTradeMessage method? I would prefer to avoid overrating the onLoop method since I'd like to have all the logic on the nodes. Thank you so much
    7. Hello, I'm trying to make a script which accepts incoming trades. As suggested by the javadocs, i'm implementing ChatListener. When a trade requests is received, the client freezes and it's impossible to interact with it. Only option I found is closing it, and opening it again. I noticied the client breaks with any kind of interaction, it also broke by making it follow the other player instead of trading with him. Here is my MainClass, notice i'm extending TaskScript package Trader; import org.dreambot.api.methods.emotes.Emotes; import org.dreambot.api.methods.interactive.Players; import org.dreambot.api.methods.trade.Trade; import org.dreambot.api.methods.trade.TradeUser; import org.dreambot.api.script.Category; import org.dreambot.api.script.ScriptManifest; import org.dreambot.api.script.TaskNode; import org.dreambot.api.script.impl.TaskScript; import org.dreambot.api.script.listener.ChatListener; import org.dreambot.api.wrappers.interactive.Player; import org.dreambot.api.wrappers.widgets.message.Message; import org.dreambot.core.Instance; import java.awt.*; @ScriptManifest(version = 1.0, author = "dreamwiver", category = Category.MISC, name = "Auto Trader") public class MainClass extends TaskScript implements ChatListener { @Override public void onStart() { addNodes(new AccepterNode(), new TradingNode()); } @Override public void onTradeMessage(Message message){ log(message.getMessage()); Player trader = Players.closest(message.getUsername()); log("player found "+trader.getName()); Trade.tradeWithPlayer(trader.getName()); sleepUntil(()-> Players.getLocal().isAnimating(), 1000, 700); } } Any suggestion on how approach this issue is appreciated. Thank you so much
    8. Hello, If I understand it correctly, the script just have to get a few names from the players around, print them in the chat along with a custom sentence? (In this case "are hacked accounts to scam")
    9. Hello, I attach my solution for the problem presented in which consists in a bot that makes the character walk to the grand exchange, and pick up all items found in the ground. The script also makes the character drop the items to the bank when inventory is full. The script itself it's very simple, but I'm happy to hear all the suggestions to improve it with further features.
    10. Hello, if you are still interested I can work on it. Could post it in the script marketplace for free since it's quite a basic code.
    11. Hello @Genius, Indeed my problem was the sleepUntil. Thank you!
    12. Hello, I can do that. However I don't understand why would anyone want to randomly trade someone who is standing. Shouldn't the bot include the option to write things in the chat? Regards
    13. Hello, I'm trying to learn the fundamentals of the TaskScript, but I'm failing at creating a very simple script, which kills a hill giant and loots his bones. So far I don't care what would happen when the inventory gets full. These are the files: MainClass package Slayer; import org.dreambot.api.methods.interactive.Players; import org.dreambot.api.script.Category; import org.dreambot.api.script.ScriptManifest; import org.dreambot.api.script.TaskNode; import org.dreambot.api.script.impl.TaskScript; import org.dreambot.core.Instance; import java.awt.*; @ScriptManifest(version = 1.0, author="tpm", category = Category.SLAYER, name="Giant slayer") public class MainClass extends TaskScript { @Override public void onStart() { addNodes(new AttackNode(), new LootNode()); } public void onPaint(Graphics2D g) { TaskNode previousNode = getLastTaskNode(); g.drawString("State: " + previousNode.getClass().getName() ,12,77); } } Attack node package Slayer; import org.dreambot.api.methods.Calculations; import org.dreambot.api.methods.container.impl.Shop; import org.dreambot.api.methods.interactive.NPCs; import org.dreambot.api.methods.interactive.Players; import org.dreambot.api.methods.item.GroundItems; import org.dreambot.api.script.TaskNode; import org.dreambot.api.wrappers.interactive.NPC; public class AttackNode extends TaskNode { @Override public int priority() { return 1; } @Override public boolean accept() { return true; } @Override public int execute() { if (NPCs.closest("Hill Giant") != null) { NPC giant = NPCs.closest("Hill Giant"); if (!giant.isInCombat()) { giant.interact("Attack"); sleepUntil(() -> !giant.isMinimapDot() && Players.getLocal().getSurroundingArea(1).contains(GroundItems.closest("Big bones")), 5000, 5000); } } return Calculations.random(500, 2000); } } LootNode package Slayer; import org.dreambot.api.methods.Calculations; import org.dreambot.api.methods.container.impl.Inventory; import org.dreambot.api.methods.interactive.Players; import org.dreambot.api.methods.item.GroundItems; import org.dreambot.api.script.TaskNode; import org.dreambot.api.wrappers.items.GroundItem; public class LootNode extends TaskNode { @Override public int priority(){ return 2; } @Override public boolean accept() { if (Players.getLocal().isInCombat()) return false; return (GroundItems.closest("Big bones") != null && (Players.getLocal().distance(GroundItems.closest("Big bones")) < 3)); } @Override public int execute() { GroundItem bones = GroundItems.closest("Big bones"); if(bones != null) bones.interact("Take"); return Calculations.random(500, 2000); } } I would like the script to kill the giant, pick his bone, and seek another giant and so on, but so far I just managed to only killing, not picking up any bones. I imagine I'm failing to understand the concept of the sleepUntil. Any suggestions will be pretty much appreciated Thank you
    14. Works like a charm, thank you both! Here it's the working code GUI.java package Woodcutter; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class GUI extends JFrame{ private JPanel principal; private JTextField txtName; private JButton button1; public GUI() { JFrame g = new JFrame(); g.setSize(300, 400); g.setLocationByPlatform(true); g.setResizable(false); g.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); // Add this so you don't close out DB if you close your GUIt principal = new JPanel(); txtName = new JTextField("dreamwiver"); button1 = new JButton("Click me"); button1.addActionListener(l -> JOptionPane.showMessageDialog(button1, txtName.getText() + " Hello")); principal.add(txtName); principal.add(button1); g.getContentPane().setLayout(new BorderLayout()); g.getContentPane().add(principal, BorderLayout.NORTH); g.pack(); g.setVisible(true); } public static void main(String[] args) { } } onStart: @Override public void onStart() { SwingUtilities.invokeLater(() -> { new GUI(); }); }
    15. Hello @holic, thank you for the fast response. I'm trying to change it with your suggestion: public class GUI { private JPanel principal; private JTextField txtName; private JButton button1; public GUI() { button1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(button1, txtName.getText()+"Hello"); } }); JFrame g = new JFrame(); g.setContentPane(principal); g.setSize(300, 400); g.pack(); g.setLocationByPlatform(true); g.setResizable(false); g.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); // Add this so you don't close out DB if you close your GUIt g.setVisible(true); } } I removed the main method and put everything in the constructor. The IDE basically complains there's no main method, which makes sense I think (I haven't touched Java for a long time). If I add a blank main method, when I run the script, it doesn't invoke any Form. Any ideas? Thank you so much
    16. Hello, First of all I apologize if this topic has appeared before, I have been looking for a while but I cannot find anything related. I'm trying to add a Java Swing form into my script, which consists in just a textfield and a button. This is just for learning purposes, I know it doesn't have any interesting logic. The GUI code: package Woodcutter; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class GUI extends JFrame{ private JPanel principal; private JTextField txtName; private JButton button1; public GUI() { button1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(button1, txtName.getText()+"Hello"); } }); } public static void main(String[] args) { GUI g = new GUI(); g.setContentPane(g.principal); g.setSize(300, 400); g.pack(); g.setVisible(true); } } My onStart() method: @Override public void onStart() { log("hi"); SwingUtilities.invokeLater(() -> { GUI gui = new GUI(); gui.setVisible(true); }); } If I preview the Form in the Form designer, it displays properly, however, when I run the script on the Dreambot client, the form stays in the background without any information printed on it. Any suggestion? Thank you so much
    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.