- import java.util.Map;
- import org.rsbot.event.events.ServerMessageEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.event.listeners.ServerMessageListener;
- import org.rsbot.script.methods.Skills;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.wrappers.RSComponent;
- import org.rsbot.script.wrappers.RSInterface;
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import javax.swing.border.*;
- @ScriptManifest(authors = "Meh", name = "Fletcher", version = 1.0, description = "Personal fletcher (might be public one day).")
- public class Fletcher extends Script {
- int closeGUI = 0;
- private gui gui;
- public boolean onStart(){
- gui = new gui();
- gui.setVisible(true);
- while (closeGUI != 1) {
- //Simply wait untill it's not 0 anymore.. Then, continue.
- }
- log("WORKS!");
- return true;
- }
- public void onFinish() {
- log("----------------------------------------------------------------");
- log(" Thank you for using Fletcher.");
- if (game.isLoggedIn()) {
- env.saveScreenshot(true);
- log(" A screenshot has been made and the script has been stopped.");
- } else {
- log("The script has been stopped. No screenshot saved (not logged in)");
- }
- log("----------------------------------------------------------------");
- }
- @Override
- public int loop() {
- return 0;
- }
- // START GUI
- @SuppressWarnings("Serial")
- public class gui {
- private void comboBox1ItemStateChanged(ItemEvent e) {
- }
- private void comboBox1ActionPerformed(ActionEvent e) {
- }
- private void FletchSelectionActionPerformed(ActionEvent e) {
- JComboBox cb = (JComboBox)e.getSource();
- String Option = (String)cb.getSelectedItem();
- if(Option == "Fletch")
- {
- BowTypeLabel.setText("Log and bow type:");
- FletchAmountLabel.setText("Amount to fletch (0 = All)");
- BowType.removeAllItems();
- BowType.addItem("Shortbow");
- BowType.addItem("Longbow");
- BowType.addItem("Oak Shortbow");
- BowType.addItem("Oak Longbow");
- BowType.addItem("Willow Shortbow");
- BowType.addItem("Willow Longbow");
- BowType.addItem("Maple Shortbow");
- BowType.addItem("Maple Longbow");
- BowType.addItem("Yew Shortbow");
- BowType.addItem("Yew Longbow");
- BowType.addItem("Magic Shortbow");
- BowType.addItem("Magic Longbow");
- FletchAmount.setText("0");
- KnifeType.setSelectedIndex(0);
- } else if(Option == "String")
- {
- BowTypeLabel.setText("Select bow to string");
- FletchAmountLabel.setText("Amount to string (0 = All)");
- BowType.removeAllItems();
- BowType.addItem("Shortbow (u)");
- BowType.addItem("Longbow (u)");
- BowType.addItem("Oak Shortbow (u)");
- BowType.addItem("Oak Longbow (u)");
- BowType.addItem("Willow Shortbow (u)");
- BowType.addItem("Willow Longbow (u)");
- BowType.addItem("Maple Shortbow (u)");
- BowType.addItem("Maple Longbow (u)");
- BowType.addItem("Yew Shortbow (u)");
- BowType.addItem("Yew Longbow (u)");
- BowType.addItem("Magic Shortbow (u)");
- BowType.addItem("Magic Longbow (u)");
- FletchAmount.setText("0");
- KnifeType.setSelectedIndex(0);
- } else if(Option == "Fletch and String")
- {
- BowTypeLabel.setText("Select bows to fletch");
- FletchAmountLabel.setText("Amount of bows (0 = All)");
- BowType.removeAllItems();
- BowType.addItem("Shortbow");
- BowType.addItem("Longbow");
- BowType.addItem("Oak Shortbow");
- BowType.addItem("Oak Longbow");
- BowType.addItem("Willow Shortbow");
- BowType.addItem("Willow Longbow");
- BowType.addItem("Maple Shortbow");
- BowType.addItem("Maple Longbow");
- BowType.addItem("Yew Shortbow");
- BowType.addItem("Yew Longbow");
- BowType.addItem("Magic Shortbow");
- BowType.addItem("Magic Longbow");
- FletchAmount.setText("0");
- KnifeType.setSelectedIndex(0);
- }
- }
- private void StartBTNActionPerformed(ActionEvent e) {
- closeGUI = 1;
- gui.setVisible(false);
- }
- private void initComponents() {
- frame1 = new JFrame();
- Logotext = new JLabel();
- logoslogan = new JLabel();
- Assignmentlabel = new JLabel();
- FletchSelection = new JComboBox();
- SubPanel = new JPanel();
- BowTypeLabel = new JLabel();
- BowType = new JComboBox();
- FletchAmountLabel = new JLabel();
- FletchAmount = new JTextField();
- KnifeTypelabel = new JLabel();
- KnifeType = new JComboBox();
- StartBTN = new JButton();
- CellConstraints cc = new CellConstraints();
- {
- frame1.setTitle("[Fletcher] - Settings");
- frame1.setResizable(false);
- Container frame1ContentPane = frame1.getContentPane();
- frame1ContentPane.setLayout(new GridBagLayout());
- ((GridBagLayout)frame1ContentPane.getLayout()).columnWidths = new int[] {0, 0, 0};
- ((GridBagLayout)frame1ContentPane.getLayout()).rowHeights = new int[] {0, 0, 0, 0, 0, 0, 0};
- ((GridBagLayout)frame1ContentPane.getLayout()).columnWeights = new double[] {0.0, 0.0, 1.0E-4};
- ((GridBagLayout)frame1ContentPane.getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4};
- Logotext.setText("Fletcher");
- Logotext.setFont(new Font("Tahoma", Font.PLAIN, 28));
- Logotext.setForeground(Color.gray);
- frame1ContentPane.add(Logotext, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 5, 0), 0, 0));
- logoslogan.setText("Created and published by MethodScripts Inc.");
- logoslogan.setFont(new Font("Tahoma", Font.PLAIN, 9));
- logoslogan.setForeground(Color.lightGray);
- frame1ContentPane.add(logoslogan, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 5, 0), 0, 0));
- Assignmentlabel.setText("Assignment:");
- frame1ContentPane.add(Assignmentlabel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 5, 0), 0, 0));
- FletchSelection.setModel(new DefaultComboBoxModel(new String[] {
- "Fletch",
- "String",
- "Fletch and String"
- }));
- FletchSelection.addItemListener(new ItemListener() {
- @Override
- public void itemStateChanged(ItemEvent e) {
- comboBox1ItemStateChanged(e);
- }
- });
- FletchSelection.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- comboBox1ActionPerformed(e);
- FletchSelectionActionPerformed(e);
- }
- });
- frame1ContentPane.add(FletchSelection, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 5, 0), 0, 0));
- {
- SubPanel.setBorder(new LineBorder(Color.black));
- SubPanel.setBorder(new javax.swing.border.CompoundBorder(
- new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0),
- "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER,
- javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Dialog", java.awt.Font.BOLD, 12),
- java.awt.Color.red), SubPanel.getBorder())); SubPanel.addPropertyChangeListener(new java.beans.PropertyChangeListener(){public void propertyChange(java.beans.PropertyChangeEvent e){if("border".equals(e.getPropertyName()))throw new RuntimeException();}});
- SubPanel.setLayout(new FormLayout(
- "default, $lcgap, default",
- "7*(default, $lgap), default"));
- BowTypeLabel.setText("Log and bow type:");
- BowTypeLabel.setHorizontalAlignment(SwingConstants.CENTER);
- SubPanel.add(BowTypeLabel, cc.xy(3, 1));
- BowType.setModel(new DefaultComboBoxModel(new String[] {
- "Shortbow",
- "Longbow",
- "Oak Shortbow",
- "Oak Longbow",
- "Willow Shortbow",
- "Willow Longbow",
- "Maple Shortbow",
- "Maple Longbow",
- "Yew Shortbow",
- "Yew Longbow",
- "Magic Shortbow",
- "Magic Longbow"
- }));
- SubPanel.add(BowType, cc.xy(3, 3));
- FletchAmountLabel.setText("Amount to fletch (0 = All)");
- FletchAmountLabel.setHorizontalAlignment(SwingConstants.CENTER);
- FletchAmountLabel.setVerticalAlignment(SwingConstants.BOTTOM);
- SubPanel.add(FletchAmountLabel, cc.xy(3, 7));
- FletchAmount.setText("0");
- FletchAmount.setHorizontalAlignment(SwingConstants.CENTER);
- SubPanel.add(FletchAmount, cc.xy(3, 9));
- KnifeTypelabel.setText("Type of knife:");
- KnifeTypelabel.setHorizontalAlignment(SwingConstants.CENTER);
- SubPanel.add(KnifeTypelabel, cc.xy(3, 13));
- KnifeType.setModel(new DefaultComboBoxModel(new String[] {
- "Normal",
- "Sacred Clay"
- }));
- SubPanel.add(KnifeType, cc.xy(3, 15));
- }
- frame1ContentPane.add(SubPanel, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 5, 0), 0, 0));
- StartBTN.setText("Start Fletcher");
- StartBTN.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- StartBTNActionPerformed(e);
- }
- });
- frame1ContentPane.add(StartBTN, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0,
- GridBagConstraints.CENTER, GridBagConstraints.BOTH,
- new Insets(0, 0, 0, 0), 0, 0));
- frame1.pack();
- frame1.setLocationRelativeTo(frame1.getOwner());
- }
- }
- private JFrame frame1;
- private JLabel Logotext;
- private JLabel logoslogan;
- private JLabel Assignmentlabel;
- private JComboBox FletchSelection;
- private JPanel SubPanel;
- private JLabel BowTypeLabel;
- private JComboBox BowType;
- private JLabel FletchAmountLabel;
- private JTextField FletchAmount;
- private JLabel KnifeTypelabel;
- private JComboBox KnifeType;
- private JButton StartBTN;
- }
- // END GUI
- }