Orcworm.co.uk

Full Version: Java coding
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So recently I decided that to get a little more into Java, I would code a hack client(Not for Orcworm of course Tongue) for some friends. I have about half a dozen hacks set up and I want to create a console so I can add a friendslist, etc. But I can't seem to figure out how. I watched a few minutes of a tutorial on the subject and this is what I have so far:

[spoiler]
package net.minecraft.src;

import org.lwjgl.input.Keyboard;

public class GuiConsole extends GuiScreen{

protected String message;
private int updateCounter;
private static final String allowedCharacters;
public GuiConsole(){
message = "";
updateCounter = 0;

}

public void initGui(){
Keyboard.enableRepeatEvents(true);

}

public void onGuiClosed(){
Keyboard.enableRepeatEvents(false);
}

public void updateScreen(){
updateCounter++;
}

public void processCommand(String s){

}

protected void keyTyped(char c, int i){
if(i == 1){
mc.displayGuiScreen(null);
return;
}
if(i == 28){
String s = message.trim();
if(s.length() > 0){
processCommand(s);
}
mc.displayGuiScreen(null);
return;
}
if(i == 14 && message.length() > 0){
message = message.substring(0, message.length() - 1);
}
if(allowedCharacters.indexOf© > 0 && message.length() < 100){
message += c;
}
}
public void drawScreen(int i, int j, float f){
drawRect(2, height - 14, width - 2, height - 2, 0x80000000);
drawString(fontRenderer, "Console: " +message+ ((updateCounter / 6) % 2 != 0 ? "" : "_"), 4, height - 12, 0xffffff);
super.drawScreen(i, j, f);
}

public void mouseClicked(int i, int j, int k){
super.mouseClicked(i, j, k);
if(k != 0){
return;
}
if(mc.ingameGUI.field_933_a == null){
return;
}
if(message.length() > 0 && !message.endsWith("")){
message += " ";
}
message += mc.ingameGUI.field_933_a;
byte byte0 = 100;
if(message.length() > byte0){
message = message.substring(0, byte0);
}
}

}
}
[/spoiler]

field_933_a comes up as an error.

Can anyone help?
Adding the stack trace the program gives you to this post would be of more help than "field_933_a comes up as an error". Don't you think it would be helpful to provide what the error is? There's tons of possibilities of what it could be.

For starters
Check if field_933_a exists in whatever class ingameGUI references
Check if field_933_a is visible outside of the class ingameGUI is referencing
(05-03-2012, 04:54 PM)zieve Wrote: [ -> ]Adding the stack trace the program gives you to this post would be of more help than "field_933_a comes up as an error". Don't you think it would be helpful to provide what the error is? There's tons of possibilities of what it could be.

For starters
Check if field_933_a exists in whatever class ingameGUI references
Check if field_933_a is visible outside of the class ingameGUI is referencing

I have almost no idea what you just said.

But the code is apparently not done, so I will finish it and see what happens.
Would also help if you posted the code for the GuiScreen class file.
http://www.mpgh.net/forum/422-minecraft-...orial.html

Learn what's actually going on in it rather than c+p and you'll know why it doesn't work.
I was a bit rushed, so bear with me
[spoiler]
int main ()
{
start:

ur a faget

goto start;

return 0;
}

[/spoiler]
(05-04-2012, 01:46 AM)sieve Wrote: [ -> ]I was a bit rushed, so bear with me
[spoiler]
int main ()
{
start:

ur a faget

goto start;

return 0;
}

[/spoiler]

[Image: Poc98.jpg]
(05-04-2012, 01:46 AM)sieve Wrote: [ -> ]I was a bit rushed, so bear with me
[spoiler]
int main ()
{
start:

ur a faget

goto start;

return 0;
}

[/spoiler]

Code:
for(int i = 0; i < 0; ++i) {
System.out.println("Spam.");
}
(05-04-2012, 01:46 AM)sieve Wrote: [ -> ]I was a bit rushed, so bear with me
[spoiler]
int main ()
{
start:

ur a faget

goto start;

return 0;
}

[/spoiler]
wait, are you trying to cheat me again?
(05-04-2012, 11:45 AM)MrKrellyn Wrote: [ -> ]
Code:
for(int i = 0; i < 0; ++i) {
System.out.println("Spam.");
}

Not sure if intentional or if i'm being retarded but surely that should be i > 0?
Dat skid protection?
(05-08-2012, 12:25 PM)Chazdude42 Wrote: [ -> ]
(05-04-2012, 11:45 AM)MrKrellyn Wrote: [ -> ]
Code:
for(int i = 0; i < 0; ++i) {
System.out.println("Spam.");
}

Not sure if intentional or if i'm being retarded but surely that should be i > 0?

It's intentional. If it was actually meant to be an infinite loop, it'd be i > 0, but it's meant to trip ya up. Suppose you're the one to notice <3