Text Boxes and other variables


#1

Hi! I’m back, and I have more seemingly complicated questions with a lot of simple answers ^^;.
My first question is how to make a text box so that people can input their own name. I’m pretty sure that this is all connected to variables some way or another, but if anyone would be so kind as to walk it through with me step by step it would be greatly appreciated. Thanks!


#2

*input text name

That should do it, as long as ‘name’ is declared in mygame.js :slight_smile:


#3

Okay, this is going to sound really stupid, but how do I add a new variable in mygame.js?


#4

I’m gonna post my foundation mygame.js file, which is a slight edit on the original.


// Specify the list of scenes here, each in quotation marks and separated by commas.
// Be sure to not have an extra comma at the end.
//
// Example:
// 	"testscene"
// 	,"testscene2"
// 	,"testscene3"
//
// No final comma, see?

nav = new SceneNavigator([
	"testscene"
]);

// Specify the default starting stats here, each separated by commas, with no final one.
// They must all have a starting value, whether numberic, string, or boolean.

stats = {
	testvarnum: 0
	,testvarstrin: "Unknown"
	,testvarbool: false
};

// Specify the stats to use in debug mode

debugStats = stats

// or just use defaults
// debugStats = stats

http://choicescriptdev.wikia.com/wiki/Index is a good place to start looking at CS commands, after reading the tutorials, in case you need anything.

EDIT: Also, the command is *input_text name. And, also, you should ask questions in the ChoiceScript Help category, so that people can see you need help.


#5

Good point, I’ll try that. Thanks :slight_smile: