C2 Data Editor (Tools)

Discuss Scirra's 2D Asset Store

Post » Sun Oct 05, 2014 5:32 pm

Hello, I'm really enjoying the C2 Data Editor. I happened across a bug, or perhaps a feature.

I'm nesting dictionaries multiple levels deep. In order to load that values into another dictionary object I need to replace all of the html identity codes, so for example

Code: Select all
"{""c2dictionary"":true,""data"":{""head"":""A moon rich in materials drifts amongst the darkness of space"",""body"":""You hail on all frequencies but there is no reply. Preliminary scans do not show surface life. You could plunder this planet for its materials."",""option1"":""{\""c2dictionary\"":true,\""data\"":{\""text\"":\""Plunder the planet\"",\""action\"":\""moonplunder0_fight\"",\""after\"":\""moonplunder0_fight_after\"",\""color\"":\""#FF0000\""}}"",""option2"":""{\""c2dictionary\"":true,\""data\"":{\""text\"":\""Send a scouting party to the surface\"",\""action\"":\""moonplunder0_scout\"",\""after\"":\""moonplunder0_scout_after\"",\""color\"":\""#66FF66\""}}"",""option3"":""{\""c2dictionary\"":true,\""data\"":{\""text\"":\""Leave the planet alone\"",\""action\"":\""close\""}}""}}"


Needed to become this

Code: Select all
"{""c2dictionary"":true,""data"":{""head"":""A moon rich in materials drifts amongst the darkness of space"",""body"":""You hail on all frequencies but there is no reply. Preliminary scans do not show surface life. You could plunder this planet for its materials."",""option1"":""{\""c2dictionary\"":true,\""data\"":{\""text\"":\""Plunder the planet\"",\""action\"":\""moonplunder0_fight\"",\""after\"":\""moonplunder0_fight_after\"",\""color\"":\""#FF0000\""}}"",""option2"":""{\""c2dictionary\"":true,\""data\"":{\""text\"":\""Send a scouting party to the surface\"",\""action\"":\""moonplunder0_scout\"",\""after\"":\""moonplunder0_scout_after\"",\""color\"":\""#66FF66\""}}"",""option3"":""{\""c2dictionary\"":true,\""data\"":{\""text\"":\""Leave the planet alone\"",\""action\"":\""close\""}}""}}"


It would be helpful if there was a utility function or two to ease accessing the nested structures
Developing Surolace, the survival role playing space game.

surolace-survival-role-playing-space-game_t116953
B
14
S
4
Posts: 303
Reputation: 1,730

Post » Sun Oct 05, 2014 7:04 pm

skelooth wrote:It would be helpful if there was a utility function or two to ease accessing the nested structures


In order to help me better understand what you are asking for please detail if this is from the JSON generation feature? Or the Injection feature? etc... also screenshots would be very helpful...

Thanks.
B
21
S
5
Posts: 196
Reputation: 1,974

Post » Sun Oct 05, 2014 7:38 pm

skelooth wrote:It would be helpful if there was a utility function or two to ease accessing the nested structures


Ok so I went and did a test and saw exactly what you were seeing. At some point I modified my code from using "" to ""

I do not remember why I did this and hopefully there was no good reason for it. I just uploaded a new version of C2 Data Editor and an email will go out with download instructions once that has been approved by Scirra.

I tested this in a sample project and was able to load up a nested Dictionary and get its values out without needing to do any additional handling of the quotes.

NestedDictionaryLoadTest.PNG


*** If anyone sees this change causing a problem in your projects let me know ASAP.

From the Changes.txt file:

* Modified the formatting of Data Object values so that instead of "" being generated "" is instead which works in C2 event sheets also AND makes it so that it can load via the JSON load method easily.


*** Don't forget to rate and review C2 Data Editor in the Scirra App Store!!!
You do not have the required permissions to view the files attached to this post.
B
21
S
5
Posts: 196
Reputation: 1,974

Post » Sat Oct 11, 2014 5:10 pm

A new version was just uploaded.

This fix takes care of an issue where a user enters invalid characters into an array's column names and then injects into a C2 project.


From the Changes.txt:

* Adds the same filtering to array column names as is applied to array and dictionary names. Some characters (e.g. spaces) are not allowed in some C2 object names.


*** Don't forget to rate and review C2 Data Editor in the Scirra App Store!!!
B
21
S
5
Posts: 196
Reputation: 1,974

Post » Tue Oct 28, 2014 3:19 am

Hey @ggibson1

the tool looks very interesting for me, but i am just a beginner in costruct so i have a few questions:

did i understand it correctly that with the c2 data editor it is possible to use arrays like a database? i have some knowledge in mysql, and currently i am creating a game which simulates an economy. it its a real **** ** *** *** to do all this with arrays. the thing is, in my game new production facilitys get created all the time, each facility has its own recauces, needs to make orders and so on. just working with instance variables isnt enought here. so i need different arrays which i can handle like a mysql database...

- is this possible with this tool?
- are there any more examples or tutorials out there?

thank you
Joschi
B
19
S
7
G
1
Posts: 222
Reputation: 2,546

Post » Thu Oct 30, 2014 10:42 pm

j0schi wrote:Hey @ggibson1

the tool looks very interesting for me, but i am just a beginner in costruct so i have a few questions:

did i understand it correctly that with the c2 data editor it is possible to use arrays like a database? i have some knowledge in mysql, and currently i am creating a game which simulates an economy. it its a real **** ** *** *** to do all this with arrays. the thing is, in my game new production facilitys get created all the time, each facility has its own recauces, needs to make orders and so on. just working with instance variables isnt enought here. so i need different arrays which i can handle like a mysql database...

- is this possible with this tool?
- are there any more examples or tutorials out there?

thank you
Joschi



Yes you can use the Arrays like a database with the C2 Data Editor. It comes with several methods built from C2 Function objects that implement different kinds of queries against the data in a C2 Array. These functions treat a C2 Array like a database Table. The names of these methods are meant be more user friendly rather than matching SQL standards.

There is a CAPX that comes with the C2 Data Editor that shows these methods being used. There is also extensive comments above each method. You can either copy these methods out of the CAPX or you can use the injection feature in the tool to inject these functions into an Eventsheet within your application.

You can do things like lookup a row in an Array (Table) by one column (e.g. ID) and return the value of a different column (e.g. DollarAmount) from that same matching row.

The names of the columns on the table results in Instance Variables on the C2 Array when it is injected into your application where each column name is assigned the index of the column in the table so that you can use the built in C2 intellisense to select which column to search on or return from the function by name.

I have worked with databases extensively over the past 25 years and so I made C2 Data Editor to make C2 feel as close as possible to that way of handling data for the same reasons you mentioned.
B
21
S
5
Posts: 196
Reputation: 1,974

Post » Thu Oct 30, 2014 11:20 pm

@ggibson1

thank you very much for the clarification, just bought it, even i will have no time to use it till next week. this sounds so awesome, cant wait to try it!

thanks again :)

regards
joschi

edit: also some more tutorials or examples would be awesome, maybe you can demonstrate how to make use of the c2 data editor in a simple economy game and include the vidiotutorial with the purchase? that would be really great :) and btw, even if i really like robots, they might be not advanced enought to speak tutorials haha :D
B
19
S
7
G
1
Posts: 222
Reputation: 2,546

Post » Fri Oct 31, 2014 2:03 pm

j0schi wrote:@ggibson1

thank you very much for the clarification, just bought it, even i will have no time to use it till next week. this sounds so awesome, cant wait to try it!

thanks again :)

regards
joschi

edit: also some more tutorials or examples would be awesome, maybe you can demonstrate how to make use of the c2 data editor in a simple economy game and include the vidiotutorial with the purchase? that would be really great :) and btw, even if i really like robots, they might be not advanced enought to speak tutorials haha :D


Good idea.

Who knows maybe I took voice lessons to learn how to make my voice sound like that... :twisted:
B
21
S
5
Posts: 196
Reputation: 1,974

Post » Thu Nov 06, 2014 2:00 am

As i am working alot with this tool lately i want to give you some feedback:

1) pleaxe fix the order, i know this is an issue with many programms
http://gyazo.com/b2e195561484174ea89431d64438435d but its a lot easyer in many cases to sort by id, for example dfinding the highest...

2) in the manual you should point out a little more what the Resultset is and how to work with it, some examples might be nice :)

3) it would be a nice to have to search for "empty values" and insert a placeholder like "description missing"

4) IMPORTANT sometimes i accedentally drag and drop. what happens then is that a whole row gets ovewritten and the data is lost... there is no back button. the only solution is to close the editor and open the file new with all changes lost...
this happened to me 5 times now and everytime i have to start over again. in addition whith the ID sorting problem its very hard to see if a line is missing or not. also, why cant i copy an existing row into a new one?
that would save me a lot of time beacause many objects have similar values....

besides of that this tool is the "safer of asses"!

thanks
Patrick
B
19
S
7
G
1
Posts: 222
Reputation: 2,546

Post » Sat Nov 08, 2014 1:29 am

Update:

When i try to edit a row sometimes it jumps to the first row and overwrites this value insted of the actual selected cell... the thing that i have to click serveral times is really annoying.

when i set the colum with it doesnt get saved. as soon as i add a new colum it gets reseted also when i restart thge tool whats making the work with big tables very hard.

regards.
B
19
S
7
G
1
Posts: 222
Reputation: 2,546

PreviousNext

Return to Scirra Store

Who is online

Users browsing this forum: Artpunk, BackendFreak and 1 guest