PDA

Ver la versión completa : [Ayuda] Sobre Java, Importante.



Venero
27/09/2009, 16:56
Bueno, esto no va aquí, no es sobre la Wiz, pero, es la sección mas "parecida" que he encontrado, y como se que todos teneis ganas de ayudar pues aquí os lo pongo.

Tengo Windows vista y un problema respecto al Java.
A mi me da un condigo semejante (Por ejemplo)
import com.speljohan.rsbot.event.listeners.*;
import com.speljohan.rsbot.event.events.*;
import com.speljohan.rsbot.event.listeners.PaintListener;

public class tPotatoPicker extends Script implements PaintListener, ServerMessageListener {

// Variables \\
int energy = random (25, 55);
int animation = 827;
int potato = 312;
int booth = 2213;
long picked = 0;
long Time = System.currentTimeMillis();

// Path \\
final RSTile[] toField = {
new RSTile(3093,3244),new RSTile(3105,3251),new RSTile(3114,3262),new RSTile(3128,3263),
new RSTile(3135,3272),new RSTile(3136,3286),new RSTile(3145,3292),new RSTile(3145, 3289)};

final RSTile[] Back = reversePath(toField);

// Paint \\
public void onRepaint(Graphics g) {
long millis = System.currentTimeMillis() - Time;
long hours = millis / (1000 * 60 * 60);
millis -= hours * (1000 * 60 * 60);
long minutes = millis / (1000 * 60);
millis -= minutes * (1000 * 60);
long seconds = millis / 1000;
long minutes2 = minutes + (hours * 60);
g.setFont(new Font("Comic Sans", Font.BOLD, 12));
g.setColor(Color.white);
g.drawString("tPotatoPicker V 0.1", 9, 300);
g.drawString("Time Running: " + hours + ":" + minutes + ":" + seconds, 9, 315);
g.drawString("Potatos Picked: " + picked, 9, 330);
}

// StartUp \\
public boolean onStart(Map<String, String> args) {
log("Welcome, you are using tPotatoPicker");
picked = 0;
return true;
}

public void onFinish(){
log ("Thanks for using tPotatoPicker");
Bot.getEventManager().removeListener(PaintListener .class, this);
return;
}

public boolean ifbank() {
return isInventoryFull();
}

public boolean atpotato() {
RSObject pot = getNearestObjectByID(potato);
if (pot == null) return false;

return tileOnScreen(pot.getLocation());
}

public boolean atbank() {
RSObject bank = getNearestObjectByID(booth);
if (bank == null) return false;

return tileOnScreen(bank.getLocation());
}

public boolean handle() {
if(bank == null)
return false;

RSObject bankbooth = getNearestObjectByID(booth);

if(bank.isOpen()){
bank.depositAll();
}else{
atObject(bankbooth, "Quickly");
}

return true;
}

public boolean toBank(){
RSTile[] randomizedPath = randomizePath(Back, 2, 2);
RSTilePath path = new RSTilePath(randomizedPath, this);
try {
return path.walkToEnd();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return false;
}

public boolean pick() {
RSObject pickpot = getNearestObjectByID(potato);
if (pickpot == null) return false;

return atObject(pickpot, "Pick");
}

public boolean toField() {
RSTile[] randomizedPath = randomizePath(toField, 2, 2);
RSTilePath path = new RSTilePath(randomizedPath, this);
try {
return path.walkToEnd();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return false;
}

public void serverMessageRecieved(ServerMessageEvent e) {
String message = e.getMessage();
if(message.contains("You pick a potato")){
picked++;

}
}

// Main Loop \\
public int loop () {
if (!isRunning()) {
if (getEnergy() >= energy) {
setRun(true);
}
}

if(getMyPlayer().isMoving()){
return 800;
}
if(getMyPlayer().getAnimation() == animation){
return 800;
}

if(ifbank()){

if(atbank()){
if(handle())
return random(800, 1000);
}else{
if(toBank())
return random(800, 1000);
}

}else{

if(atpotato()){
if(pick())
return random(800, 1000);
}else{
if(toField())
return random(800, 1000);
}
}

return random (500, 1000);
}


// Information \\
public String getName(){
return "tPotatoPicker";
}

public String getAuthor(){
return "TreyBot";
}

public String getScriptDescription() {
return "<html>\n" + "<head></head>\n"
+ "<body bgcolor=\"black\" text=\"red\">\n" + "<center>"
+ "<h2>" + getName() + "</h2>" + "</center>\n"
+ "<b>Author:</b> " + getAuthor() + "<br />"
+ "<b>Version:</b> " + getVersion()
+ "<BR>Start infront of potato field OPEN gate NorthEast of Draynor Bank." + "</body>\n"
+ "</html>";
}

public String getScriptCategory(){
return "Money";
}

public double getVersion(){
return 0.1;
}

}
Y que lo guarde como Save as tPotatoPicker.java

Yo voy a mi bloc de notas copio todo, lo guardo como tPotatoPicker.java , Tengo instalado Java, tengo instalado un pack bastante completo , pero no hay manera de abrirlo le doy dos click y no hace nada...

Esto es importante, necesito solucionarlo lo antes posible , a ver si alguien sabe como puedo ejecutar esto..

Muchisimas Gracias

Un Saludo

Jurk
27/09/2009, 17:05
tienes que generar el bytecode, no basta con crear un codigo

DMusta1ne
27/09/2009, 17:07
La verdad es que no es el sitio más adecuado donde postearlo, fuera aparte de que tendrás que pasar el código .java a bytecode .class para poder correrlo con la JVM.

Google es tu hamijo.

hardyx
27/09/2009, 17:19
Tienes que compilarlo con: javac tPotatoPicker.java, esto te genera un fichero binario .class, que es el puedes ejecutar con: java fichero.class. Para ello necesiteas tener instalado y configurado el JDK de Java.

Por cierto, parece que ese código está usando varias clases adicionales que no son de Java. Si no las tienes no podrás compilarlo. La próxima vez pon estas preguntas en el subforo de PC.

Venero
27/09/2009, 17:33
Vale, ya he encontrado como hacerlo, aviso a un Moderador para que cierre el tema.

Gracias