# File to code TCG

**URL:** https://discourse.processing.org/t/file-to-code-tcg/1345
**Category:** Coding Questions
**Created:** [June 28, 2018, 6:44pm UTC](https://discourse.processing.org/t/file-to-code-tcg/1345 "2018-06-28T18:44:31Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![ctrembla](https://avatars.discourse-cdn.com/v4/letter/c/aeb1de/32.png) [@ctrembla](https://discourse.processing.org/u/ctrembla)
#### Post date: [June 28, 2018, 6:44pm UTC](https://discourse.processing.org/t/file-to-code-tcg/1345/1 "2018-06-28T18:44:31Z")

</div>

I’m wanting to make a list like  
name  
type  
attack  
defense  
and so on in text then get the program to grab the stuff from the list & use the correct info when the card is summoned. I’m thinking of making a TCG & I dont wanna o type = so and so and list all the cards? Is there an easy way to do this or a way to do it?  
I would like the text to look somewhat like this or maybe in graph form:

1. Guard  
a. Human  
b. 1  
c. 3
2. Angel  
a. Angel  
b. 1  
c. 3
3. Flame Drake  
a. Dragon  
b. 2  
c. 8

---

<div class="post-metadata">

### Author: ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)
#### Post date: [July 9, 2018, 9:54am UTC](https://discourse.processing.org/t/file-to-code-tcg/1345/2 "2018-07-09T09:54:01Z")

</div>

> [@ctrembla](#):
>
> I’m thinking of making a TCG & I dont wanna o type = so and so and list all the cards?

Could you be more precise about that?

I think that you might use JSON format for your cards :

- [JSON - Wikipedia](https://en.wikipedia.org/wiki/JSON)
- [JSONObject / Reference / Processing.org](https://processing.org/reference/JSONObject.html)

Thanks

---

<div class="post-metadata">

### Author: ![ctrembla](https://avatars.discourse-cdn.com/v4/letter/c/aeb1de/32.png) [@ctrembla](https://discourse.processing.org/u/ctrembla)
#### Post date: [July 10, 2018, 9:02pm UTC](https://discourse.processing.org/t/file-to-code-tcg/1345/3 "2018-07-10T21:02:14Z")

</div>

yea what I meant was I want to have all the stats in a file and the card object pull the info it needs from the file. Like if you just started you might be using the first card so I was thinking new card(1) or something. Then the card object looks at the file & say 1 is a guard, has 1 attack, and 2 life, no special abilities. Then stores those variables in itself & show the correct stats. I think that is a better explanation. Then if you use like card 125 it looks in and say 125 is Flame Dragon, has 3 attack, 9 life, its fire attack can hit a 3 X 1 area infront of it.  
JSON wouldnt work for me I’m using java & does JSON mean javascript

---

<div class="post-metadata">

### Author: ![madscientist](https://avatars.discourse-cdn.com/v4/letter/m/f19dbf/32.png) [@madscientist](https://discourse.processing.org/u/madscientist)
#### Post date: [July 10, 2018, 10:29pm UTC](https://discourse.processing.org/t/file-to-code-tcg/1345/4 "2018-07-10T22:29:35Z")

</div>

> [@ctrembla](#):
>
> does JSON mean javascript

No JSON does not mean javascript.

> **[JSONObject / Reference](https://processing.org/reference/JSONObject.html)**
>
> A JSONObject stores JSON data with multiple name/value pairs. Values can be numeric, Strings, booleans, other JSONObjects or JSONArrays, or null. JSONObject a…

> **[JSONArray / Reference](https://processing.org/reference/JSONArray.html)**
>
> A JSONArray stores an array of JSON objects. JSONArrays can be generated from scratch, dynamically, or using data from an existing file. JSON can also be output and saved to disk, as in …

---

<div class="post-metadata">

### Author: ![ctrembla](https://avatars.discourse-cdn.com/v4/letter/c/aeb1de/32.png) [@ctrembla](https://discourse.processing.org/u/ctrembla)
#### Post date: [July 10, 2018, 10:49pm UTC](https://discourse.processing.org/t/file-to-code-tcg/1345/5 "2018-07-10T22:49:55Z")

</div>

TY, I just figured out how to a table object that would work.
