Kirilllive / tuesday-js

simple web-based, free and open-source visual novel editor that can be used in a web browser. It is written in JavaScript without using any third party libraries and thus does not require additional software installation. The engine uses standard HTML document elements such as div and img. This allows the use of any media format supported by browsers including vector graphics svg, gif animations and css styles.
https://kirilllive.github.io/tuesday-js/
Apache License 2.0
513 stars 62 forks source link

User Text Input #16

Closed fsvieira closed 2 years ago

fsvieira commented 2 years ago

Hi,

I was experimenting with tuesday js, and I am trying to figure out how to get player input, for example at the beginning of the game I would like to get player name (https://fsvieira.github.io/thecorporation/).

Does this feature exists ? If not, is it possible to add it using the html js features, how?

Great project, I tried to check the code, but its a little bit confusing to me.

Kirilllive commented 2 years ago

Hello! you can use the browser window.prompt() function, And set name to variable value at "story_json.parameters.user_name"

For this you need to add this JS code in button choice or scene let person = prompt("Please enter your name:","User Name"); story_json.parameters.variables.user_name=person;

https://www.w3schools.com/js/tryit.asp?filename=tryjs_prompt

example project "enter name"

fsvieira commented 2 years ago

Hi, Thanks that works perfectly.

Thank you for such a quick response and example.