I'm trying to use a specific code but it won't work for some reason. I have to methods in the same class:
public void InputEnter()
{
if(Input.GetKey(getCoords)) {
Move(GetTransform().GetPos());
System.out.println((GetTransform().GetPos()));
}
}
this method gives me some coordinates of Vector3f once I hit enter. The other code writes to a file.
public void ProcessText()
{
System.out.println("ProcessText Operational");
String file_name = "C:/Users/Server/Desktop/textText.txt";
try
{
ProcessCoords file = new ProcessCoords(file_name);
String[] aryLines = file.OpenFile();
int i;
for (i = 0; i < aryLines.length; i++)
{
System.out.println(aryLines[i]);
if(aryLines[i].startsWith("makeGrass:")) {
String Arguments = aryLines[i].substring(aryLines[i].indexOf(":")+1, aryLines[i].length());
String[] ArgArray = Arguments.split(",");
this.makeGrass(Double.parseDouble(ArgArray[0]),
Double.parseDouble(ArgArray[1]),
Double.parseDouble(ArgArray[2]));
}
}
ProcessCoords data = new ProcessCoords(file_name);
data.writeToFile("makeGrass:");
System.out.println("Coordinates Saved!");
} catch(IOException e) {
System.out.println(e.getMessage());
}
}
What I wanted to do is to use the InputEnter method in the ProcessText method so I just deleted InputEnter and used the Input code in the ProcessText method:
public void ProcessText()
{
System.out.println("ProcessText Operational");
String file_name = "C:/Users/Server/Desktop/textText.txt";
try
{
ProcessCoords file = new ProcessCoords(file_name);
String[] aryLines = file.OpenFile();
int i;
for (i = 0; i < aryLines.length; i++)
{
System.out.println(aryLines[i]);
if(aryLines[i].startsWith("makeGrass:")) {
String Arguments = aryLines[i].substring(aryLines[i].indexOf(":")+1, aryLines[i].length());
String[] ArgArray = Arguments.split(",");
this.makeGrass(Double.parseDouble(ArgArray[0]),
Double.parseDouble(ArgArray[1]),
Double.parseDouble(ArgArray[2]));
}
}
if(Input.GetKey(getCoords)) {
Move(GetTransform().GetPos());
ProcessCoords data = new ProcessCoords(file_name);
data.writeToFile("makeGrass:");
System.out.println("pressing enter doesn't work!!");
System.out.println((GetTransform().GetPos()));
}
System.out.println("Input.GetKey doesn't work anymore, but why and how to fix it??");
} catch(IOException e) {
System.out.println(e.getMessage());
}
}
however now, pressing enter does no longer give me the coordinates as it did before, I really do not understand why and I would need some help.
Thanks a lot!