Q&A: class, interface, or enum expected?

sell scripts
by zz77

Question by idk: class, interface, or enum expected?
I was compiling a script and it gave me this.
Looking for JDK
Compiling Scripts
Scripts/swamptar.java:1: class, interface, or enum expected
mport java.awt.color;
^
1error
Press any key to exit

the script is

mport java.awt.Color;
import java.awt.Color;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.util.Map;
import javax.swing.JOptionPane;
import org.rsbot.accessors.RSCharacter;
import org.rsbot.bot.Bot;
import org.rsbot.event.events.ServerMessageEvent;
import org.rsbot.event.listeners.PaintListener;
import org.rsbot.script.Script;
import org.rsbot.script.ScriptManifest;
import org.rsbot.script.wrappers.RSInterface;
import org.rsbot.script.wrappers.RSInterfaceChild;
import org.rsbot.script.wrappers.RSItem;
import org.rsbot.script.wrappers.RSItemTile;
import org.rsbot.script.wrappers.RSObject;
import org.rsbot.script.wrappers.RSTile;

@ScriptManifest(authors = { “Creative” }, category = “Money”, name = “Swamp Tar Collector”, version = 1.02, description = “

<" + "

” + “Swamp Tar Pro” + ” V 1.02


+ “Author: ” + “Creative”
+ “

Start at the Swamp next to Lumbridge.”
+ “
Don’t sell for Min, or I will Catch You!”)

public class SwampTar extends Script implements PaintListener {

RSItemTile tile2;
public int Tar = 1939;
public int SwampCollected = 0;
public String status = “”;
int swamptar = grandExchange.loadItemInfo(1939).getMarketPrice();
public long startTime = System.currentTimeMillis();
private int RunningEnergy = random(15, 30);
String day, hour, minute, second;

public RSTile[] TreeToAltar = { new RSTile(3173,3175), new RSTile(3175,3168), new RSTile(3185,3167), new RSTile(3188,3162)};

public boolean onStart(Mapargs) {
setCameraAltitude(true);
return true;
}

public boolean atTar() {
RSItemTile thing = getNearestGroundItemByID(1939);
if (thing == null)
return false;
return pointOnScreen(thing.getScreenLocation());
}

public String[] getFormattedTime(final long timeMillis) {
long millis = timeMillis;
final long days = millis / (24 * 1000 * 60 * 60);
millis -= days * (24 * 1000 * 60 * 60);
final long hours = millis / (1000 * 60 * 60);
millis -= hours * 1000 * 60 * 60;
final long minutes = millis / (1000 * 60);
millis -= minutes * 1000 * 60;
final long seconds = millis / 1000;
String dayString = String.valueOf(days);
String hoursString = String.valueOf(hours);
String minutesString = String.valueOf(minutes);
String secondsString = String.valueOf(seconds);
if (hours < 10) hoursString = 0 + hoursString; if (minutes < 10) minutesString = 0 + minutesString; if (seconds < 10) secondsString = 0 + secondsString; return new String[] { dayString, hoursString, minutesString, secondsString }; } @Override public void onRepaint(Graphics g) { long millis = System.currentTimeMillis() - startTime; day = getFormattedTime(millis)[0]; hour = getFormattedTime(millis)[1]; minute = getFormattedTime(millis)[2]; second = getFormattedTime(millis)[3]; long hours = millis / (1000 * 60 * 60); millis -= hours * (1000 * 60 * 60); long minutes = millis / (1000 * 60); millis -= minutes * (1000 * 60); long seconds = millis / 1000; if(isLoggedIn()){ g.setColor(new Color(0, 0, 0, 175)); g.fillRoundRect(312, 4, 203,100, 0, 0); g.setColor(Color.cyan); g.draw3DRect(312, 4, 203, 100, true); g.setFont(new Font("Trebuchet MS", Font.PLAIN, 14)); g.drawString("Creative's Tar Collector", 317, 23); g.setColor(Color.red); g.drawString("Tar Collected: " + SwampCollected, 317, 41); g.setColor(Color.green); g.drawString("Profit: " + SwampCollected * swamptar + " GP" , 317, 59); g.setColor(Color.cyan); g.drawString("Status: " + status, 317, 77); g.setColor(Color.white); g.drawString("Time running: " + hours + ":" + minutes + ":" + seconds, 317, 95); } } public void antiBan(){ int randomNum = random(1, 30); int r = random(1,35); if (randomNum == 6){ if (r == 1){ setCameraRotation(random(100, 360)); wait(random(200, 400)); } if (r == 2){ setCameraRotation(random(100, 360)); wait(random(200, 400)); } if (r == 3){ setCameraRotation(random(100, 360)); wait(random(200, 400)); } if (r == 4){ setCameraRotation(random(100, 360)); wait(random(200, 400)); } if (r == 2){ setCameraRotation(random(100, 360)); wait(random(200, 400)); } if (r == 3){ setCameraRotation(random(100, 360)); wait(random(200, 400)); } if (r == 4){ setCameraRotation(random(100, 360)); wait(random(200, 400)); } } } public RSTile getItemLoc(final int... itemID) { RSItemTile tile2 = getNearestGroundItemByID(1939); if(tile2 != null) { return tile2; } return null; } public void picktar() { tile2 = getNearestGroundItemByID(1939); if (tile2 != null && (isIdle())) { atTile(tile2, "Take"); wait(1000); } } protected int getMouseSpeed() { return 9; } public int loop () { antiBan(); if (getEnergy() >= RunningEnergy && !isRunning()) {
setRun(true);
RunningEnergy = random(15, 30);
status = “Resting”;
wait(random(2000, 3500));
rest(85);
moveMouse((int) random(231, 257), (int) random(155, 171));
clickMouse(true);
return(random(2000, 3500));
}

SwampCollected = getInventoryCount(Tar);

if(getNearestGroundItemByID(Tar) != null){
status = “Picking Tar…”;
picktar();
}

if(!atTar()){
status = “Walking To Tar…”;
walkTileMM(getItemLoc(1939));
wait(1000);
}
return random(300,400);
}

public void onFinish(){
log(“Thanks for using my script – Creative.”);
log(“Ran for ” + day + “:” + hour + “:” + minute + “:” + second+ “” );
log(“Profit: ” + SwampCollected * swamptar + ” GP”);
}
}

Best answer:

Answer by Money_Dude
So, you left the “i” off of import. The compiler doesn’t realize that you meant to write import so it’s expecting you to put in either class, interface, or enum to start the code.

What do you think? Answer below!

Get the book now