Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Dynamic tweet button, sugarcane 1.42 / can't load new story formats

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

  • Nevermind, got it! At least the code part.
  • edited February 2017
    Since you've apparently solved your code issue, on to your story format install issue.

    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?
  • I've tried Snowman. And I did use the Twine 1 version of SugarCube. It's just not showing in the menu. It's weird. But I solved my other problem, so that's not so important anymore right now :)

    Thanks <3
Sign In or Register to comment.