'Can you have a text variable shown within a text node?
I am trying to a text node, where to states the user's name they chose at the start through a textbox to be displayed within a text node and wondering if it is possible. This is what I've done so far and it isn't working. Also, a unique piece of dialogue comes up if named Andrew.
//if statement to determine the users name and save it
if (nextTextNodeId == 60) {
var InputName = document.getElementById('name').value
name = InputName
setState: { InputName: name }
if (name == "Andrew") {
ToggleInputOff()
state = Object.assign(state, option.setState)
showTextNode(4)
return;
}
else if (name == "") {
state = Object.assign(state, option.setState)
showTextNode(3)
return;
}
else {
ToggleInputOff()
state = Object.assign(state, option.setState)
showTextNode(5)
return;
}
return ToggleInputOff()
}
//Example
{
id: 5,
text: "Welcome " + name + " let us start the day!",
options: [
{
text: "Let's go",
nextText: 6
}
]
},
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
