How much text can an instance variable store

  • Hello all

    I had a search of the forums and a flick through the manual but could not find an answer to my query so apologies if the answer is very obvious.

    Basically I had a peek at one of the RPG dialog system examples (apologies I forget which one) and I noticed that the text for each dialog box was stored as an Instance Variable within the NPC sprite.

    Now until I find out how to use external XML lists for my dialog this seems like a fantastic way to store dialog for my project, however I was wondering what the maximum string size for these variables is.

    So far I have found they can store a good sentence or two but I am curious as to what the real maximum limit is.

    Thank you

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Variables aren't manageable for data like this.

    You can store a lot of text. But I believe you will encounter memory problems etc etc etc.

    Easiest option: You can select to use a text file and import it, or json.

    Lets be honest. Depending on size of game. Going through countless variables is going to drive you made when you want to make an edit. Put them into a text file and attach that to your project. Or use json and arrays. Or any of the other options, but don't use variables - lol.

    You also limited to 100 events with free version. (Import a file which you can edit in notepad, etc and use search and replace functioniality)

    Here is a simple example of using text as external file: simple trivia game example of course change it to your needs.

  • Ooo that sounds perfect thank you. Unfortunately I am at work so cannot check the example yet but I am sure I will be able to modify that function to fit around what I need. You are right about the eventual bloat of variables, as the project wears on it would become untenable to maintain.

    Thanks for the assistance

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