What EVER I tried, I’m not able to read data from the XML file. If I give scene-variable an initial value and then try to read from XML node new data into it, like say from file “cjea.xml” (in same directory as project) and read node “root/test” ( with root-element “root” and child-element “test”) into NewVariable, which I gave an initial value of “hi”, then “hi” is shown into some textobject, instead of the new text from node in my XML file. I have also tried to do a XML-node-value delete, but to no avail either…
Can you give an example of how the XML file must look like?
If there is an error in the JS program, then please give me the correction, so that I might correct it myself and don’t have to wait for the next version ?
I know that one can load an XML file into memory, but I fail to see how to make use of this??
(I’ve not tried to write data to the XML file as of yet).
As of lately I’m studying HTML5/CSS/JS and if I got some time I might contribute to the HTML5-part someday…
Oh, and I almost forgot another thing: the “place mouse-cursor on object” (e.g. a button-image as to press a button) doesn’t give a response either in HTML5, unless you “mouse-press” on a certain space upper-left away from it. This also happens when performed in one of the provided button-examples…
Data stored by HTML5 games are not XML files: Instead, the data are stored in JSON, using Web Storage ( en.wikipedia.org/wiki/Web_storage ). That’s why actions and conditions are now refering to structured files instead of XML files in descriptions.
Strange indeed, I will look at it as soon as possible.
Data are not stored in real files ( HTML5 applications do not have the right to write or even read files from the user disk. ): The only way to store data is using cookies or web storage ( which is used by Game Develop HTML5 games: It allows to store a JSON object. When you use a “file” called “save.txt” for example, Game Develop create a json object called “GDJS_save.txt”. This object is stored by the browser and is specific to the website/application ).
Here is an example about how to save and load the position of an object ( Move the object with the mouse, press “s” to save the position, “l” to load the position ) :SaveLoadExample.zip (2.94 KB)
I was forgotten that one indeed cant save files locally. I loaded your example and I got the response CommonDialog-Extension not present, so some parts are missing, but nevertheless I read the storage example an I think I get the point.
Now what if I store the file on a hosting site (maybe even on a local webserver on my computer) with read/write permission, then I should be able to read/write the XML files the notrmal way, should I? (I will try this out anyway).
Even on a “local” web server, there will be not files created: The only way to create file on a server is by using a server side language like a PHP page. And for now, browsers are restricting all web applications for creating any file on the user computer ( for security ) so there is no solution at the moment. ( The only way to exchange files with an user is by uploading them or downloading them “as usual” ).
I wonder… would it be too much work for you to add an ajax-based GET/POST-option to a CGI (bash) shelll script server, that can return data (filename + xml/json values) to be put in the scene-variables (condition/action)? E.g. an experimental cgi.js file that people can extend? Or give hints how to program it oneself? Having access to svr-side-scrpt would definitly boost the html5-version…
What do you think of this idea?
And another question; when adding draggable extension, I can choose the object, but the “choose automatism” option stays empty in html5-version?
And another one: how redefine the visible canvas for a certain screensize?
It should be possible to add GET or POST request but in this case it would be the user responsibility to write the server side script ( Even if I could provide an example script that handle a simple request ).
Where is the problem exactly? Can you send a screenshot as an attachment?
Currently, there is no way to change the size of the canvas, but handheld devices are most of the time setting the zoom of the page so that the entire web page ( i.e, the canvas for the GD games ) is visible. ( Even getting the screen size in HTML5 is not something trivial. You can take a look at the mess related to viewports here: quirksmode.org/mobile/viewports2.html )
“…it would be the user responsibility to write the server side script…”. Most definitely. But then at least you can say that you offer programmers an “CGI-opening” into your program. All the "outside"work is now their own responsibilty. That sounds reasonable. Let’s say that I’m “not completely unfamiliair” with ajax/post/get/cgi & bash shells, and since I’m also studying/practicing html5/css/JS I might start contributing to the html5 part of the game…
Here is a ogv-video of the missing(?) choose-automatism option.
Oh, I get this message from your server: "The extension ogv is not allowed.
Can you point my to the places in your files where I can “play around” with screensizes on mobiles, since most mobile players get the maximum canvas in landscape mode. The point is that auto-zoom seems to work as expected in portrait mode, but in landscape mode it becomes a mess…
Note that to create extensions, you need to compile some C++ code: Read the help file which has a step by step guide explaning how to start.
I’m doing nothing special concerning the canvas size: I just set it to the size request by the game ( See gdjs.RuntimeGame.prototype.createStandardCanvas in github.com/4ian/GDJS/blob/maste … imegame.js ).
Maybe there is a html special tag to ensure that the games are always displayed in landscape mode. I think that if you launch a game on your mobile phone being in landscape mode, the zoom should be ok. Things get worse when you change from/to landscape/portrait orientation during the game.
Pffff, wel I must say that it is indeed extensively documented But I’m only an “occasional scripter” with limited knowledge, just enough to get me going… It would still take me lots of time to understand it and add something usefull in JS. Simple additions is the level I may contribute on as of this moment. But like I said before, if you could provide me an ajax/post/cgi acces-point into the game, then on the back-end I can take it further from there with apache+cgi-bash, with which I have a bit more experience. And there is a lot of (html/xml/json etc) bash-tools/knowledge/skill present on the Internet. But the data must get out first… So, would it be (too) much work to provide a ajax/post/cgi “peephole”?
I’ll probably add actions to send requests in the next version.
( Before doing that, I’m working on improving variables so that we can work with arbitrary structures ( i.e: Variables containing not a number or a string, but containing one or more variables as child ). In my view, this is necessary to do that before adding ajax requests so that we can work efficiently with the data to be sent or to be received ( Typically, a variable being a structure will be able to be converted to JSON or XML and then sent. And when receiving data, you’ll just have to call a function that will register all the data contained into the JSON/XML to a variable structure ) )
Maybe I could also add a special event to add arbitrary Javascript code… That sould be enough for most advanced uses without requiring to write a complete extension.
I’ve added an action to send arbitrary requests ( for both native and HTML5 games ). The next version will also be supporting structure variables ( variables containing other variables ) and I’ll add some utilities functions and actions to convert between structures variables and JSON and maybe XML.
That’s should be enough to send and receive most information you want want to share.