COULD USE HELP WITH NAMING, Please

Its me back at it again with another Topic. So, I’m trying to allow the PC to name their character and I want to know how do I give them the option to go back and change their name if that’s not what they wanted.

In Cserstros having a name for yourself is just as important as having
a House. What is your name?
*input_text name
 
  Your name is ${name}, is that right?
*choice
  #Yes, my name is ${name}.
  #No, that's not my name

What would I do after that so they could re- type a different name if they want a different one.

*label name
*choice
 #David.
   *set name David
   *goto confirm
 #James.
    *set name James
    *goto confirm
 #Something different...
   *input_text name
   *goto confrm

*label confirm

${name} is your name.
*choice 
 #Yes.
   *goto continue
 #No. 
   *goto name  
2 Likes

Thanks man, Your the second best.:grinning:

1 Like

Of course. I would not be as greedy to steal the first best status from someone.

1 Like

Ooh, that’s not the most concise code you could have for this, and it’s got some errors in it. Some modifications:

*label name

What's your name?

*fake_choice
  # David
    *set name "David"
  # James
    *set name "James"
  # Something else.
    *input_text name

Your name is ${name}. Are you happy with this?

*choice
  # Yes
    *goto continue
  # No.
    *goto name
  • added some flavour text (very important)
  • used *fake_choice instead of *choice because all of the options lead to the same place.
  • included quotes around the string (written out characters) so that it recognises it as a string. I’m 95% sure that the quotes are necessary.
2 Likes

The quotes might be necessary, possibly. I haven’t used choicescript in a while since my hard drive broke down and I tend to forget things easily.

Though I don’t find the other modifications essential.

Gotta keep that code lean!

I’m not the best at keeping it readable and concise, but I do make sure to use fake_choice whenever possible and use comments to separate sections, as well as including plenty of white space.

I’ve got some really dumb stuff in there – I was using *if statements each time the character’s gender is mentioned, which was pretty messy until I figured out easier ways to do it, and I also have a “lawful” stat where adding to it decreases your lawfulness for some stupid reason which I really oughtta change – but I’m continually working on improving my practices for future use.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.