How much text can an instance variable store

Just started using Construct 2? Post your questions here

Post » Thu Apr 02, 2015 1:17 pm

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
The Aurora Borealis? At this time of year? At this time of day? In this part of the country? Localized entirely within your kitchen?
B
11
S
2
Posts: 16
Reputation: 638

Post » Thu Apr 02, 2015 2:01 pm

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.
You think you can do these things, but you can't, Nemo!
Just keep reading.
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,718

Post » Thu Apr 02, 2015 2:23 pm

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 :)
The Aurora Borealis? At this time of year? At this time of day? In this part of the country? Localized entirely within your kitchen?
B
11
S
2
Posts: 16
Reputation: 638


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests