How do I bind a textField value to a variable from the game?

How to send or receive message? All the interactions will be non-interactive. The GUI will appear and change with different variable values of the game.

The documentations feels inadequate to me. :frowning: Some insight would help.

Ok , i found how to do a basic binding, like the following

[java] private Element textArea;

public void bind(Nifty nifty, Screen screen) {

textArea = screen.findElementByName("text_area");


But, How do I change the GUI TextArea value when an in game event triggers. Say, when the player collect something the textArea value increases.

I tried with following, but this updates only at the beginning.But I need the GUI to call this method time to time.

[xml]<text id="text_area" font ="Interface/objective.fnt" style="nifty-label" color="#FFFFFF"

text="Crystal, ${CALL.niftyGetDataA()}!" align="center" valign="center"/>[/xml]

You can also do:


TextField myField = screen.findNiftyControl("textfieldID", TextField.class);


and to write something into it you do: