How do I put 'text' into text?

  • sorry for my bad title.

    I'm neither a professional developer nor a fluent english speaker.

    I just want to put some 'text' into the middle of dialogue.

    for example...

    (I'm going to use .csv file to store dialogues)

    "I want Y(1~50) units of X("Water" or "Food" or "Ammunition")"

    how do I put text into 'Y' and 'X' in dialog above?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Set unitName="water"

    Set unitQuantity=43

    Set text to "I want " & unitQuantity & " units of " & unitName

    If you load these lines of text from csv, it may be easier to put tags in them and then use replace expression.

    You can mark tags with some rarely used symbol - #$@%& etc.

    For example, CSV file contains this string:

    "I want #quantity# units of #name#"

    And then you do:

    Set text to replace(textFromCSV, "#quantity#", str(unitQuantity))

    Set text to replace(textFromCSV, "#name#", unitName)

  • thanks! that's what I wanted.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)