Forum Discussion
Assessing Text Entry data fields
Hi Kaylee,
First, I'll preface the following with "I have ZERO Javascript knowledge". However, I have been curious about whether something like ChatGPT could help me accomplish things in Storyline that were previously beyond my ability. Your question was a great opportunity to test it out!
I asked ChatGPT to generate javascript code for Storyline that would assess a text string and then assign points based upon length of the string (1 point for 1-2 characters, 2 points for 3-4, etc.). I then also asked it to add a point for the presence of a symbol and another point for the presence of a Capital letter.
And...the code didn't work.
I had to do a little sleuthing and discovered that ChatGPT wasn't quite following Articulate's recommended best practices for javascript. As I stared at the code I noticed, for example, that ChatGPT's initial code was using something called SetVar. However, Articulate's best practice page says to use player.SetVar. So I copied that paragraph from Articulate's best practice page and asked ChatGPT to alter the code based upon that paragraph.
And...the code still didn't work. But, I was closer!
I started looking at other examples of javascript code. For example, Zsolt Olah has shared this wonderful course on Javascript in Storyline.
As I looked at Zsolt's examples, I noticed that many of his code snippets started with var player = GetPlayer();
ChatGPT hadn't put that in its code for me. So I said "Hey, ChatGPT I think we need this code at the start" and ChatGPT responded "You are correct, we do". So the code was added and...
It worked!
I've created a quick mockup in Storyline for you and am attaching it here. Password assessment is likely more nuanced than this and you'll probably want to adjust it, but I think it's a fun proof of concept and hopefully a good starting point for you!
Mike
- KayleeBorger5502 years agoCommunity Member
Thank you so much! I thought about trying to work with ChatGPT but this is perfect! Thank you for this base, I will be able to edit from here :)