0 Favourites

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

  • 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:




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






    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.



  • 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

    this current setup results in this:

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

    if i make (0) a (1) i get this error

  • 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

    yea i just want the simplest way to call on text information and put that information where it needs to go.



  • 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".)


    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!


  • 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).




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


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

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




    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!



  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Glad it works

  • me too! thanks DUTOIT

  • 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)