Search Unity

[RELEASED] Scorm 1.2 / 2004 API

Discussion in 'Assets and Asset Store' started by bdovaz, Jan 20, 2016.

  1. Deviarc

    Deviarc

    Joined:
    Sep 4, 2014
    Posts:
    24
    I will send you the project, just need to finish some stuff before. Do you have a specific e-mail?
     
  2. Deviarc

    Deviarc

    Joined:
    Sep 4, 2014
    Posts:
    24
    Ok, I have just builded the API Scene again.
    Looking on the WebConsole I'm getting the following logs, it happens after the Unity Unload Time occurs:

    [SCORM - Error] Unable to find an API adapter scorm.js:318:2
    [SCORM - Error] Could not establish a connection with the LMS.

    Your results may not be recorded. scorm.js:318:2

    [ScormAPI] - On initialized
    (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/WebGL/runtime/DebugBindings.gen.cpp Line: 51)
    0053001e-d0e2-4759-ad7f-67e96ff96d53:2:203981

    [ScormAPI] - LearnerId: undefined
    (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/WebGL/runtime/DebugBindings.gen.cpp Line: 51)
     
  3. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,053
    You have my email in the asset store page.
     
  4. Deviarc

    Deviarc

    Joined:
    Sep 4, 2014
    Posts:
    24
    Ok, I'm following up by email!

    Ty a lot for the help!
     
  5. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,053
    Ok, thanks.
     
  6. Gerfeso

    Gerfeso

    Joined:
    Mar 2, 2016
    Posts:
    5
    I'm getting scorm is not defined error in WebGL Javascript in Console when trying to do ScromAPI.Instance.Init();

    Works fine when running it in Editor.
     
  7. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,053
  8. Gerfeso

    Gerfeso

    Joined:
    Mar 2, 2016
    Posts:
    5
    I think that helped but now I get
    [SCORM - Error] Unable to find an API adapter
    [SCORM - Error] Could not establish a connection with the LMS.
    Your results may not be recorded.
    I've tested both on my moodle hosted site and using the Reload Scorm 1.2.
    I've set the webGL template index.html to be 1.2, set 1.2 in player settings for the WebGL template and the publish settings to 1.2 as well.

    EDIT: Is the only way to init via calling the Init from a button? I tried having the SCORM API init itself in its Awake() but perhaps that is too soon? When is the earliest I can init Scorm?

    EDIT: So I'm following your example script. I've set the ScormAPI on my Canvas GO and my Canvas GO has a script that assigns a button to call ScromAPI.Instance.Init() but it is failing to do so.
     
    Last edited: Jun 7, 2017
  9. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,053
    He finally fixed it, it was a problem initializing Scorm object in Javascript that it was not setting the correct value.
     
  10. mKleinIQ

    mKleinIQ

    Joined:
    May 16, 2017
    Posts:
    10
    Where can I find the ScormPublishSettings in order to create the .zip?
     
  11. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,053
    Have you read the documentation? It's all there. If you can't find it I will help you.
     
    Karessa likes this.
  12. mKleinIQ

    mKleinIQ

    Joined:
    May 16, 2017
    Posts:
    10
    Hi, I have done everything according to the API documentation, but when I launch the build through SCORM cloud, the Unity webgl build only displays a white screen. It seems that it doesn't even load... Am I dong something wrong?
     

    Attached Files:

  13. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,053
    Read previous posts because it's due to a Unity 5.6 that broke templates.

    I have answered to other users about this.

    If you need more help, please say it.
     
  14. mKleinIQ

    mKleinIQ

    Joined:
    May 16, 2017
    Posts:
    10
    Thanks! Got it working. Now I am trying to figure out how you displayed the "Getters" to the console view? None of the getters are returning a string, so how do I assign it to some textbox?
     
  15. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,053
    You have a script in the demo scene, you can see it there.
     
  16. mKleinIQ

    mKleinIQ

    Joined:
    May 16, 2017
    Posts:
    10
    Thanks for the help. I got everything working fine, but now if my game goes back to the main menu and I want to start again, I get a null reference exception on the ScormAPI.Instance.Init(); Is there a way to re-initialize the scorm instance?
     
  17. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,053
    I don't understand, why do you need to call Init method N times? Are you loading other scene and unloading the current one? Try to use DontDestroyOnLoad on the GameObject that has ScormAPI script attached.
     
  18. sen1010

    sen1010

    Joined:
    Jul 18, 2017
    Posts:
    4
    I am getting error on ostynscormtime.js and scorm.js, i am using uinty 5.6, Please help me.
     

    Attached Files:

    • 1.png
      1.png
      File size:
      67.2 KB
      Views:
      950
    • 2.png
      2.png
      File size:
      24 KB
      Views:
      800
    • 3.png
      3.png
      File size:
      22.7 KB
      Views:
      869
    • 4.png
      4.png
      File size:
      24.8 KB
      Views:
      830
    • 5.png
      5.png
      File size:
      28.7 KB
      Views:
      926
  19. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,053
    The provided template must be in "Assets/WebGLTemplates/YOUR_TEMPLATE_NAME".

    Also read this thread because you may find some problems regarding Unity changes in WebGL templates.
     
  20. sen1010

    sen1010

    Joined:
    Jul 18, 2017
    Posts:
    4
    we were able to resolve the above issue, however now we are having another issue. "%UNITY_WEBGL_LOADER_GLUE%" - we get the issue when we run the SCORM package through lms. currently we are using "scorm api unity package"
     
  21. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,053
    That was the Unity breaking change I spoke about in my earlier post. You have some answers in this thread, please read them.
     
  22. sen1010

    sen1010

    Joined:
    Jul 18, 2017
    Posts:
    4
    We tried resolving the error, however now on clicking Init button on Console does not show any Console, also the other buttons shown are still inactive. can we please get some working Scorm sample so that we follow the same steps. i would also appreciate if someone can share their email ID so that we can share the Scorm package for further solutions.
     
  23. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,053
    Have you check with F12 the developer console? What do you see? It should work out of the box if you are able to fix the 5.6 template breaking change.
     
  24. zarnes

    zarnes

    Joined:
    Jan 19, 2016
    Posts:
    7
    Hi,

    I bought your Scorm API for a serious game developpement, everything is working as expected except one thing : I can't retrieve the total time in the game.

    The SetSessionsTime() function works and I can see the sessions duration on the backend of the LMS I'm working on, but when I want to retrieve the duration in the game I always get 0.

    Even on your exemple I get 0. Here is my code logic :
    - Init()
    - GetEntry()
    - GetObjectives() (not really important for this problem I think but I still put it here)
    - The player play the game
    - Set the score and set some objectives
    - GetTotalTime()

    And I added a listener on time retrieving :
    ScormAPI.Instance.OnTotalTimeRetrieved += (time) =>
    {
    text = canvas.transform.Find("Cheater !/Logger").GetComponent<Text>();
    text.text += "time retrieved : " + time;
    ScormAPI.Instance.SetSessionTime(Convert.ToInt32(Time.time - totalTime) * 1000);
    };

    The first line is to find my custom debugger (because I test on webplayer so no debug.log)
    Second line is the most interresting, I try to display the time retrieved but it's always 0, even after some sessions.
    The third line set session time for this session, which works perfectly, I can see the time on my LMS but can't retrieve it in the game.

    I want to retrieve this variable to add it to the total session time, because for this game, only the last session time is not revellent, the total of all lessons time is.

    I even tryed on your exemple scene and it has the same result, always 0.

    I work with scorm 2004.
    My LMS is ILIAS.
    Thanks for reading me and I hope you have any idea about that ! :)
     
  25. sen1010

    sen1010

    Joined:
    Jul 18, 2017
    Posts:
    4
     

    Attached Files:

  26. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,053
  27. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,053
    Try to debug it in your LMS, you should have like in Moodle some tool to see all the data being tracked and all API calls to see if something it's wrong or you are not sending something.
     
    Last edited: Jul 24, 2017
  28. zarnes

    zarnes

    Joined:
    Jan 19, 2016
    Posts:
    7
    Okay I'll see what I can do thanks for you fast reply
     
  29. richi_rish

    richi_rish

    Joined:
    Aug 18, 2014
    Posts:
    5
    I am new to SCROM and LMS.I need to know whether this plugin support SABA ?Let me know ASAP.
    Thanks
     
  30. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,053
    Scorm is independent of the target LMS (if it's 1.2 / 2004 compatible) so it should work.
     
  31. Deviarc

    Deviarc

    Joined:
    Sep 4, 2014
    Posts:
    24
    Hi N3uRo, I'm getting a new error with the package when I try to set the SuspendData.
    I have send you a email with more details.

    Im pretty sure it's something to deal with what I'm sending to the SuspendData, because I'm just sendind a json like string type.

    Do you have any sugestion on what I should try to change?

    Ty for the help!
     
  32. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,053
    Sorry, I'm on vacation.

    It could be related with characters that you need to escape like single or double quotes.

    Check what is done on "CallJavascriptMethod(string methodName, string arg)".

    You can see that it uses double quotes to send the argument so you can do two ghings:
    - Use single quotes to build the json data.
    - Change \"{1}\" to {1}.
     
    Last edited: Aug 11, 2017
    Deviarc likes this.
  33. Deviarc

    Deviarc

    Joined:
    Sep 4, 2014
    Posts:
    24
    I poking around that area already. Tried some stuff but I failed to find the correct answer for the problem.
    Just used the second sugestion but without the '' around the {1} and got it working.

    Ty for the help and have fun on vacation!
     
  34. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,053
    I'm glad that it worked out. I should update the asset providing two alternatives for suspend data. One passing a string with "{1}" and another one passing json with {1}.
     
    Deviarc likes this.
  35. Deviarc

    Deviarc

    Joined:
    Sep 4, 2014
    Posts:
    24
    Yeah, it's a simple implementation and allow for more flexibility without we changing "source" code.

    Another question, one package I need to deliver dont allow for some extensions, like the htaccess, I tested and I can manually delete it and I get only more time on decompressing the data. But if I try to manually delete it on the Scorm Package I get manifest error's. You have any tips on how I should approach this problem?

    Ty for the help!
     
  36. Deviarc

    Deviarc

    Joined:
    Sep 4, 2014
    Posts:
    24
    Just a follow up and for further references, I got it working without manifest errors deleting the htaccess on the zip, without decompressing and compressing it again.

    And thanks N3uRo, just delivered the package to the client and we got it working without any headaches. The plugin works and the support is really good!
     
  37. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,053
    Ok, I'm glad that you sort that out.

    Thanks.
     
  38. hugosrnt93

    hugosrnt93

    Joined:
    Sep 30, 2016
    Posts:
    1
    I have a question this works for unity 2017?
     
  39. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,053
    Of course and if you have any problems post them and I will sort them out with you.

    The only Unity specific problem I'm aware of is the Unity webgl templates breaking change in 5.6 that it's discussed on this thread multiple times.
     
  40. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    363
    Hello.

    I am looking over this Asset as i am trying to implement the TinCan Api into my Unity project.

    My main purpose is to send data to an LRS. Is this something the asset can do?
     
  41. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,053
    With this asset you would be able from your webgl application to communicate with the LMS (uploaded on a zip file to a course) using Scorm 1.2 or 2004. Tin Can API is another thing that it's out of scope of this asset.
     
  42. Deviarc

    Deviarc

    Joined:
    Sep 4, 2014
    Posts:
    24
    Hello N3uRo,
    I'm setting the JSON data and getting no errors now. My problem is that when I get the Suspend Data, I'm reciving a [object Object]. How should I deal with it?
    Any directions where I should be looking?
    Sorry for bothering you with it, but it's my first time doing anything with Scorm and it still don't make a lot of sense yet.

    Ty for the help!
     
  43. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,053
    Do you mean that you get in C# a string that it's content is "[object Object]"? Earlier you made a change to remove the quotes around {1}.

    I think that in your particular case you are storing in the LMS an object and not the string representation of that object (it's what you should save). To fix that you should go to "scorm.js" file, search for "setSuspendData" method and change:

    this.setValue("cmi.suspend_data", data); // In your case data is a JavaScript object

    To:

    this.setValue("cmi.suspend_data", JSON.stringify(data)); // We stringify it so it becomes a JavaScript string.

    This will only work for cases like yours that you are passing a json object to setSuspendData.

    I'm preparing an updated package with all this fixed but I can't say when I'm going to release it so please, apply that fix so you are not blocked by this.

    Note: I don't even know why it's that possible and you are getting a JavaScript object because in Scorm Runtime API it clearly says that is a CMIString (SPM: 4096).
     
  44. Deviarc

    Deviarc

    Joined:
    Sep 4, 2014
    Posts:
    24
    Yes, Im getting a string that is "[object Object]".
    Im logging all the SuspendData operation on console to try to see what's happening. I can send you the package if you prefer.
    But overall when I request a SetSuspendData this is going on:
    1- Serialize my UserData to json, storing it on a string.
    2- Checking for the lenght - This is just to make sure I'm not trying to save more than the 4k characteres.
    3- Replace all the " with ' on the string.
    4- Calling the SetSuspendData with the string I'm manipulating.
    5- Calling for Commit.

    With logging to see what I'm doing:

    Setting Suspend Data: {"IslandProgress":[{"II":0,"IU":true,"A":[]},{"II":1,"IU":false,"A":[]},{"II":2,"IU":false,"A":[]},{"II":3,"IU":false,"A":[]},{"II":4,"IU":false,"A":[]}],"CompletedDilemmas":[],"IntroductionTutorial":false,"FeedbackTutorial":false,"IntroductionComplete":true,"IsInitialized":true}
    This is the json string.

    SD Amount: 280
    The amount of characters inside the string.

    SD String: {'IslandProgress':[{'II':0,'IU':true,'A':[]},{'II':1,'IU':false,'A':[]},{'II':2,'IU':false,'A':[]},{'II':3,'IU':false,'A':[]},{'II':4,'IU':false,'A':[]}],'CompletedDilemmas':[],'IntroductionTutorial':false,'FeedbackTutorial':false,'IntroductionComplete':true,'IsInitialized':true}
    String after I replace " with '.

    Gonna experiment with your fix now.
     
  45. Deviarc

    Deviarc

    Joined:
    Sep 4, 2014
    Posts:
    24
    Okay, I canged back some code.
    Got the "" on the {1} and Im treating the string removing all ".

    I got it working on the Reload Player and looks like I was just complicating the simple stuff.
    Gonna test a little more and understand better what Im doing and I report back.

    Thanks for the help!
     
  46. dradb

    dradb

    Joined:
    Jan 10, 2015
    Posts:
    86
    Did I see the price at $9 just a couple of hours ago?
     
  47. Deviarc

    Deviarc

    Joined:
    Sep 4, 2014
    Posts:
    24
    Hey N3uRo, what I should be using to set the individual player progress? Not the player score, but how far he is in the game so he can see before opening the course.
     
  48. zarnes

    zarnes

    Joined:
    Jan 19, 2016
    Posts:
    7
    Hi, I have another question ^^
    I configured my game to use scorm 2004.
    But when I try the game in LMS, I have an error when Scorm API initialize :
    upload_2017-9-21_16-32-46.png

    When I look on source code I think that the version variable is 1.2 :
    upload_2017-9-21_16-34-22.png

    Is there something I forgot to configure ? :c
    upload_2017-9-21_16-37-12.png

    Thanks for reading c:

    UPDATE : I was able to fix my problem by reimporting old project settings, somthing was messing with scorm API, thanks git ^^
     
    Last edited: Sep 22, 2017
  49. John-Higuera

    John-Higuera

    Joined:
    Oct 14, 2012
    Posts:
    20
    Hello, I would like to know if there is a online demo that we can check and test, another thing is, the result course from this package is compatible with all the web browsers? Thanks a lot in advance for your quick answer.
     
  50. bdovaz

    bdovaz

    Joined:
    Dec 10, 2011
    Posts:
    1,053
    You have an online example of the first post of this thread.

    It should be compatible with all web browsers, I don't do anything specific to a web browser in particular.