Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Java by J ( 15 years ago )
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import org.rsbot.event.events.MessageEvent;
import org.rsbot.event.listeners.MessageListener;

import org.rsbot.script.Script;
import org.rsbot.script.ScriptManifest;
import org.rsbot.script.wrappers.RSObject;
import org.rsbot.script.wrappers.RSTile;

@ScriptManifest(authors = {"Contagious"}, name = "cFireMaker", version = 1.0, description = "Firemakes in supported locations.")
public class cFireMaker extends Script implements MessageListener {
 
 /**
  * 
  * 
  *  Variables 
  * 
  *
  */
 
 private enum State {
  burn, bank, walkToBank, walkToTile, walkToNewTile
 }
 private static int logsToBurn;
 private static int banks;
 private boolean newSpot = true;
 
 final RSTile VEburnTile = new RSTile(0, 0);
 final RSTile VWburnTile = new RSTile(0, 0);
 final RSTile GEburnTile = new RSTile(3178, 3497);
 final RSTile GEnewBurnTile = new RSTile(3178, 3496);
 final RSTile VEnewBurnTile = new RSTile(0, 0);
 final RSTile VWnewBurnTile = new RSTile(0, 0);
 final RSTile VEbankTile = new RSTile(0, 0);
 final RSTile VWbankTile = new RSTile(0, 0);
 final RSTile GEbankTile = new RSTile(3162, 3490);
 
 final RSTile[] tilesToGEbank = new RSTile[]{new RSTile (3159, 3494), new RSTile (3162, 3490)};
 final RSTile[] tilesToGEburnTile = new RSTile[]{new RSTile (3170, 3493), new RSTile (3165, 3494), new RSTile (3462, 3490)};
 RSTile[] tilesToVEbank;
 RSTile[] tilesToVEburnTile;
 RSTile[] tilesToVWbank;
 RSTile[] tilesToVWburnTile;
 
 RSTile newBurnTile;
 RSTile[] pathToBank;
 RSTile[] pathToBurnTile;
 RSTile burnTile;
    RSTile bankTile;
 
 private static final int  NormalLogs = 1511;
 private static final int  OakLogs = 1521;
 private static final int  WillowLogs = 1519;
 private static final int  MapleLogs = 1517;
 private static final int  YewLogs = 1515;
 private static final int  MagicLogs = 1513;
    
    private boolean guiWait = true;
 gui g = new gui();

 /**
  * 
  * 
  *  Main Loop
  * 
  * 
  */
 
 @Override
 public int loop() {
 if (interfaces.canContinue()) {
  interfaces.clickContinue();
 }
 switch(getState()) {
 case burn:
 if (getMyPlayer().getAnimation() != -1) {
 return random (250,500);
 }
 if (getMyPlayer().isMoving()) {
  sleep (100, 200);
 }
 if (inventory.getSelectedItem() != null || inventory.getSelectedItem().getID() != logsToBurn){
  inventory.getItem(590).doAction("Use Tinderbox");
  inventory.getItem(logsToBurn).doAction("Use");
  sleep(random(100,200));
   }
     
 break;
 
 case bank:
 if (!inventory.containsOneOf(logsToBurn) && calc.distanceTo(bankTile) > 2) {
 RSObject bankBooth = objects.getNearest(banks);
 if (!bank.isOpen()) {
      bankBooth.doAction("uickly");
      sleep(250, 500);
 } else if(bank.isOpen()) {
 bank.withdraw(logsToBurn, 0); 
 } else if (bank.isOpen() && inventory.containsOneOf(logsToBurn)) {
  mouse.move(490, 36, 3, 3);
        sleep(150, 300);
     mouse.click(true);
  }
 }
 break;
 
 case walkToBank:
 if (!getMyPlayer().isMoving()) {
 walking.walkPathMM(pathToBank);
 }
 break;
 
 case walkToTile:
 if (!getMyPlayer().isMoving()) {
 walking.walkPathMM(pathToBurnTile);
 }
 break;
 
 case walkToNewTile:
 if (!getMyPlayer().isMoving()) {
 walking.walkTileMM(newBurnTile);
 }
}
 return (random(1000,2000));
}
 
 public boolean onStart() {
 g.setVisible(true);
 while(guiWait) sleep(500);  
  return true;
 }
 
 public void onFinish() {
  
 }
 
 /**
  * 
  *
  * Methods 
  * 
  * 
  */
 
 private boolean checkForFire() {
 if (newSpot == true) {
  return true;
 } else {
  return false;
 }
}
 
 private State getState() {
 if (!inventory.containsOneOf(logsToBurn) && calc.distanceBetween(burnTile, bankTile) < 2) {
 return State.walkToBank;
 } else {
 if (!inventory.containsOneOf(logsToBurn) && calc.distanceTo(bankTile) > 2) {
 return State.bank;
  } else {
 if (inventory.containsOneOf(logsToBurn)) {
 return State.burn; 
 } else {
 if (inventory.isFull() && calc.distanceTo(burnTile) > 2) {
 return State.walkToTile;
 } else {
 if (checkForFire() == true) {
 return State.walkToNewTile;
 } else {
 return State.burn; 
 }
    }
   }
  }
 }
}

 @Override
 public void messageReceived(MessageEvent e) {
 String txt = e.getMessage();
 if(txt.contains("you can't light a fire here")) {
 newSpot = true;
 }
 }
 
 /**
  * 
  * 
  * GUI
  *
  */

 class gui extends JFrame {
  private static final long serialVersionUID = 1L;
  public gui() {
   initComponents();
  }

  private void startButtonActionPerformed(ActionEvent e) {
  String loc = locationsBox.getSelectedItem().toString();
  String logs = locationsBox.getSelectedItem().toString();
  if(logs.equals("Normal")) {
   logsToBurn = NormalLogs;
  }
  if(logs.equals("Oak")) {
   logsToBurn = OakLogs;
  }
  if(logs.equals("Willow")) {
   logsToBurn = WillowLogs;
  }
  if(logs.equals("Maple")) {
   logsToBurn = MapleLogs;
  }
  if(logs.equals("Yew")) {
   logsToBurn = YewLogs;
  }
  if(logs.equals("Magic")) {
   logsToBurn = MagicLogs;
  }
  if (loc.equals("East Varrock")) {
  burnTile = VEburnTile;
  bankTile = VEbankTile;
  newBurnTile = VEnewBurnTile;
  pathToBank = tilesToVEbank;
  pathToBurnTile = tilesToVEburnTile;
  } else if (loc.equals("West Varrock")) {
  burnTile = VWburnTile;
  bankTile = VWbankTile;
  newBurnTile = VWnewBurnTile;
  pathToBank = tilesToVWbank;
  pathToBurnTile = tilesToVWburnTile;
  } else if (loc.equals("Grand Exchange")) {
  burnTile = GEburnTile;
  bankTile = GEbankTile;
  newBurnTile = GEnewBurnTile;
  pathToBank = tilesToGEbank;
  pathToBurnTile = tilesToGEburnTile;
  }
  guiWait = false;
  g.dispose();

 }

  private void initComponents() {
   // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
   // Generated using JFormDesigner Evaluation license - Jake T
   label1 = new JLabel();
   label2 = new JLabel();
   separator1 = new JSeparator();
   locationsBox = new JComboBox();
   label3 = new JLabel();
   logsBox = new JComboBox();
   startButton = new JButton();

   //======== this ========
   setResizable(false);
   setTitle("cFireMaker");
   Container contentPane = getContentPane();

   //---- label1 ----
   label1.setText("cFireMaker 1.0 by Contagious");
   label1.setFont(new Font("Monotype Corsiva", Font.BOLD, 16));

   //---- label2 ----
   label2.setText("Locations:");
   label2.setFont(new Font("Comic Sans MS", Font.PLAIN, 14));

   //---- locationsBox ----
   locationsBox.setModel(new DefaultComboBoxModel(new String[] {
    "East Varrock",
    "West Varrock",
    "Grand Exchange"
   }));

   //---- label3 ----
   label3.setText("Logs To Burn:");
   label3.setFont(new Font("Comic Sans MS", Font.PLAIN, 14));

   //---- logsBox ----
   logsBox.setModel(new DefaultComboBoxModel(new String[] {
    "Normal",
    "Oak",
    "Willow",
    "Maple",
    "Yew",
    "Magic"
   }));

   //---- startButton ----
   startButton.setText("Start");
   startButton.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
     startButtonActionPerformed(e);
    }
   });

   GroupLayout contentPaneLayout = new GroupLayout(contentPane);
   contentPane.setLayout(contentPaneLayout);
   contentPaneLayout.setHorizontalGroup(
    contentPaneLayout.createParallelGroup()
     .addGroup(GroupLayout.Alignment.TRAILING, contentPaneLayout.createSequentialGroup()
      .addGroup(contentPaneLayout.createParallelGroup()
       .addGroup(GroupLayout.Alignment.TRAILING, contentPaneLayout.createSequentialGroup()
        .addContainerGap()
        .addComponent(separator1, GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE))
       .addGroup(contentPaneLayout.createSequentialGroup()
        .addGap(33, 33, 33)
        .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
         .addComponent(locationsBox, 0, 131, Short.MAX_VALUE)
         .addComponent(label2)
         .addComponent(label3)
         .addComponent(logsBox, GroupLayout.PREFERRED_SIZE, 176, GroupLayout.PREFERRED_SIZE))
        .addGap(57, 57, 57)))
      .addGap(81, 81, 81))
     .addGroup(contentPaneLayout.createSequentialGroup()
      .addGap(30, 30, 30)
      .addComponent(label1)
      .addContainerGap(118, Short.MAX_VALUE))
     .addGroup(GroupLayout.Alignment.TRAILING, contentPaneLayout.createSequentialGroup()
      .addContainerGap(132, Short.MAX_VALUE)
      .addComponent(startButton, GroupLayout.PREFERRED_SIZE, 124, GroupLayout.PREFERRED_SIZE)
      .addGap(91, 91, 91))
   );
   contentPaneLayout.setVerticalGroup(
    contentPaneLayout.createParallelGroup()
     .addGroup(contentPaneLayout.createSequentialGroup()
      .addContainerGap()
      .addComponent(label1)
      .addGap(1, 1, 1)
      .addComponent(separator1, GroupLayout.PREFERRED_SIZE, 5, GroupLayout.PREFERRED_SIZE)
      .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
      .addComponent(label2)
      .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
      .addComponent(locationsBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
      .addGap(18, 18, 18)
      .addComponent(label3)
      .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
      .addComponent(logsBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
      .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 25, Short.MAX_VALUE)
      .addComponent(startButton)
      .addContainerGap())
   );
   pack();
   setLocationRelativeTo(getOwner());
   // JFormDesigner - End of component initialization  //GEN-END:initComponents
  }

  // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables
  // Generated using JFormDesigner Evaluation license - Jake T
  private JLabel label1;
  private JLabel label2;
  private JSeparator separator1;
  private JComboBox locationsBox;
  private JLabel label3;
  private JComboBox logsBox;
  private JButton startButton;
  // JFormDesigner - End of variables declaration  //GEN-END:variables
 }

}

 

Revise this Paste

Your Name: Code Language: