Starting movement with scanner import

Hey,

I try to make the start condition on a Scanner input.

[java]
scan = new Scanner(System.in);
String input = scan.nextLine();
inputManager.addMapping(“play_stop”, input);

if (name.equals(“play_stop”) && keyPressed) {
if (playing) {
playing = false;
motionControl.pause();
} else {
playing = true;
motionControl.play();
}
}
[/java]

But it still starts by pressing the “space” Key like it was bevor.

[java] inputManager.addMapping(“play_stop”, new KeyTrigger(KeyInput.KEY_J));[/java]

I just started working with Jmonkey and so I have no idea if it is possible what I try to do.

Please help me! :slight_smile:

Hi.

This cannot work. System.in is related to the standard input, that is the console.
JMonkey works in some graphical window or full-screen. Thus you don’t have access to the console, except for logging purpose.

You should keep up with JME key events. Way to go…

Yang.

Hey, ok thanks for your answer. My problem changed :slight_smile: I try to let the programm start by a variable which comes from an other class. So if Pos =1 playing = true. But Pos comes from a “normal” java class. Which has a Gui which is not built with jmonkey…Does this work?
I am absolutly new in jmonkey and hava no idea about what is posible and what not…So please help me, please…