G'day Everyone,
In our story the reader accumulates certain values for a set of variables. At the end of the story we want to use these values to create a JavaScript chart. We are having problems passing the variables values that are in our twine story to a JavaScript function for creating the graph.
We are using Harlowe in Twine 2.
In the HTML we are including the following:
This is calling a JavaScript file with the following code:
In the head we are also defining jsVar:
This JavaScript file is a separate file that we are linking to in the head of the Twine HTML file, because we couldn't figure out how to call JS functions using the Story JavaScript stuff in Twine.
We are getting an alert that says "HelloUndefined". We would love some help in defining jsVar! Much appreciated.
Regards,
Adam and Carly
In our story the reader accumulates certain values for a set of variables. At the end of the story we want to use these values to create a JavaScript chart. We are having problems passing the variables values that are in our twine story to a JavaScript function for creating the graph.
We are using Harlowe in Twine 2.
In the HTML we are including the following:
<button onclick="myFunc(jsVar)">Push Me</button>
This is calling a JavaScript file with the following code:
function myFunc(jsVar){
alert("Hello" + jsVar)}
In the head we are also defining jsVar:
<script>var jsVar = $values</script>
This JavaScript file is a separate file that we are linking to in the head of the Twine HTML file, because we couldn't figure out how to call JS functions using the Story JavaScript stuff in Twine.
We are getting an alert that says "HelloUndefined". We would love some help in defining jsVar! Much appreciated.
Regards,
Adam and Carly