Arachno331
11-13-2007, 11:32 AM
The Site (http://phantasiax.kicks-***.net)
If you goto Game - The CGI loads up ok. But when you click on the client. It wont initiate the client. >.<
I dont understand why.
Im using Fedora Core - Along with Apache. I have my CGI files in cgi-bin.
It also has some error - But I cant view it because I dont have a Errortemplate apparently.
Someone please help.
Arachno331
11-13-2007, 11:47 AM
Hmm - Due to the filter it wont link you to the site.
phantasiax.kicks-877.net
8 = a
7 = s
7= s
FishMonger
11-13-2007, 04:20 PM
You need to post the code that you're having a problem with and ask a specific question.
FishMonger
11-13-2007, 04:26 PM
Hmm, based on the other question you posted, this program that your game is written in C. This topic area is for Perl, so we won't be able to help.
Arachno331
11-13-2007, 05:10 PM
The applet uses MD5 Modules from Perl. And is run in a Java Applet.
So I guessed this was the best place. =\
The thing is - I dont actually know what is wrong with the code.... I have done everything I think I should have done.
I just dont understand why the applet wont load on the website.
FishMonger
11-13-2007, 05:21 PM
Since you haven't shown us any code, it's impossible for anyone to help point out possible problems with the code.
Arachno331
11-13-2007, 05:55 PM
Ok I got the applet to load up on another PC. But the problem now persists but is different - And this is the error I get now. Please help. :)
There was an error connecting to the socket:
ReadString Error: JavaLang.NullPointerException
FishMonger
11-13-2007, 06:22 PM
That's a Java error, not Perl.
You'll need to post your question in a Java forum and provide the relevant code.
Arachno331
11-13-2007, 06:22 PM
Ok I managed to fix that error. Now the applet loads up and everything.
Lol. But it doesnt actually....Carry through. If you know what I mean? I'll give you the Client code.
import java.awt.*;
import java.net.*;
import java.io.*;
import java.applet.*;
import java.awt.event.*;
import java.lang.Thread;
import java.awt.event.KeyEvent;
public class pClient extends Applet implements KeyListener, constants {
/* Main Thread */
Thread mainThread = null;
/* Window components */
Frame f = new Frame("Phantasia v4");
statusPne status = new statusPne(this);
buttonPne buttons = new buttonPne(this);
msgPne messages = new msgPne(this);
userPne users = new userPne(this);
chatPne chat = new chatPne(this);
compassPne compass = new compassPne(this);
Panel rightPane = new Panel();
Image theImages[] = new Image[27];
errorDlog errorDialog = new errorDlog(this);
Socket socket = null;
lThread listen = null;
DataOutputStream output = null;
BufferedReader input = null;
int ioStatus = NO_REQUEST;
public void init()
{
mainThread = Thread.currentThread();
f.addKeyListener(this);
f.setSize(600, 400);
f.setLayout(new GridBagLayout());
/* handle the closing of the window */
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent evt) {
pClientQuit();
}
});
GridBagConstraints constraints = new GridBagConstraints();
addComponent(status, 0, 0, 2, 1, 0, 0);
addComponent(messages, 0, 1, 1, 1, 1, 1);
addComponent(buttons, 0, 2, 1, 1, 0, 0);
addComponent(chat, 0, 3, 1, 1, 1, 2);
addComponent(rightPane, 1, 1, 1, 3, 0, 0);
rightPane.setLayout(new BorderLayout(0, 1));
rightPane.add("South", compass);
rightPane.add("Center", users);
f.setBackground(backgroundColor);
/*
f.pack();
*/
/* show the frame */
f.setVisible(true);
status.loadImages();
buttons.setImages();
/* set up the socket */
try {
socket = new Socket(this.getCodeBase().getHost(), 36335);
output = new DataOutputStream(socket.getOutputStream());
input = new BufferedReader(new InputStreamReader(socket.getInputStream()));
}
catch (Exception e) {
System.out.println("Error: " + e);
errorDialog.bringUp("The system can not connect to the server.",
"The server could be down or a firewall could exist between you and it.",
"Please try again later.");
stop();
}
/* start the listen thread */
listen = new lThread(this);
listen.start();
}
private void addComponent(Panel item, int x, int y, int width, int height, int weightx, int weighty) {
GridBagConstraints constraints = new GridBagConstraints();
/* add the status area to the frame */
constraints.gridx = x;
constraints.gridy = y;
constraints.gridwidth = width;
constraints.gridheight = height;
constraints.weightx = weightx;
constraints.weighty = weighty;
constraints.fill = GridBagConstraints.BOTH;
constraints.anchor = GridBagConstraints.CENTER;
constraints.insets.top = 2;
constraints.insets.bottom = 2;
constraints.insets.left = 2;
constraints.insets.right = 2;
((GridBagLayout)f.getLayout()).setConstraints(item, constraints);
f.add(item);
}
public void pClientQuit() {
System.out.println("pClientQuit called.");
/* destroy the listen thread */
if (listen != null) {
listen.stop();
listen = null;
}
System.out.println("Listen Thread Stopped.");
/* close the socket */
if (socket != null) {
try {
socket.close();
}
catch (IOException e) {
System.out.println("Error: " + e);
}
socket = null;
}
System.out.println("Socket Closed.");
/* remove the main windw */
f.setVisible(false);
System.out.println("Main window hidden.");
f.dispose();
System.out.println("Main window disposed.");
}
public String readString() {
String message = "";
try {
message = input.readLine();
}
catch (Exception e) {
System.out.println("Error: " + e);
errorDialog.bringUp("There was an error reading from the socket.",
"readString error: " + e, "The game will now terminate.");
}
/*
System.out.println("Returning from socket: " + message);
*/
return(message);
}
public long readLong() {
return(Long.parseLong(readString()));
}
public int readBool() {
String message = "";
try {
message = input.readLine();
}
catch (Exception e) {
System.out.println("Error: " + e);
errorDialog.bringUp("There was an error reading from the socket.",
"readString error: " + e, "The game will now terminate.");
}
if (message.equals("No")) {
return 0;
}
else if (message.equals("Yes")) {
return 1;
}
else {
System.out.println("Error: readBool read the string " + message);
errorDialog.bringUp("There was an error reading from the socket.",
"readBool read the string " + message,
"The game will now terminate.");
}
return 0;
}
synchronized public void sendString(String theString) {
try {
output.writeBytes(theString);
}
catch (Exception e) {
System.out.println("Error: " + e);
errorDialog.bringUp("There was an error writing to the socket.",
"sendString error: " + e, "The game will now terminate.");
}
}
synchronized public boolean pollSendFlag(int ioArea) {
/*
System.out.println("Request Send flag - Poll=" + Integer.toString(ioArea) + " Status=" + Integer.toString(ioStatus));
*/
if (ioStatus == ioArea) {
ioStatus = NO_REQUEST;
return true;
}
return false;
}
public void raiseSendFlag(int ioArea) {
if (ioStatus != NO_REQUEST) {
errorDialog.bringUp("Client attempted to have two i/o sources.",
"The game will now terminate.", "");
}
ioStatus = ioArea;
}
public void handlePing() {
int ioArea = ioStatus;
if (ioStatus != NO_REQUEST && pollSendFlag(ioArea)) {
sendString(C_PING_PACKET);
switch(ioArea) {
case BUTTONS:
buttons.timeout();
break;
case STRING_DLOG:
listen.stringDialog.timeout();
break;
case COORD_DLOG:
listen.coordinateDialog.timeout();
break;
case PLAYER_DLOG:
listen.playerDialog.timeout();
break;
}
}
}
public void keyPressed(KeyEvent evt) {
int theKey;
theKey = evt.getKeyCode();
switch(theKey) {
case KeyEvent.VK_1:
case KeyEvent.VK_F1:
buttons.DoButton(0);
break;
case KeyEvent.VK_2:
case KeyEvent.VK_F2:
buttons.DoButton(1);
break;
case KeyEvent.VK_3:
case KeyEvent.VK_F3:
buttons.DoButton(2);
break;
case KeyEvent.VK_4:
case KeyEvent.VK_F4:
buttons.DoButton(3);
break;
case KeyEvent.VK_5:
case KeyEvent.VK_F5:
buttons.DoButton(4);
break;
case KeyEvent.VK_6:
case KeyEvent.VK_F6:
buttons.DoButton(5);
break;
case KeyEvent.VK_7:
case KeyEvent.VK_F7:
buttons.DoButton(6);
break;
case KeyEvent.VK_8:
case KeyEvent.VK_F8:
buttons.DoButton(7);
break;
case KeyEvent.VK_NUMPAD1:
compass.DoButton(6);
break;
case KeyEvent.VK_NUMPAD2:
compass.DoButton(7);
break;
case KeyEvent.VK_NUMPAD3:
compass.DoButton(8);
break;
case KeyEvent.VK_NUMPAD4:
compass.DoButton(3);
break;
case KeyEvent.VK_NUMPAD5:
compass.DoButton(4);
break;
case KeyEvent.VK_NUMPAD6:
compass.DoButton(5);
break;
case KeyEvent.VK_NUMPAD7:
compass.DoButton(0);
break;
case KeyEvent.VK_NUMPAD8:
compass.DoButton(1);
break;
case KeyEvent.VK_NUMPAD9:
compass.DoButton(2);
break;
case KeyEvent.VK_SPACE:
buttons.spacebar();
break;
}
return;
}
public void keyReleased(KeyEvent evt) {;}
public void keyTyped(KeyEvent evt) {;}
}
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.