How do I put a "Tokenat" in this Code? chooseindex(Chatposition,Dialuge_System.At(1,1),Dialuge_Syste

0 favourites
  • 13 posts
From the Asset Store
Two levels with two sistem Wave. with Source-code (.c3p) + HTML5 Exported.
  • is it possible to put a "Tokenat" expression in this line of code for the Text object? i tried putting it everywhere and it doesn't seem to work.

    I'm using an array to put all my story and dialuge in.

    ---set text to

    chooseindex(Chatposition,Dialuge_System.At(1,1),Dialuge_System.At(1,2),Dialuge_System.At(1,3))

  • Do you want to split the result of that expression?

    tokenat(chooseindex(...), index, separator)

    Or save it to a variable first, and then use tokenat on the variable.

    tokenat(result, index, separator)

  • Do you want to split the result of that expression?

    tokenat(chooseindex(...), index, separator)

    Or save it to a variable first, and then use tokenat on the variable.

    tokenat(result, index, separator)

    I'm sure I understand I'm sorry. what would those options do?

    what I'm trying to do is when a line of Dialgue within an ELEMENT reaches the last separator for the Tokenat it will go down to the next ROW, and when the last separator within the ELEMENT in that ROW is reached, it will go to the Next COLUMN, and when the last COLUMN is reached, go to the Next Sheet. and so forth, like reading a book- Top to Bottom, Left to Right. This is a very Dialuge heavy game so I need something like this. Will the Options you provided let me do that?

    So far I can only, when clicking on an NPC, set text to only 1 ELEMENT that has the text in it with a Tokenat so Im able to put several sentences in and press a Key to Progress Dialuge.

    Or, NOT use tokenat and go down ROWS,COLUMNS,SHEETS but i wont be able to progress dialuge within ELEMENTS as well.

    does that make sense? like a group of 4 ROWS for example

    SHEET.1

    COLUMN.1 COLUMN.2 COLUMN.3

    R1. 6 tokenats E1. 8 tokenats E1. 12 tokenats

    R2. 11 tokenats E2. 14 tokenats E2. 6 tokenats

    R3. 2 tokenats E3. 30 tokenats E3. 4 tokenats

    R4. 28 tokenats E4. 1 tokenats E4. 10 tokenats ---> Next Sheet

    SHEET.2

    COLUMN.1 COLUMN.2 COLUMN.3

    R1. 6 tokenats E1. 8 tokenats E1. 12 tokenats

    R2. 11 tokenats E2. 14 tokenats E2. 6 tokenats

    R3. 2 tokenats E3. 30 tokenats E3. 4 tokenats

    R4. 28 tokenats E4. 1 tokenats E4. 10 tokenats ---> Next Sheet

    SHEET.3

    COLUMN.1 COLUMN.2 COLUMN.3

    R1. 6 tokenats E1. 8 tokenats E1. 12 tokenats

    R2. 11 tokenats E2. 14 tokenats E2. 6 tokenats

    R3. 2 tokenats E3. 30 tokenats E3. 4 tokenats

    R4. 28 tokenats E4. 1 tokenats E4. 10 tokenats ---> Next Sheet

  • What do you mean by "11 tokenats", "28 tokenats"?

    You should probably post your project or some screenshots of your array and the result you want to achieve.

  • What do you mean by "11 tokenats", "28 tokenats"?

    You should probably post your project or some screenshots of your array and the result you want to achieve.

    You don't know what a tokenat is?

    You understand I'm using separators right? I know the phrasing is teqnichally incorrect but I was expecting the meaning to get across.

    It's like when people say the Sun is about to set, that's scientifically I acurate but we understand what they mean.

    When using a Tokenat expresstion you have to signify what divider you wanna use to break up the sentences. I'm using the separator "_".

    The Construct website explains how to use it in its instructions section if you need to look it up.

    What do you mean by the result I want to archive? Is that some code terminology? I have read the instructions myself buy I don't understand what you mean. If you mean what I'm trying to achieve I belive I stated in the first part of this post.

    I can screenshot it but I don't think it's gonna help. I've done it before and it hasn't. I don't know why what I'm asking for is so difficult ether for me to explain or for others to understand. And I know I have to be very specific but if you could meat me half way to help me how to ask the question it'd be good.

    At the end of the day I just wanna make a dialuge system using and Array.

  • You need to post an example of your array! I know what token is, I don't know how are you using it in your project.

  • You need to post an example of your array! I know what token is, I don't know how are you using it in your project.

    Sorry I ment to send the screenshot but I didn't go threw

    I didn't mention I was using Tokenat to break up sentences the of the NPC's Dialuge? Every time a Key is pressed it PROGRESSES THE DIALUGE (this is what the Tokenat is for). And I'm using "_"

    Hello and welcome to the adventure field._ on your journy you'll face many dangers_ take these weapons s and potions to protect yourself._ good luck.

    <key press>

    Hello and welcome to the adventure field._

    <key press>

    on your journy you'll face many dangers_

    <key press>

    take these weapons s and potions to protect yourself._

    <key press>

    good luck.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok, then see my fist comment. Wrap your expression in tokenat()

    Set text to tokenat(chooseindex(Chatposition,Dialuge_System.At(1,1),Dialuge_System.At(1,2),Dialuge_System.At(1,3)), sentenceNumber, "_")

    or the same but simpler:

    tokenat(Dialuge_System.At(1,Chatposition+1), sentenceNumber, "_")

    .

    On every key press increase sentenceNumber, from 0 to tokencount(Dialuge_System.At(1,Chatposition+1), "_")-1

  • Ok, then see my fist comment. Wrap your expression in tokenat()

    Set text to tokenat(chooseindex(Chatposition,Dialuge_System.At(1,1),Dialuge_System.At(1,2),Dialuge_System.At(1,3)), sentenceNumber, "_")

    or the same but simpler:

    tokenat(Dialuge_System.At(1,Chatposition+1), sentenceNumber, "_")

    .

    On every key press increase sentenceNumber, from 0 to tokencount(Dialuge_System.At(1,Chatposition+1), "_")-1

    oh ok and is "sentenceNumber" a global or local variable?

    and in your first comment, which of the 2 options you gave do I do? is what you just now explained one of those to or am I confusing something?

    Do I....

    -split the result of that expression || tokenat(chooseindex(...), index, separator)

    Or do I...

    -save it to a variable first, and then use tokenat on the variable. ||tokenat(result, index, separator)

    although I read the instruction idk if I do understand them, I think I do but I may not. would you mind explaining these terms if its not to much trouble? just to make sure I understand what they are.

    *chooseindex (this means the text will look inside the array right? and you tell it were to look by typing numbers inside parenthises?)

    *index (is this a number Variable?)

    *Result (idk what this means in this context sorry)

    *

  • I suggest you study a few tutorials about arrays and expressions to get a better understanding of your own code.

    Also, refer to the official documentation.

    construct.net/en/make-games/manuals/construct-3/system-reference/system-expressions

    As you can see in the manual, chooseindex expression has nothing to do with arrays:

    You can get rid of chooseindex, it's not needed in your case.

    chooseindex(Chatposition,Dialuge_System.At(1,1),Dialuge_System.At(1,2),Dialuge_System.At(1,3))

    is the same as this:

    Dialuge_System.At(1,Chatposition+1)

    To make the code easier to read, you can save the result of that expression to a variable, let's call it res. It's up to you if you make it global or local.

    Set res to Dialuge_System.At(1,Chatposition+1)

    Then you can split the result into sentences using tokenat and tokencount expressions. Again, see the documentation about how to use them. For example, tokencount(res, "_") will return the total number of sentences. And tokenat(res, 2, "_") will return the third sentence from the res string.

    DialogueText Set Text to tokenat(res, sentenceNumber, "_")

  • I suggest you study a few tutorials about arrays and expressions to get a better understanding of your own code.

    Also, refer to the official documentation.

    https://www.construct.net/en/make-games/manuals/construct-3/system-reference/system-expressions

    As you can see in the manual, chooseindex expression has nothing to do with arrays:

    You can get rid of chooseindex, it's not needed in your case.

    chooseindex(Chatposition,Dialuge_System.At(1,1),Dialuge_System.At(1,2),Dialuge_System.At(1,3))

    is the same as this:

    Dialuge_System.At(1,Chatposition+1)

    To make the code easier to read, you can save the result of that expression to a variable, let's call it res. It's up to you if you make it global or local.

    Set res to Dialuge_System.At(1,Chatposition+1)

    Then you can split the result into sentences using tokenat and tokencount expressions. Again, see the documentation about how to use them. For example, tokencount(res, "_") will return the total number of sentences. And tokenat(res, 2, "_") will return the third sentence from the res string.

    DialogueText Set Text to tokenat(res, sentenceNumber, "_")

    I have ADHD, people with this condition have very difficult time processing and understanding information. Things that are normally easy for most to comprehend it is a real struggle for ADHD people. I've watched & read I belive every tutorial on Dialuge out there (cause I cannot find anymore), gone threw the instruction manuel so many times for 2 years just to get this one thing to work. It's not the fault of you or construct its just the Curse of having this Disability and again I apologize for being irritating.

    I know it's very frustrating helping me but I appreaciate the time you've given me.

    Mabye if I verybly ask and explain what I want verbally in Discord it would be better? If your willing?

  • I've explained in as much details as I could.

    If you want, you can post your project file, mark the events you need help with and I'll tell you how to change them.

  • I've explained in as much details as I could.

    If you want, you can post your project file, mark the events you need help with and I'll tell you how to change them.

    Are you OK with Discord? Or know someone else that might be ok with explaining it to me?

    Sharing my project i dont think is going to do any good if what I'm trying to accomplish isn't clear yet, so mabye I'll say it better if you hear me speak.

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