Explore the community Forums Lectora Lectora Questions & Answers Web window communicate with Lectora course?

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #427774 Score: 0
    Profile photo of CarlFink
    CarlFink
    Member
    beginner
    intermediate
    contributor
    LUC16 Attendee
    wise owl
    curious george
    advanced
    22 pts
    @CarlFink

    Hi,

    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?

    Thanks.

    #427794 Score: 0
    Profile photo of Darrel Somoza
    Darrel Somoza
    Member
    contributor
    friend finder
    beginner
    intermediate
    junior moderator
    advanced
    wise owl
    curious george
    profile
    199 pts
    @Klaatu

    Yes, you can use JavaScript to communicate back and forth.

    #427804 Score: 0
    Profile photo of CarlFink
    CarlFink
    Member
    beginner
    intermediate
    contributor
    LUC16 Attendee
    wise owl
    curious george
    advanced
    22 pts
    @CarlFink

    @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?

    Thanks.

    #427993 Score: 0
    Profile photo of Darrel Somoza
    Darrel Somoza
    Member
    contributor
    friend finder
    beginner
    intermediate
    junior moderator
    advanced
    wise owl
    curious george
    profile
    199 pts
    @Klaatu

    Yes, you can use JavaScript to assign the Lectora reserved variable AICC_Score in a dummy hidden Lectora test..  VarAICC_Score.set(godotScore) if your variable in the Godot content that holds the final score is called godotScore.

    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.

    #428034 Score: 0
    Profile photo of CarlFink
    CarlFink
    Member
    beginner
    intermediate
    contributor
    LUC16 Attendee
    wise owl
    curious george
    advanced
    22 pts
    @CarlFink

    Thanks, Darrel. I’m not ready to actually implement the Lectora–the game isn’t even fully designed yet!

    I also still have to figure out how to set JS variables from within the game. The Godot environment natively supports its own scripting language and C# only.

    I do appreciate the help, and offer of further help, though.

    #429712 Score: 1
    Profile photo of Sergey Snegirev
    Sergey Snegirev
    Member
    contributor
    intermediate
    advanced
    friend finder
    lab member
    junior moderator
    advocate
    LUC16
    LUC16 Attendee
    wise owl
    336 pts
    @ssneg

    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.

    This post has received 1 vote up.
    #429777 Score: 0
    Profile photo of Darrel Somoza
    Darrel Somoza
    Member
    contributor
    friend finder
    beginner
    intermediate
    junior moderator
    advanced
    wise owl
    curious george
    profile
    199 pts
    @Klaatu

    Wow, a Sergey sighting. Long time no see. Hope all is well.

    #429779 Score: 0
    Profile photo of Darrel Somoza
    Darrel Somoza
    Member
    contributor
    friend finder
    beginner
    intermediate
    junior moderator
    advanced
    wise owl
    curious george
    profile
    199 pts
    @Klaatu

    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.

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.