At 2/7/14 10:03 PM, slugrail wrote:
Yes, but if I format the code in FD with my code indent settings it'd be squashed into one line.
Not sure if I understand this. What do you want to say by that? It's my code's fault or your settings are bad?
2)
You seemed to have answered your own question there.
Yes yes. Yes.
3) Is it OK to create anonymous functions like this?
No and no. Integrate what you'll be commonly using into the dialogue system.
No need for callbacks when you set the boundaries yourself.
So you mean that I should instead write large chains of if/else, where I check what phrase is currently displaying and run code depending on what phrase that is?
For the most part, I didn't understand what you replied to point 3).
At 2/7/14 10:44 PM, Diki wrote:
At 2/7/14 09:35 PM, kkots wrote:
index - universal ID
You should call that a GUID (Globally Unique Identifier) then, as the word "index" doesn't accurately convey what the value is representing.
It is supposed to be a unique (not universal, unique, sorry, my bad) value which can be used to refer to the object indirectly.
It does seem to be like GUID.
If you were to instead store these blocks of data in an array
I can't. I'm trying to write out non-linear dialogues with choices in human-readable format. It's not possible to use just one array for this. Besides, in an array, I would not be able to get a visual clue of what index every object has. I need that clue (the indexes) to refer to objects in the code.
lines
you don't actually need it.
That's painfully true. I must fix this.
1) Is it human-readable? How easy do you think is it to manually edit?
make an editor that simplifies changing the data
I tried to make an editor, but it's taking too much time to code the graphical interface for it, there are way too many buttons, the menus are way too complicated (and it does not look comprehensible, either). The fastest and easiest way to do it, and still acceptable, is to represent the dialogue database as ActionScript code and work with that.
2) Is this good coding practice?
You should be making classes to store all of this information in
I hope that you wanted to say that I should make a class and use its constructor to create objects, because otherwise I don't understand this, especially why would I need to separate text from the rest of the data? If I'm not going to write an editor?
4) How can this be improved to be more maintainable and more following good OOP standards?
use JSON.
If I use JSON, I will then be able to easily read the data using a program, and do operations with it, like overwriting the file with modified version of it? This is interesting, but it requires a dialogue editor, which I can't afford to produce.
A good start would be to use classes and proper functions for everything.
Thanks for the advice. I need to write down notes on what should be changed.