can I load data with Javascript at runtime?

george
24 Oct 2013, 03:23
Is it possible to start a game and then load data into it using Javascript? I thought I saw this somewhere here on the forum or wiki but now I can't recall if I really did.

The multiplayer thread seems to show that it's possible?

edit: OK, I think I found what I was trying to remember -- http://quest5.net/wiki/Using_Javascript (under the obscure title 'using javascript' of course! ;D )

george
24 Oct 2013, 05:07
Sorry for the double post, but I have some further questions here.

Say for example that I have a game at textadventures.co.uk. Player Bob plays the game and at the end of the game has a choice of an apple or an orange. He chooses the apple. The next day, player Sue plays the game -- is it possible for her game to tell her that Bob chose the apple?

The only way I can think of at the moment is to have the game open a connection to a server (a HTTP GET/POST would be fine for this case) where it can store and retrieve information about what players choose in the game (I guess similar to the multiplayer Quest example).

Are there limitations to the Javascript interop or do I pretty much have free reign of what Javascript runs during the Quest game?

edit: So after doing some more research, it seems like doing a HTTP request should work, as long as I set up cross-origin resources sharing between textadventures.co.uk and my server. Does that sound right?