What's the easiest way to work with tons of text? [Solved]

0 favourites
From the Asset Store
OpenAI TTS
$10 USD
Text-to-Speech plugin.Allows your Construct 3 project to convert written text into spoken words
  • ok so i have some of this understood, but i'm confused by the example because it just seems like it has a lot going on that i don't need and i'm not clear where what i want ends and what i don't want begins.. because its kinda all woven in together.

    I have a json file that is imported in my test project.. i was able to display the the first value by using

    Array.CurValue and that's way cool.. it displayed in a Text object (standard text, not sprite font) "Joke1"

    but what i don't know how to do next is how to call on any of the values below.. this is what i have setup now:

    {

    "c2array":true,

    "size":[4,1,1],

    "data":[[ ["Joke1"],

    ["Joke2"],

    ["Joke3"],

    ["Joke4"]

    ]]

    }

    it seems like if i could just figure out how to access joke 2 3 and 4.. that would be all i need to know to be able to then use what i do know to call on random text from the list above..

    Sorry to be so dense lol, this is just very new to me and having never used sprite fonts before or arrays it's just made the sample project tougher to discern.

    Thanks!

    Caleb

  • a small update.. i tried to use Array.At(1) and got an error.. thinking i could access "Joke2" by calling on (1).

  • a small update.. i tried to use Array.At(1) and got an error.. thinking i could access "Joke2" by calling on (1).

    You use Add Event to Compare Array spots.

    You use Add Action to Set Array spots.

    You can use Array.At(x,y,z) to access array data in events or actions.

    So, for your text object, you could do text->set text->Array.at(1) to set the text to whatever data is in array spot 1.

    Does that help at all?

  • Think of it as a list.

    0.0 Joke 1

    >0.1 Joke 1 Punchline

    1.0 Joke 2

    >1.1 Joke 2 Punchline

    The confusing thing is that in code it counts first intance as 1. So 0 is 1 instance. 1 is 2 instances.

    ["Joke 00"], array.at(0,0)

    ["Joke 00 Punchline"] array.at(0.1)

    ],[ ["Joke 01"], array.at(1,0)

    ["Joke 01 Punchline"] array.at(1,1)

    ],[ We work in 3 dimensions x,y,z In the above we working in 2 dimensions x,y and z we make it 1 So X is the number of cards and we randomize x cardnumber = floor(random(1, numberofcards) we choosing a random number between 1 and #Number of cards. I am not including 0 because I added a card1/totalcards and wanted it too look good. You can add random(0,totalcards) if you want. And number of cards is how wide is x and we can find that out by using array.width y is the 2nd dimension, the bullet points of the card. We only have 1 now, which is punchline. So it looks like this 2 jokes and 2 punchlines (x,y,z) (2,2,1) So to get joke 2 array.at(1,0) and get joke 2 punchline array.at(1,1) Make sense? The trick is to play around with it. Once you master this, you won't ever look back. Ninja'd by Manley23, I guess I took to long in the editor.

  • lol i had the same thing happen.. i was going to share what i was experiencing with my setup.. which i'll post now.. just so you know.. but i'll read and respond to your deeper response once i read through it.

    -----

    yea i pretty much follow you but when i do Array,At(1) i get an error..

    here is what i have so far https://www.dropbox.com/s/tp0x6fgkskac5 ... 0setup.PNG

    this current setup results in this:

    click the button.. the text field shows "Joke1"

    if i make (0) a (1) i get this error https://www.dropbox.com/s/aiui94i2cu58297/error.PNG

  • Can you attach the capx?

    Go full editor - and upload attachment and attach the capx of your test.

    That will save us time. I suspect your json isn't formated correctly.

  • sure thing.. here it is https://www.dropbox.com/s/dvfxbtsi4rk7d1j/PunTest.capx

    yea i just want the simplest way to call on text information and put that information where it needs to go. <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    Thanks!

    Caleb

  • Can you attach the capx?

    Go full editor - and upload attachment and attach the capx of your test.

    That will save us time. I suspect your json isn't formated correctly.

    Sorry to butt in, but I'm also trying to learn how to use json files.

    I'm trying to populate a dictionary with a json file. But when I try to get the values from the dictionary (after the loading is completed) I only get a 0 on each of them. I guess my json doesn't have the right format.

    So I'm trying to manually populate the dictionary and then Download it as json (so I can inspect the file and see the format) but I can't find the resulting json file. So...

    When you Download something as a json file where is it stored?

    (For example: In the capx you provided, after populating the array you download it as json with the file name "carddata.json". But where can I find "carddata.json" ? I can only see the project file "CData2.json".)

    EDIT:

    lol, I found my answer. I had node webkit for previews. I changed to Firefox and after running the project now I see it ask you where to store the file as any regular download. So, please omit this post.

  • ah yes i was going to say, the demo that was provided for me was a file.. but watch out to not click always allow.. it freakin' goes on a save frenzy.. had i think bout 80 files generated on my computer before i could end task!

    Caleb

  • part12studios,

    Yip, your formating was wrong.

    Attached corrected puns.json it works now.

    Sidenote: see my gravatar - that's my son, and his name is Caleb too

  • Ok so yea I went to a weekly event over at the Cambridge Microsoft office and worked with one of their evangelists who works a fair amount in C2 and we managed to figure out how to get what I need (which if course you've been saying, but I wasn't understanding completely).

    {

    "c2array":true,

    "size":[4,2,1],

    "data":[ [["Joke1"],["Punchline1"]],

    [

    ["Joke2"],["Punchline2"]], [

    ["Joke3"],["Punchline3"]], [

    ["Joke4"],["Punchline4"]]

    ]

    }

    Once i got those right and understood how to properly made a 3d array call I now have it working as I was hoping for. If anyone finds this and needs some help let me know and i'll explain what i understand (which is the bare minimum, but i think what i can do now with this will still be a substantially useful feature.

    Once again the C2 forum community has been amazing. Thank you so much everyone for your help with this! I'm sure I'll want to do more fancy stuff in the future with this, but for now i'll make this work!

    Sincerely,

    Caleb

  • Glad it works

  • me too! thanks DUTOIT

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • DUTOIT and part12studios

    Thanks for all of the hard work here. A few weeks back I made the mistake of doing a big data-loading project like this in XML. Then I realized that I wouldn't be able to export to iOS (my target audience) because neither CocoonJS nor Ejecta allow the XML plugin. I will need to port everything over to JSON instead, and this is just the ticket.

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