Hello, I'm trying to add a dynamic tweet button for my sto
ry. Just one that will list some stuff and open the twitter share URL.
Unfortunately I can't seem to add proper scripts?
Here is my stuff inside of the passage:
<script>
document.getElementById("myBtn").addEventListener("click", function(){
var phrase = document.getElementById('result').innerText;
var tweetUrl = '
https://twitter.com/share?text=' +
encodeURIComponent(phrase) +
'.' +
'&url=' +
'
http://www.cookbooktitlegenerator.com/';
window.open(tweetUrl);
});
</script>
<div id="result">The Offbeat Appliance Guide to Food Avoidance</div>
<button id="myBtn">Tweet it!</button>
Right now it doesn't do anything when I'm clicking the button. Am I doing something wrong? I also tried using <<script>> instead, but that didn't work, since it told me that it's not a macro.
I then thought maybe my story format (Sugarcane) doesn't support it? So I wanted to change to sugarcube. I downloaded it and extracted it into the targets folder. I did everything like in the instructions, but in Twine it doesn't show. I tried with a different custom story format, but it didn't show either.
I'm a bit frustrated, because I'm so close on finishing this game, but really need this dynamic tweet button.
Please help?
Comments
For SugarCube, did you download the version for Twine1? The Twine 2 version will not work in Twine 1 and vice versa.
Which other custom story format did you try?
Thanks