Okay, great news, it started working!!
Do you mind saying what helped you figure it out?
Oh, I believe I stopped using the “:” next to the input part, I hope this helps! <3
I really don’t know how to do this??? I’m trying to make it so for the default people can just put a name in for their character’s name and I did the whole
*create_player 0
input_text_player_name
*set player_name “{player_name}”
but like when i try and run it nothing happens, i dont get an error it just shows up when i try and put in a name as “{player_name}” I’m really not sure where I went wrong or how to yknow make it work
Mmmm
How about:
*create_player 0
*Create player_name ""
*temp name ""
input_text name
(...)
*set player_name name
Like this?
Why use an additional temp though?
*create fname ""
*create lname ""
First name?
*input_text fname
Last name?
*input_text lname
$!{fname} $!{lname}
Ello! Looks as if you’re trying to set player_name to itself. This is the way I’d do it:
*temp p_entry ""
*input_text p_entry
*if (p_entry != "")
*set player_name "$!{p_entry}"
Check for nothing being entered so that you don’t set a blank name.
Then when it’s set, use an exclamation point to capitalise it.
Is it possible for the player to enter nothing, though? When I play COGs, I always get the “Don’t just leave it blank! Type something!” pop-up. Or does that have to be programmed separately?
You’d have to put in some response to a blank. Just a message and a goto back to a label before the input or just leaving it as it was before. That was just a code snippet from my latest ‘not so epic’ missive. The *if statement makes the change to the entered name if there was one. If it was left blank, nothing changes.
*temp p_entry ""
*label try_again
*input_text p_entry
*if (p_entry != "")
*set player_name "$!{p_entry}"
*else
"Nothing entered - try again!"
*goto try_again
Note, I haven’t tested that but it looks ok LOL
I don’t usually do this though. A character rename is usually off a choice option. If nothing is entered, I just don’t change anything. Then the code just returns to a point before the choice so the player can try again or do something else.
It isn’t really necessary since CS has a built-in check to prevent blank inputs from both input_text and input_number. This condition *if (p_entry != “”) is impossible to meet in the game.
Huh. After all this time I never noticed that. All that extra typing for nothing. Learn something new every day
I’d rather it didn’t force you to enter things though, if your player makes a mistake they can’t back out of it by just hitting enter. This is the sort of thing that I think should be left for the user to code. Still, as Dilbert’s pointy haired boss once said, “It is what it is.”
thank you all for replying to this and i apologize i should’ve also said that i’m using choice script ide, i did try those solutions but they didn’t seem to help
What exactly you are trying? I ask because I didn’t know if I get what you meant up there.
I’m just wanting to make it so people can enter in a name and it shows up
Shows up as in Your name: ${name}
?
yeah
Well, just do that.
*input_text name
Your name: ${name}
*choice
#confirm
#Re-enter
i tried i got a nonexistent variable ‘name’ error
You will need a *create name ""
in your startup file. (You could also declare the variable as a temp, but since presumably you will want to keep using the name throughout the game, startup is best).
What I posted is just an example, not the true 100% functional copy-paste-this-it-works code. You have to edit and change it accordingly.