4 Replies
Phil Mayor

have you tried adding alerts to see where it is breaking?

I would expect it is this line

var s = fso.OpenTextFile("T:\\HR\\Folder\\SubFiolder\\Sub Folders\\results.txt", 8, true, 0);

As I think in javascript you can only access the client side and not the server when run in the intended environment.

 

Dave Cox

It is kind of hard to know what you are doing with what you've posted here.

"var name = player.GetVar("Name"); " will work fine if you have already set the statement "var player = GetPlayer();

Either way, this function returns the variable "Name" from the player. Have you created the variable Name in your project in the variables panel?

The statement "document.getElementById("score").setAttribute("value", "score");" get an html element with the ID of "score", and sets its attribute value to the value of the variable of the variable "score". This would be a variable in your html code, not in the player. Is that what you wanted? (Id of score and a variable named score are not the same). If you wanted to set the value of "score" in the player, you need to use SetPlayer();

In Storyline, %TXT% displays the storyline variable TXT. Is this variable set in the variables panel?

Try adding a statement to produce output at the console. This way you can see what is happening as your code runs. For example, after you run var name = "player.GetVar("Name");" run the statement 'console.log("Name " + Name);' This will print the Name variable to the console.

When you run your project, Press F12 to open the debug window, and select the console tab. The you can see the messages that are sent to the console.