Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 25th, 2012  |  syntax: None  |  size: 9.79 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import java.util.Map;
  2. import org.rsbot.event.events.ServerMessageEvent;
  3. import org.rsbot.event.listeners.PaintListener;
  4. import org.rsbot.event.listeners.ServerMessageListener;
  5. import org.rsbot.script.methods.Skills;
  6. import org.rsbot.script.Script;
  7. import org.rsbot.script.ScriptManifest;
  8. import org.rsbot.script.wrappers.RSComponent;
  9. import org.rsbot.script.wrappers.RSInterface;
  10. import java.awt.*;
  11. import java.awt.event.*;
  12. import javax.swing.*;
  13. import javax.swing.border.*;
  14.  
  15. @ScriptManifest(authors = "Meh", name = "Fletcher", version = 1.0, description = "Personal fletcher (might be public one day).")
  16. public class Fletcher extends Script {
  17.  
  18.         int closeGUI = 0;
  19.         private gui gui;
  20.        
  21.         public boolean onStart(){
  22.                 gui = new gui();
  23.                 gui.setVisible(true);
  24.                
  25.                 while (closeGUI != 1) {
  26.                         //Simply wait untill it's not 0 anymore.. Then, continue.
  27.                 }
  28.                 log("WORKS!");
  29.                
  30.                 return true;
  31.         }
  32.  
  33.         public void onFinish() {
  34.                 log("----------------------------------------------------------------");
  35.                 log("          Thank you for using Fletcher.");
  36.                 if (game.isLoggedIn()) {
  37.                                 env.saveScreenshot(true);
  38.                                 log("  A screenshot has been made and the script has been stopped.");
  39.                 } else {
  40.                         log("The script has been stopped. No screenshot saved (not logged in)");
  41.                 }
  42.                 log("----------------------------------------------------------------");
  43.         }
  44.  
  45.         @Override
  46.         public int loop() {
  47.  
  48.                 return 0;
  49.  
  50.         }
  51.  
  52.         // START GUI
  53.         @SuppressWarnings("Serial")
  54.         public class gui  {
  55.                
  56.                 private void comboBox1ItemStateChanged(ItemEvent e) {
  57.                 }
  58.  
  59.                 private void comboBox1ActionPerformed(ActionEvent e) {
  60.                 }
  61.  
  62.                 private void FletchSelectionActionPerformed(ActionEvent e) {
  63.                         JComboBox cb = (JComboBox)e.getSource();
  64.                         String Option = (String)cb.getSelectedItem();
  65.                         if(Option == "Fletch")
  66.                         {
  67.                                 BowTypeLabel.setText("Log and bow type:");
  68.                                 FletchAmountLabel.setText("Amount to fletch (0 = All)");
  69.                                 BowType.removeAllItems();
  70.                                 BowType.addItem("Shortbow");
  71.                                 BowType.addItem("Longbow");
  72.                                 BowType.addItem("Oak Shortbow");
  73.                                 BowType.addItem("Oak Longbow");
  74.                                 BowType.addItem("Willow Shortbow");
  75.                                 BowType.addItem("Willow Longbow");
  76.                                 BowType.addItem("Maple Shortbow");
  77.                                 BowType.addItem("Maple Longbow");
  78.                                 BowType.addItem("Yew Shortbow");
  79.                                 BowType.addItem("Yew Longbow");
  80.                                 BowType.addItem("Magic Shortbow");
  81.                                 BowType.addItem("Magic Longbow");
  82.                                 FletchAmount.setText("0");
  83.                                 KnifeType.setSelectedIndex(0);
  84.  
  85.                         } else if(Option == "String")
  86.                         {
  87.                                 BowTypeLabel.setText("Select bow to string");
  88.                                 FletchAmountLabel.setText("Amount to string (0 = All)");
  89.                                 BowType.removeAllItems();
  90.                                 BowType.addItem("Shortbow (u)");
  91.                                 BowType.addItem("Longbow (u)");
  92.                                 BowType.addItem("Oak Shortbow (u)");
  93.                                 BowType.addItem("Oak Longbow (u)");
  94.                                 BowType.addItem("Willow Shortbow (u)");
  95.                                 BowType.addItem("Willow Longbow (u)");
  96.                                 BowType.addItem("Maple Shortbow (u)");
  97.                                 BowType.addItem("Maple Longbow (u)");
  98.                                 BowType.addItem("Yew Shortbow (u)");
  99.                                 BowType.addItem("Yew Longbow (u)");
  100.                                 BowType.addItem("Magic Shortbow (u)");
  101.                                 BowType.addItem("Magic Longbow (u)");
  102.                                 FletchAmount.setText("0");
  103.                                 KnifeType.setSelectedIndex(0);
  104.                         } else if(Option == "Fletch and String")
  105.                         {
  106.                                 BowTypeLabel.setText("Select bows to fletch");
  107.                                 FletchAmountLabel.setText("Amount of bows (0 = All)");
  108.                                 BowType.removeAllItems();
  109.                                 BowType.addItem("Shortbow");
  110.                                 BowType.addItem("Longbow");
  111.                                 BowType.addItem("Oak Shortbow");
  112.                                 BowType.addItem("Oak Longbow");
  113.                                 BowType.addItem("Willow Shortbow");
  114.                                 BowType.addItem("Willow Longbow");
  115.                                 BowType.addItem("Maple Shortbow");
  116.                                 BowType.addItem("Maple Longbow");
  117.                                 BowType.addItem("Yew Shortbow");
  118.                                 BowType.addItem("Yew Longbow");
  119.                                 BowType.addItem("Magic Shortbow");
  120.                                 BowType.addItem("Magic Longbow");
  121.                                 FletchAmount.setText("0");
  122.                                 KnifeType.setSelectedIndex(0);
  123.                         }
  124.                 }
  125.  
  126.                 private void StartBTNActionPerformed(ActionEvent e) {
  127.                         closeGUI = 1;
  128.                         gui.setVisible(false);
  129.                 }
  130.  
  131.                 private void initComponents() {
  132.                         frame1 = new JFrame();
  133.                         Logotext = new JLabel();
  134.                         logoslogan = new JLabel();
  135.                         Assignmentlabel = new JLabel();
  136.                         FletchSelection = new JComboBox();
  137.                         SubPanel = new JPanel();
  138.                         BowTypeLabel = new JLabel();
  139.                         BowType = new JComboBox();
  140.                         FletchAmountLabel = new JLabel();
  141.                         FletchAmount = new JTextField();
  142.                         KnifeTypelabel = new JLabel();
  143.                         KnifeType = new JComboBox();
  144.                         StartBTN = new JButton();
  145.                         CellConstraints cc = new CellConstraints();
  146.  
  147.                         {
  148.                                 frame1.setTitle("[Fletcher] - Settings");
  149.                                 frame1.setResizable(false);
  150.                                 Container frame1ContentPane = frame1.getContentPane();
  151.                                 frame1ContentPane.setLayout(new GridBagLayout());
  152.                                 ((GridBagLayout)frame1ContentPane.getLayout()).columnWidths = new int[] {0, 0, 0};
  153.                                 ((GridBagLayout)frame1ContentPane.getLayout()).rowHeights = new int[] {0, 0, 0, 0, 0, 0, 0};
  154.                                 ((GridBagLayout)frame1ContentPane.getLayout()).columnWeights = new double[] {0.0, 0.0, 1.0E-4};
  155.                                 ((GridBagLayout)frame1ContentPane.getLayout()).rowWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4};
  156.  
  157.                                 Logotext.setText("Fletcher");
  158.                                 Logotext.setFont(new Font("Tahoma", Font.PLAIN, 28));
  159.                                 Logotext.setForeground(Color.gray);
  160.                                 frame1ContentPane.add(Logotext, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
  161.                                         GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  162.                                         new Insets(0, 0, 5, 0), 0, 0));
  163.  
  164.                                 logoslogan.setText("Created and published by MethodScripts Inc.");
  165.                                 logoslogan.setFont(new Font("Tahoma", Font.PLAIN, 9));
  166.                                 logoslogan.setForeground(Color.lightGray);
  167.                                 frame1ContentPane.add(logoslogan, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0,
  168.                                         GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  169.                                         new Insets(0, 0, 5, 0), 0, 0));
  170.  
  171.                                 Assignmentlabel.setText("Assignment:");
  172.                                 frame1ContentPane.add(Assignmentlabel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0,
  173.                                         GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  174.                                         new Insets(0, 0, 5, 0), 0, 0));
  175.  
  176.                                 FletchSelection.setModel(new DefaultComboBoxModel(new String[] {
  177.                                         "Fletch",
  178.                                         "String",
  179.                                         "Fletch and String"
  180.                                 }));
  181.                                 FletchSelection.addItemListener(new ItemListener() {
  182.                                         @Override
  183.                                         public void itemStateChanged(ItemEvent e) {
  184.                                                 comboBox1ItemStateChanged(e);
  185.                                         }
  186.                                 });
  187.                                 FletchSelection.addActionListener(new ActionListener() {
  188.                                         @Override
  189.                                         public void actionPerformed(ActionEvent e) {
  190.                                                 comboBox1ActionPerformed(e);
  191.                                                 FletchSelectionActionPerformed(e);
  192.                                         }
  193.                                 });
  194.                                 frame1ContentPane.add(FletchSelection, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0,
  195.                                         GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  196.                                         new Insets(0, 0, 5, 0), 0, 0));
  197.  
  198.                                 {
  199.                                         SubPanel.setBorder(new LineBorder(Color.black));
  200.  
  201.                                         SubPanel.setBorder(new javax.swing.border.CompoundBorder(
  202.                                                 new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0),
  203.                                                         "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER,
  204.                                                         javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Dialog", java.awt.Font.BOLD, 12),
  205.                                                         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();}});
  206.  
  207.                                         SubPanel.setLayout(new FormLayout(
  208.                                                 "default, $lcgap, default",
  209.                                                 "7*(default, $lgap), default"));
  210.  
  211.                                         BowTypeLabel.setText("Log and bow type:");
  212.                                         BowTypeLabel.setHorizontalAlignment(SwingConstants.CENTER);
  213.                                         SubPanel.add(BowTypeLabel, cc.xy(3, 1));
  214.  
  215.                                         BowType.setModel(new DefaultComboBoxModel(new String[] {
  216.                                                 "Shortbow",
  217.                                                 "Longbow",
  218.                                                 "Oak Shortbow",
  219.                                                 "Oak Longbow",
  220.                                                 "Willow Shortbow",
  221.                                                 "Willow Longbow",
  222.                                                 "Maple Shortbow",
  223.                                                 "Maple Longbow",
  224.                                                 "Yew Shortbow",
  225.                                                 "Yew Longbow",
  226.                                                 "Magic Shortbow",
  227.                                                 "Magic Longbow"
  228.                                         }));
  229.                                         SubPanel.add(BowType, cc.xy(3, 3));
  230.  
  231.                                         FletchAmountLabel.setText("Amount to fletch (0 = All)");
  232.                                         FletchAmountLabel.setHorizontalAlignment(SwingConstants.CENTER);
  233.                                         FletchAmountLabel.setVerticalAlignment(SwingConstants.BOTTOM);
  234.                                         SubPanel.add(FletchAmountLabel, cc.xy(3, 7));
  235.  
  236.                                         FletchAmount.setText("0");
  237.                                         FletchAmount.setHorizontalAlignment(SwingConstants.CENTER);
  238.                                         SubPanel.add(FletchAmount, cc.xy(3, 9));
  239.  
  240.                                         KnifeTypelabel.setText("Type of knife:");
  241.                                         KnifeTypelabel.setHorizontalAlignment(SwingConstants.CENTER);
  242.                                         SubPanel.add(KnifeTypelabel, cc.xy(3, 13));
  243.  
  244.                                         KnifeType.setModel(new DefaultComboBoxModel(new String[] {
  245.                                                 "Normal",
  246.                                                 "Sacred Clay"
  247.                                         }));
  248.                                         SubPanel.add(KnifeType, cc.xy(3, 15));
  249.                                 }
  250.                                 frame1ContentPane.add(SubPanel, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0,
  251.                                         GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  252.                                         new Insets(0, 0, 5, 0), 0, 0));
  253.  
  254.                                 StartBTN.setText("Start Fletcher");
  255.                                 StartBTN.addActionListener(new ActionListener() {
  256.                                         @Override
  257.                                         public void actionPerformed(ActionEvent e) {
  258.                                                 StartBTNActionPerformed(e);
  259.                                         }
  260.                                 });
  261.                                 frame1ContentPane.add(StartBTN, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0,
  262.                                         GridBagConstraints.CENTER, GridBagConstraints.BOTH,
  263.                                         new Insets(0, 0, 0, 0), 0, 0));
  264.                                 frame1.pack();
  265.                                 frame1.setLocationRelativeTo(frame1.getOwner());
  266.                         }
  267.                 }
  268.  
  269.                 private JFrame frame1;
  270.                 private JLabel Logotext;
  271.                 private JLabel logoslogan;
  272.                 private JLabel Assignmentlabel;
  273.                 private JComboBox FletchSelection;
  274.                 private JPanel SubPanel;
  275.                 private JLabel BowTypeLabel;
  276.                 private JComboBox BowType;
  277.                 private JLabel FletchAmountLabel;
  278.                 private JTextField FletchAmount;
  279.                 private JLabel KnifeTypelabel;
  280.                 private JComboBox KnifeType;
  281.                 private JButton StartBTN;
  282.         }
  283.         // END GUI
  284.  
  285. }