get a variable name with an expression

  • Hi, is it possible to get the value of a variable whose name was acquired through an expression?

    ----

    So basically my npc text is split into 10 npc.row1 npc.row2 and so on text variables.

    I also have a curRow variable that gets +1 every time a button is clicked during npc conversation.

    As a result I have to make 10 sepparate curRow conditions -for each row variable to update the text in the textbox with it's value.

    Is there a better way to do this?

    Basically I want to add another variable called curText. And say

    npc.curText=npc.row2

    where the 2 at the end of curRow is the npc.curRow value. Is this possible to do in an expression?

  • If your goal is to make a system of storing and managing dialogue you might want to check these threads out:

    scirra.com/forum/dialogue-best-practices-and-where-to-store-text_topic65280.html

    scirra.com/forum/npc-dialog_topic48355_post303797.html

  • i couldnt find a single example of a dialogue system in scirra that is manageable. The complicated examples (dictionary,jason file,etc etc) are all in words and not one capx file to look at. The ones posted lead to dead links :(

    I just want to make an NPC that can be instanced and reused with different text.

  • I would choose the option of giving the npc an array in a container, that way you can set it to different text for each instance.

  • is there no way to just use a bunch of text variables (rows) then?

    I want something that will later be super easy to change on each instance.

    This whole array business sounds like hardcoding dialogue inside the event sheet rather than on the instances.

    My goal is to keep all the dialogue text outside of the event sheet

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Is it possible to have the dialogue text of npcs in a spreadsheet (csv) and to just load it in NPC instances with a variable.

    There was something mentioned about it at this forum, but no example files anywhere.

    It's really really hard to do the simplest npc dialogue box. This same thing is extremely easy to do in rpg maker engines for example.

    It's an often requested feature and rarely have i seen it implemented well with construct.

    Wouldnt it be great if someone wrote a behavior for construct that mimics the way NPC dialogue is handled in rpg maker?

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