Something I have never done, but it has come up for a new project I’m working on. I’m developing a training game using a game development tool (Godot). Godot can export to an HTML target, which I could then import into a web window. Is there any straightforward way for the web window to communicate with the course? At a minimum, to send a Boolean indicating that the student passed or failed, so the course can tell the LMS?
@klaatu, like I say, I have not done this. Do you mean that JS in my game could set a variable which would be visible to the Lectora course’s JS, which in turn could set a Lectora variable that I could then test to determine pass/fail? Or would JS in the web window be able to directly set the JS equivalent of a Lectora variable?
This is an over simplification, you still need to set up a dummy test in Lectora and if memory serves me correct, you might have other default Lectora test settings that need to be adjusted (perhaps include test score in overall score needs to be unchecked because there is no (Lectora) test score?)
If you have a sample, including the Godot content authoring files, time permitting I will try to work on it. No promises though as I am busier than a long tailed cat in a room full of rocking chairs.
1. Yes it is possible to communicate from a web window to the parent Lectora page.
2. Yes it is possible to use JS in your web window to alter a Lectora variable.
3. Depending on whether the contents of your web window is hosted with the course or remotely, communication approach will vary. Locally hosted content can directly access parent window variables. Remote content will not be able to do so. You will have to set up communication using postMessages. In short, the web content will send postmessages to parent Lectora page, and a local script in the parent page will catch those messages and act on them, e.g. change Lectora variables. Generally speaking, the latter is the “correct” way of doing this even if your web window content is not hosted remotely.
I would suggest that prior to building out your game that you first construct a very very simple test (Godot web window button changing lectora content and vice versa maybe?) just to get your Godot content to communicate with Lectora.