First off, I’m sorry that I’m posting a second discussion on the same topic as my last one, but I’m in a bit of a hurry and considering that I’m a bit slow with technology and the fact that I need to get this done as soon as possible, here it is again:
I want to creat a text box for the player to write their character’s name in and then be able to program to game so that everytime their name comes up I can just type something like *player_name or something like that so that I won’t have to make a million different copies. Also, I’d like to know how to be able to make choices so that whatever choice the person chooses it shows up on the “stats” area. Example:
Which clan will you be in?
*choice #ThunderClan
#RiverClan
#ShadowClan
#WindClan
And then which ever one they pick will appear in the blank spot on the stats screen that says “Clan:”
I use fakechoice so it falls to the next thing it saves time for me
*fake_choice
#Thunder
*set clan "Thunder Clan"
#River Clan
*set clan "River Clan"
#Shadow Clan
*set clan "Shadow Clan"
#Wind Clan
*set clan "Wind Clan"
Put name here
*input_text player_name
*set player_name "$!{player_name}" (this will capitalize the name, but this isnt needed)
Sorry im not too indepth with the explaining, Im not the best person at breaking things down
but if you ever need the player to type something in if its a name
*input_text [insert stat here]
and if its a number
*input_num 1 100 (the first number you put in is the starting range and the second is the end range, so thats pretty much saying you can pick a number from 1-100)
If you ever need anything I dont mind answering, you can always PM me if you feel your posting too many threads
Just to expand, ${player_name} is what will display the variable each time - you have to remember the dollar sign and curly braces for it to display correctly ingame.
As a writing tip, you might want to use an easy placeholder, like pname and then use your processor’s Replace action to change it to ${player_name}.
Edit:
From what I can tell, Notepad ++ is pretty much the most utilized word processing program when writing a ChoiceScript game, as it keeps an easy track of indentation and parenthetic operations. I’d switch to it if you’re not using it already.
Also when you use Notepad++ for me I just edit scenes and stuff normally but I use Notepad on the stuff I cant open normally idk if its only me but when I normally write a scene or something then switch to notepad I get tons of errors about indentions and tons of other stuff
The errors that come up when I try to open the index are:
Invalid character
Unable to get value property ‘setStartingStatsClone’: object is null or undefined
(and when I click on Show Stats): Unable to get value of the property ‘sceneName’: object is null or undefined
This is the proper structure for a fake/non-guiding choice:
You have to choose a weapon...
*fake_choice
#I chose a sword!
*set chosen_weapon "sword"
#I chose an axe!
*set chosen_weapon "axe"
#I chose a mace!
*set chosen_weapon "mace"
#I chose a rubber duckling!
*set chosen_weapon "duckling"
Here’s an example of default name input, it doesn’t go under a choice:
*input_text player_name
*page_break
Ah, so your name is $!{player_name}, and what a marvellous name it is!
*finish
But that’s just it- either it’s not there or I can’t find it. I’m not really sure what it is (I mean, I could guess by the name, but there doesn’t seem to be anything that would suggest it)
// Specify the list of scenes here, separated by commas, with no final comma
nav = new SceneNavigator([
"startup"
,"animal"
,"variables"
]);
// Specify the default starting stats here
stats = {
knowledge: 50
,loyalty: 50
,medicine: 50
,faith: 50
,ambition: 50
,honor: 50
,courage: 50
,compassion: 50
,fighting: 50
,hunting: 50
,graypaw: 50
,bluestar: 50
,tigerclaw: 50
,sandpaw: 50
,player_name: ""
};
// Specify the stats to use in debug mode
debugStats = {
cats: 50
,shoes: 50
};
// or just use defaults
// debugStats = stats
@computermouse123
Well, the good news is that there’s nothing wrong with your mygame.js (other than the odd debugStats, but those aren’t causing your errors). Your stats should function just fine as long as you’re using the right formats for displaying your variables.
The bad news is that I can’t narrow it down anymore than to tell you it’s something with your scene files. Are you still getting the “invalid character” error? That one can at least give you a location (character and line number) to start figuring out what’s wrong.
@CS_Closet
I checked over the list of stats in mygame.js and compared it to the choicescript_stats page to see if I had accidently miss-spelled anything or something like that and couldn’t find any errors or anything that would suggest that something was wrong. Yet I’m still getting the “invalid character” error. I’m sorry to ask again, but are you sure there’s nothing wrong with the files I posted? Or maybe there’s another file I should check?
@2Ton
The only thing in mygame.js about names is ,player_name: “”, and if I’m hearing you two correctly, there’s nothing wrong with what I’ve written. I’m so confused as to why none of this seems to be working, but I really appreciate that the two of you have been trying to help, even if nothing has really been solved so far.
Make sure you’re not copying code from something like Word.
You need to write it directly in your editor, that’s the only other common issue it might be.