HTM 31 Posted December 18, 2020 Hey guys, i have a script that worked fine in DB2 that i coded, i havent really been around since DB3 came out so i've been learning the new api and cleaning my scripts up for DB3. i've changed everything over to correct api standards but im still having the same issue when i start my script. This screenshot is the only info i get from the client side. in intellij is runs without issues but once it is Jar'd and put into db3 it basically freezes. the scripts starts and runs but is beyond laggy. this one is more of an aio i was working on and still in progress but here is the pastebin import org.dreambot.api.methods.skills.Skill; import org.dreambot.api.methods.skills.Skills; import org.dreambot.api.methods.skills.SkillTracker; import org.dreambot.api.utilities.Timer; import javax.swing.*; import java.awt.*; import java.util.ArrayList; import java.util.List; import javax.swing.JFrame; import static org.dreambot.api.methods.MethodProvider.log; import static org.dreambot.api.methods.skills.Skill.FISHING; import static org.dreambot.api.methods.skills.Skill.WOODCUTTING; import static org.dreambot.api.utilities.Timer.formatTime; public class GuiHelper extends JFrame { private GuiHelper(Main m) { context = m; } public static Timer timeRan; private static Main context = null; ///////////////fishing variables///////////// static FishingHelper fishingHelper; BarbarianFish barbFisher; private static String fishingLocation; public static boolean isFishing = false; ////////////////////////////////////////////// ///////////////Woodcutting Variables////////// private static String WoodcuttingLocation; private static String woodcuttingLocation; private static boolean isWoodcutting = false; //////////////////////////////////////////////// private static boolean isFiremaking; private static boolean isMining; private static boolean isCooking; private static boolean isSmithing; private static boolean isFletching; public static boolean getisFishing() { return isFishing; } public static void setisFishing(boolean val) { isFishing = val; } ///////////////////////////////^^^^StartUp GUI^^^^\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ///////////Below gui controls the gui that starts when the bot is played on DB\\\\\\\\\\\\\\\\ ///////////////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ public static List<Skill> SkillSelector(Component client, Main context) { SkillTracker.start(); JFrame frame = new JFrame(); frame.setTitle("AioSkillSelector"); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setLocationRelativeTo(client); frame.setPreferredSize(new Dimension(400, 200)); frame.getContentPane().setLayout(new BorderLayout()); frame.setVisible(true); frame.pack(); JPanel settingPanel = new JPanel(); settingPanel.setLayout(new GridLayout(0, 2)); JLabel label = new JLabel(); label.setText("Select Skill:"); settingPanel.add(label); JCheckBox fishingCheckBox = new JCheckBox(); fishingCheckBox.setText("Fishing"); settingPanel.add(fishingCheckBox); JCheckBox woodcuttingCheckBox = new JCheckBox(); woodcuttingCheckBox.setText("WoodCutting"); settingPanel.add(woodcuttingCheckBox); JCheckBox firemakingCheckBox = new JCheckBox(); firemakingCheckBox.setText("Firemaking"); settingPanel.add(firemakingCheckBox); JCheckBox miningCheckBox = new JCheckBox(); miningCheckBox.setText("Mining"); settingPanel.add(miningCheckBox); JCheckBox cookingCheckBox = new JCheckBox(); cookingCheckBox.setText("Cooking"); settingPanel.add(cookingCheckBox); JCheckBox smithingCheckBox = new JCheckBox(); smithingCheckBox.setText("Smithing"); settingPanel.add(smithingCheckBox); JCheckBox fletchingCheckBox = new JCheckBox(); fletchingCheckBox.setText("Fletching"); settingPanel.add(fletchingCheckBox); frame.getContentPane().add(settingPanel, BorderLayout.CENTER); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new FlowLayout()); JButton button = new JButton(); button.setText("Next"); button.addActionListener(e -> { isFishing = fishingCheckBox.isSelected(); if (fishingCheckBox.isSelected()) { setisFishing(true); log("fishing set true"); GuiHelper.createFishingGUI(client, context); } isFletching = fletchingCheckBox.isSelected(); isWoodcutting = woodcuttingCheckBox.isSelected(); isFiremaking = firemakingCheckBox.isSelected(); isMining = miningCheckBox.isSelected(); isCooking = cookingCheckBox.isSelected(); isSmithing = smithingCheckBox.isSelected(); frame.dispose(); }); buttonPanel.add(button); frame.getContentPane().add(buttonPanel, BorderLayout.SOUTH); return new ArrayList<>(); }
Pseudo 179 Posted December 18, 2020 In your onStart/gui loading, are you using SwingUtilities.invokeLater to initialize your GUI?
HTM 31 Author Posted December 18, 2020 15 minutes ago, Pseudo said: In your onStart/gui loading, are you using SwingUtilities.invokeLater to initialize your GUI? honestly i've spent the last hour trying to figure "invokeLate" out. this is what i have as my onStar public void onStart() { SwingUtilities.invokeLater(GuiHelper.SkillSelector(Instance.getCanvas(), this)); log("Welcome to AIO by Hoke2012.");} i still seem to be facing issues though
Pseudo 179 Posted December 18, 2020 public void onStart() { SwingUtilities.InvokeLater(new Runnable() { @Override public void run() { Gui g = new Gui(); g.setVisible(true); } }); }
yeeter 529 Posted December 18, 2020 Glad you figured it out. Also for future script conversions I have an updater that should work for the most part to automatically update db2 source -> db3. Any issues let me know.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.