How to input a text bar


#1

I’m having trouble with letting players choose their own names. Like, I’m putting in five choices that the players can choose from, but then I want there to be an option that says “I don’t like any of these” and then put a text bar on the next page and let them type in their own names. I have torn this forum apart searching for answers, but have had no such luck. If anyone could help me, I would be so thankful!
Also, once a name is chosen, how do you get it to stay the same name?


#2
 #No, it's...
         *label input_parent_firstname
         *input_text parent_firstname         
         "${parent_firstname}" Is that correct? [i](Please make sure of proper capitalization)[/i]
         *choice
            #Yes, that is correct.
               *goto parentlastnameinput
            #Ah, no, it's...
               *goto input_parent_firstname

The above is from my game.
Apply variables and labels as you see fit


#3

Ah, @MeltingPenguins is a faster typer!
The command you’re looking for is *input_text; put the name of the variable you want them to change after it, like this:

#Joe
   *set first_name "Joe"
#Type your own
   *input_text first_name

etc…


#4

To add to both @MeltingPenguins and @Alexandra 's name inputting, if you don’t want a character to have a certain name (i.e. as a character who already has the name) you can also do this:

	#Something unique...
		*input_text firstname
*if ((firstname = "Alec") or ((firstname = "alec") or ((firstname = "Ashton") or ((firstname = "ashton") or ((firstname = "Azrael") or ((firstname = "azrael") or ((firstname = "Tobias") or ((firstname = "tobias") or ((firstname = "James") or ((firstname = "james") or ((firstname = "Julius") or ((firstname = "julius") or ((firstname = "Solomon") or ((firstname = "solomon")))))))))))))))
	Bloody hell! This name is already taken. Choose another...	
	*set firstname "unknown"
	*goto MCName
*if ((firstname = "Eva") or ((firstname = "eva") or ((firstname = "Eveleen") or ((firstname = "eveleen") or ((firstname = "Giulia") or ((firstname = "giulia") or ((firstname = "Margery") or ((firstname = "margery") or ((firstname = "Mia") or ((firstname = "mia") or ((firstname = "Rosita") or ((firstname = "rosita")))))))))))))
	Bloody hell! This name is already taken. Choose another...
	*set firstname "unknown"
	*goto MCName

(I apologize if it was a little off-topic in me adding the above. I just figured it would help if you ended up wanting to add something like it.)


#5

To add again (!), there’s a shorter way to write this; $!!{variable} means that variable with every letter capitalized, so you can write a check like this:

*if (("$!!{first_name}" = "ELIJAH") or ("$!!{first_name}" = "ELI"))
	*goto imusingthatalready

The Saga of Oedipus Rex (Final testing- for real this time I hope.) Updated 20th May
#6

I didn’t know about this! I have some editing to do to my games code haha. Thanks so much. (you learn new stuff every day x3)


#7

Hi, I can see that there are already alot of answers here

but personally, I always check out this page for answers first:

click for link

https://www.choiceofgames.com/make-your-own-games/choicescript-intro/

These tips and tricks by ChoiceOf really helped me out, and when i’m confused about something I always look back through these pages to find my answer, and come to the boards if i cant or if i still dont understand something exactly


#8

Happy browsing!


#9

Perhaps you need to create simple function like this?

*temp charnum 0
*temp search "nothing"
*temp player_caps "nothing"

*comment Character List
*temp char1 "ELI"
*temp char2 "ElIJAH"
*temp char3 "SUSANNAH"
(Add more as you create more characters)

*comment Name Input
Please input a name.
*input_text player_name

*set player_caps "$!!{player_name}"
*set charnum 0

*comment Compare
*label check

*set charnum + 1
*if charnum = 50 (whatever your last character number is plus 1)
    That's great, ${player_name}!
    *finish
*else
    *set search "char" & charnum
    *if player_caps = search
         That name is already taken!
        *goto name_input
    *else
        *goto check

I think that’s the correct form. I’ll look it over and correct it if anything goes awry.