Can I take values from an excel sheet as database?

Just started using Construct 2? Post your questions here

Post » Tue Aug 18, 2015 8:05 am

Hello :D

I would love to create a simple game where there would be 3 boxes for player to select for prize.
Each box has different prize with limited number. I want to link the result with the excel sheet that BoxA got 3 prizes, BoxB got 5, and BoxC got 2.
So when boxA got selected 3 times by different player, next player will only have to select from BoxB and BoxC.

Thanks in advance
B
9
S
2
G
1
Posts: 13
Reputation: 669

Post » Tue Aug 18, 2015 5:42 pm

I think that you'd need to have something to parse it between xml and an excel spreadsheet format. I know that Construct has an read-only xml plugin found under the Data & storage when inserting a new object, I think if you're really dead set on using an excel spread sheet then that would probably be the best place to start I reckon. And I think (might be mistaken), you should also be able to save to XML format from Excel, not too sure as I don't have excel. :-) But check it out, hope that can help somehow.
B
13
S
2
Posts: 9
Reputation: 735

Post » Wed Aug 19, 2015 2:45 am

Thank you for your reply.

It doesn't matter if it is not an Excel sheet. Maybe a text file that I can read and write so the value of each Box can be updated.
I read through forum and it seems using AJAX object is the way.

I haven't really try on using AJAX object so I will keep on trying.
If there is anybody can guide me, it'll be very much appreciated.
B
9
S
2
G
1
Posts: 13
Reputation: 669

Post » Wed Aug 19, 2015 6:51 am

XML files are read only (tutorial).

If you want to write something, you better use 'LocalStorage' (Tutorial).
B
15
S
6
Posts: 105
Reputation: 1,356

Post » Thu Aug 20, 2015 6:13 am

Message: chanchino can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
I'm thinking of implementing the method from the link,

https://www.scirra.com/tutorials/346/online-high-score-table-ajax-php-mysql?page=2

Then adapt it to my box variables; planning to change the name and score to prizes and their quantity.

Please comment for possibilities..
B
9
S
2
G
1
Posts: 13
Reputation: 669

Post » Thu Aug 20, 2015 11:11 am

It's a very good method to use. Even if the tutorial is very well done, maybe you will have some problems implementing it if you don't have any experiences with MySQL & PHP.
B
15
S
6
Posts: 105
Reputation: 1,356

Post » Thu Aug 20, 2015 8:00 pm

I'd take a look at JSON.
My tutorial through development blog is at http://myconstruct2dev.blogspot.co.uk/
B
12
S
3
Posts: 221
Reputation: 1,328

Post » Wed Aug 26, 2015 8:48 am

Message: chanchino can only post plain text URLS until they have 500 rep. 3 URLS modified. Why?
You are right! Now that I have a game that will save result to database but it's not overwriting the data so it' hard to pull an accurate data.
So currently I'm looking for help in editing the PHP from the tutorial so it can overwrite data after sending the same name.

Example
Box A = 3 | Box B = 5 | Box C = 8 (data in DB)

Game result sending www.domain.com/magic/sendscores.php?name=BoxA&scores=2
www.domain.com/magic/sendscores.php?name=BoxB&scores=4
www.domain.com/magic/sendscores.php?name=BoxC&scores=7

then result in database should be: Box A = 2 | Box B =4 | Box C = 7 not Box A = 3 | Box A = 2 | Box B = 5 | Box B = 4 | Box C = 8 | Box C = 7

Almost there :D
B
9
S
2
G
1
Posts: 13
Reputation: 669


Return to Beginner's Questions

Who is online

Users browsing this forum: vslk and 4 guests