So I'm INCREDIBLY new to sugarcube, and I've been poking about the tutorials like a mad woman for a little while now- the issue is I'm getting a whole string of pieces of code; But I haven't the slightest idea on how to string them together to get them to do what I want. And I'd very much appreciate any help on the matter.
Here's the concept I'd like to do. When a player selects a choice using THIS
<span id="message">
<<click "Click this to see a message!">>
<<replace "#message">><<print "A message!">><</replace>>
<</click>>
</span>
I would like the 'A message!' to use the transition pulse (that's the code (t8n: "pulse")[This text will pulse] ) and when the pulse animation has finished, transfer the player to another page.
Is this even possible?
Comments
As a tangent on tutorials, and with no offense to the authors intended. I've not been excessively impressed with most of the tutorials I've seen thus far—especially those on YouTube. Many make basic errors that are never going to be corrected, which only serves to confuse and/or mislead. YMMV.
Now, as to your question.
Try something like the following CSS: (goes in Story JavaScript)
And either this markup, using HTML tags—as that's what your example used:
Or this markup, using the custom styles markup:
In both markup examples:
The Any dynamic text effect macros for Sugarcube 2.x? thread may help you with converting some of the standard Harlowe stylings over to SugarCube. I recently added CSS to emulate the base (transition: "pulse") effect.
Once you have added the required CSS to your story the following should do what you asked. note: you don't need to use a <<print>> macro within the <<replace>> macro to get standard (or custom styled) text to appear.
I didn't realise the versions were so diverse! It looks like my version is 2.0.11 (Offline version), sorry if that caused any confusion! This is my first project, and well, I have some big, ambitious ideas. To be honest, I've found the Harlowe youtube tutorials quite helpful- But the Sugarcube ones just don't work, and the ideas aren't well explained. But I digress-
So I put the CSS code into my Story Stylesheet (heh, heh, typos..) and entered in the code for the custom style markup you provided. When I tested it, though, it flashed up an error sign for one second before moving to the linked page. I removed the timer line to get a better look at the error message, and this is what it displayed.
#message;Click this to see a message!
Error: <<replace>>: no elements matched the selector "#message"
Error: macro <</link>> does not exist
So I plugged in your html piece of code- But it redirected me to the other passage.
Am I just shootin' for the stars here? If it's impossible, I really wouldn't want to waste someone else's time on something impossible!
@greyelf
I opened up the wiki link- but the CSS coding did not include the pulse animation portion, so I kept the CSS stylesheet that TheMadExile provided, and tested the portion of code you provided on a blank passage. It displayed this error;
Click this to see a message!
Error: <<replace>>: no elements matched the selector "#message"
Error: macro <</link>> does not exist
If I'm aimin' too high here, don't be afraid to tell me it's impossible! I'd hate to waste someone's time!
Can you post your code? It sounds like you missed something.
The link I included in my previous post was to a Twine Forum topic, the CSS for the pulse animation is in a separate comment at the current end of the thread.
I tested the CSS and example in that tread in both SugarCube 1.x and 2.x before posting it. I tested the <<link>> based example in my previous comment in SugarCube 2.12.1
The following is a <<click>> macro based example that works using any recent version of SugarCube 1.x or 2.x
Twine 2 v2.0.11 only comes with SugarCube v1 preinstalled, which why the examples did not work correctly.
I strongly suggest switching to SugarCube v2—either by switching to the current release of Twine 2, which is v2.1.0 and comes with both versions of SugarCube preinstalled, or by installing SugarCube v2 manually, instructions for which may be found within the SugarCube 2.x in Twine 2 guide on its website.