Word/Phrase Detection - is it possible?

Jul 26, 2016

Hi folks

 

I've had an idea but I'm not sure it's do-able?  I want my users to search through the game scenario and then record all their findings .  I've created the Lightbox slide and included a Text Entry control. 

 

However, I want the scoring system to detect words or phrases typed within the Text Entry and apply a score for each word identified.

 

Hope this is making sense?  As an example, I'd like the user to identify and record in their findings 'no key for the filing cabinet'. This will be free text, so it's unlikely that each user will record the exact same sentence.  But if they include words 'key', 'secure', 'cabinet', 'lock' etc, then I'd like it to be included in the score.  

 

I've set up the variable to accumulate the score,  but I'm now stuck trying to figure out how to detect these individual words/phrases within the Text Entry control.   Is it possible? 

 

jo xxx

19 Replies
Jo Lamontagne

Matthew, you a SUPERSTAR!!!!

 

I've spent all morning trying to figure out javascript after realising there was no feasible way of doing it using variables.   This has worked wonderfully!!

 

If I want to include additional phrases, do I simply copy this section:

 

var pos = text.toLowerCase().indexOf('cabinet');
while (pos !== -1) {
score++;
pos= text.toLowerCase().indexOf('cabinet', pos + 1);

 

and replace the word 'cabinet' with 'breach' for example?

jo xxx

 

Jo Lamontagne

Me again Matthew!

 

I've had one JS problem...that I've spent a couple of hours trying to resolve myself...that still foxes me :).

 

Every time the user returns to the Notepad lightbox slide in order to enter more 'findings', the user clicks in to the TextEntry field to show the cursor at the end of the entered text, but all entered text is now selected/highlighted.  The problem here is that, if the user doesn't realise the previously entered text is now selected, they press a key and all that data is removed from the field.

 

I'm trying to find different code to resolve this issue, but I'm wondering if I'm setting the 'Execute JavaScript' trigger correctly?

 

Action: Execute JavaScript

Script

function addEvent(elem, event, fn){
if(elem.addEventListener){
elem.addEventListener(event, fn, false);
}else{
elem.attachEvent("on" + event,
function(){ return(fn.call(elem, window.event)); });
}}
var element = document.getElementById('el');

addEvent(element,'focus',function(){
var that = this;
setTimeout(function(){ that.selectionStart = that.selectionEnd = 10000; }, 0);
});

When: User Clicks

Object: Text Entry Notepad

 

I'm wondering if the trigger is the reason why the different JS options aren't working as I'm hope they would.

 

Any ideas how I can resolve this?

 

xxx

 

 

 

Jo Lamontagne

Thanks Matt

 

I've also encountered one more issue...can you believe it...when I review the published content through the 'View Project' option on Storyline, the scoring system works perfectly.  Yet, when I load it on to the company's LMS, the score is not working.  I've tried this using both IE and Chrome browsers but neither are showing a change in the score.  The project has been published using SCORM 1.2 as per the requirements of the LMS.

 

Although I've tried loading this on to the free SCORM Cloud, the project file is not loading on there accurately.  Would you mind checking to see if the file opens when you attempt it?

Jo Lamontagne

Thanks for looking in to this for me Phil

 

I will amend the publish set-up so that it collates using the results slide.  However, I'm actually concerned that the scoring doesn't increase within the module - either when the user types their findings in to the notepad or when they show the final score on the summary slide. 

 

Meanwhile, I will ask the question of the cross domain for the LMS to our LMS account manager.  We use LMS provided by a firm specialising in the retail finance industry, so it's not an immediately recognised provider.   Fingers crossed that provides the answer I need about the scoring.

Final question for you Phil...did you identify where javascript might improve the notepad so that it doesn't auto-select the text when the user clicks in to the TextEntry field?

 

jo xxx

Phil Mayor

The only reason I have seen where the javascript does not work in the LMS is if the Scorm is installed cross dominant the javascript gets blocked.

You will need some additional javascript to set the score inside of Storyline as you cannot adjust the built in results variables

The autoselect is a "feature" of storyline perhaps you could use a concatenate instead so it adds a new feature to the list instead.

Jo Lamontagne

Hi Matt

 

You're right!  That's the issue I'm experiencing when I load it on to the LMS.  Phil also reviewed the file and said that the scoring was working fine when he reviewed it, so suggested there might be a problem if the SCORM is installed cross dominant and therefore may be blocking the javascript.  I'm yet to hear from my LMS account manager to find out if this could be the issue.

 

Meanwhile, I see now that Phil has included his shared file.  Let me see if this helps...

 

Thank you both for looking in to this for me.  Honestly, I'm amazed by the help and support this forum provides.  You're all heroes!

xxx

Jo Lamontagne

Me again!

 

Okay, so I've been investigating the cross-domain problem and this does look to be the culprit that's affecting the blocking of my javascript.

 

So, I've been googling for some ways to resolve this and they suggest amending the domain name through the url.

 

I'm so sorry to ask this question, but where would I find the url/server information in the SCORM manifest?  I've loaded the published zip on to my lms and this is the url that plays the module:

https://nottingham.e-learningportal.com/courses_scorm/24DAC29B-EC38-2308-DACAE84A97AF4B60/index_lms.html

 

Unsure what to do or where to go next! xxx

Jo Lamontagne

Great news!!

 

I asked one of our web developers to take a look at my coding.  He went through the local output and reviewed the content when viewed from the lms.  He established that, when reviewing locally, it runs the story.html file.  This file includes the coding set out in the Text Entry field.

 

Yet, the lms runs the index_lms.html file an for some reason the javascript was not embedded in to this file.  He suggested that if we rename the second file to include the wording 'backup' or 'original' and then rename the story.html to 'index-lms.html', then the lms will run the file that works correctly.

 

I've tried it and the Points variable works.  Matt Bibby suggested that some of the functionality may be compromised using this solution, so I'm keeping an eye to it. 

 

Thank you Matt and Phil for taking the time to investigate this one for me! xxx

Jo Lamontagne

I did Matt, and technically, 'yes' it is communicating.

 

However, at the minute the Points variable is only set to show the user their score after completing the challenge.  The score is not recorded anywhere on the lms for reference.

 

However, the content author has now set another challenge.  As well as accruing points for whenever a keyword is captured, could we record a result on the lms that shows however many dpa breaches were addressed?  There are 6 different breaches that need to be identified, but some of the keywords overlap. e.g. If a user types 'information', it could be relevant to 3 of the 6 specific breaches. 

 

My new challenge is to develop another variable that triggers each time they address a breach.  I'm thinking if I use TRUE/FALSE variable.

 

Once I create this particular part of the triggers, I will load the full content on to LMS using the new workaround and see if the functionality still works properly.

 

Wish me luck! xxx

Jo Lamontagne

I've just had a look when this discussion was first raised...27 days ago.

 

Matt Bibby has spent countless hours looking in to this issue, finding solutions for any set backs and working with my inexperience.

 

The resulting activity has the stakeholders VERY happy.  The content is there, the interactivity is there, the evaluation process is there.  Matt, thank you very much for spending nearly a month working to get this published and ready for sign off 

Your daily blog posts that I've subscribed to have also helped me improve my knowledge.  I'm going to try the updating hyperlinks today! xxx

This discussion is closed. You can start a new discussion or contact Articulate Support.