[PLUGIN] CSV, CSV2Array, CSV2Dictionary

Post your completed addons to share with the community

Post » Tue Nov 26, 2013 4:23 pm

@rexrainbow : would it possible to detect the the data type of each string automatically (with a tick box or something like that)? I need to convert the strings that are numbers to integers or floats manually inside of Construct 2 to make comparisons with other numbers (via system compare) work.mindfaQ2013-11-26 16:23:56
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
20
S
9
G
1
Posts: 785
Reputation: 3,725

Post » Tue Nov 26, 2013 7:50 pm

@floatingsunfish
there is CSV plugin and CSV2Array I believe, you would need both
B
31
S
12
G
7
Posts: 411
Reputation: 6,862

Post » Wed Nov 27, 2013 12:56 pm

Thanks! I thought I only needed the CSV2Array plugin. D'oh!
That'll teach me to skim posts!
(insert subliminal message here.)
B
15
S
4
G
1
Posts: 18
Reputation: 955

Post » Thu Nov 28, 2013 4:30 pm

You don't really need the CSV plugin to use the CSV2Array plugin, BUT the mentioned examples use the CSV plugin, so that's why they would not load.
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
20
S
9
G
1
Posts: 785
Reputation: 3,725

Post » Tue Dec 03, 2013 6:44 pm

A capx using the CSVtoArray-plugin to transform .csv to .json with multipage support (-> 3D-array) and number conversion (row, collumn or all), since the CSV2Array-plugin treats everything as string:

capx

Useful when you want to use only native plugins in your game (for example to upload it to scirra arcade) and look for a way to transport your excel data sheets to C2-conform .json.
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
20
S
9
G
1
Posts: 785
Reputation: 3,725

Post » Thu Dec 05, 2013 2:23 pm

its so confusing. so can i get some straight answer please.
no one has a direct answer on a direct JSON solution, what gives??
I have a JSON like below, (flat structure and all), then what is the best way to load it from URL and read the key/value? thanks

[{"id":"42","pct":"691th","phone":"17222576211","fax":"","email":"","address":"9720 Foster Avenue","lat":"40.6484","lng":"-73.9049","borough":"queens","city":"nyc","state":"ny","distance":"0.5231590272587"},{"id":"38","precinct":"63rd Pct","phone":"17222584412","fax":"","email":"","address":"1844 Brooklyn Avenue","lat":"40.6281","lng":"-73.9414","borough":"queens","city":"jersey city","state":"ny","distance":"1.854571460077"}]
B
5
Posts: 78
Reputation: 406

Post » Tue Jan 21, 2014 9:02 am

@broprog
Try to use Hash table plugin
B
97
S
22
G
177
Posts: 4,111
Reputation: 103,525

Post » Tue Jan 21, 2014 9:15 am

Update

I try to add a table watch and table editor in the debugger.

The test capx.
The csv table
[code]",a,b
c,0,0
d,0,0"[/code]
And the value will be changed at event sheet.

Debugger of csv object:

At debugger, user could
- Change the page name by editing the entry "Page"
- Change the col name by editing entry "Col"
- The rows and the values will be shown if the "Page" and "Col" is valid.
- Change the csv table by editing the entry of "row-xxx". rexrainbow2014-01-24 09:53:40
B
97
S
22
G
177
Posts: 4,111
Reputation: 103,525

Post » Thu Jan 23, 2014 6:54 am

Update:

Add property "Eval mode".
If the property "Eval mode" set to "No", all data will be treat to be string.
If the property "Eval mode" set to "Yes", the data will be eval, so
- number: 10
- string: 'hi'
- javascript function: Math.random()
capx: eval mode = Yes
B
97
S
22
G
177
Posts: 4,111
Reputation: 103,525

Post » Thu Jan 23, 2014 6:58 am

CSV2Array, CSV2Dictionary

Parsing csv string, then put them into an array object or dictionary object.
Capx: CSV2Array
[code]100
200
300[/code]

Capx: CSV2Dictionary
[code]A,10
B,20[/code]

See the data with debugger.

Also, these 2 plugins had property "Eval mode" just like csv plugin. So that user could pass number or string type data.
rexrainbow2014-01-23 07:02:08
B
97
S
22
G
177
Posts: 4,111
Reputation: 103,525

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: andreyin and 1 guest