Help needed: Want to the user to input his name and then show that text on other scene

I am new to Tumult Hype.
Would like to ask the user of the scene to input his name as a text and then position that text/name on other scene

Please help me to find a way to do this.

Thank you so much

The problem looks similar to this…

You could use local storage to save the value, then edit the innerHTML with the stored value.

As long as it stays in the same HypeDocument a global will do. You can declare one with a javscript like this:
window.gName = '';

Hype has no way to get you a nice input textfield, you have to set it in the innerHTML of a box.
Take a look at this example: (24.5 KB)

But the value is gone, if i go back to the first scene. I have a project, where this my be a great problem. How can it works if you toogle between scenes?

I'm not sure exactly how to fix your problem, but here are some general comments...

// Load Sound Volume
if ( >= 0) {
var sv =;
} else {
var sv = 8;

That's an example from Annoyed Tomatoes. It's loading the previous sound volume. It checks to see if the user previously set the volume. If the localStorage variable "sv" (which is short for "sound volume") is greater than or equal to zero, then the user saved the value. If not, then set it to the default value of "8".

That general idea should be what you need to solve the problem. If there is a player name entered already, then don't bother asking for it. Otherwise, the player enters their name. The tricky part is checking to see if the name variable is empty. I'm not quite sure about this part, but here's a guess...

// Load Player Name
if ( > 0) {
 // Welcome back player
} else {
 // Who are you player?

Sorry, not the value of the sound. The value of the input-field is gone, if i go back to the prev. scene.

@Photics is offering an idea of one way to possibly solve your issue, this is an example so it is not going to be exactly what you want. The intension is you adapt the idae to your needs

We could post other examples like using a Global var. within another function but I suspect all this will do is elicit more questions because we are only giving more examples that do not match your project.

One way to help us help you is to post a project with your set up. Can you please post one.

I solve the problem with the help form gasspence. My input-field look like that:
input type=text" id=“name” value=""
Then, in the next step, i set the input-field as a persistent symbol with the choice “add to the current scene”. (26.3 KB)

1 Like