Howdy, Stranger!

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

Differences between harlowe and sugarcube macros

Hello!

I'm making a game (hopefully a full one) on Twine and started in Harlowe. However, as the game is getting longer and longer, I see Sugarcube may be better now, as I can change the CSS for each passage and have a save for my game. However, I'm lost with the differences between them, and I can't find help with these things anywhere. Hopefully someone can help me!

1 - Harlowe's set

In Harlowe I can make "(set: $sentme to (text-colour: "#138808") )" and then use the $sentme [] to make the text green. This is a huge help. Does sugarcube have something similar?

2 - Timing macro and hook

I use a combination of hook and timing macros to give conversations some dynamism in the game. I can't find anything similar to it in Sugarcube. Here's a full example of a whatsapp conversation, where a "carolin is typing..." take place before the actual answer and the "So you" is another passage:

|answers1>[[• "So you can't call me sleepyhead, can you?"]<answer1|
[• "Oh, alright then."]<answer2|
[• "Why were you so tired?"]<answer3|
[• "Did you dreamt about me?"]<answer4|
[• "Don't answer"]<answer5| ]

{
(click: ?answer1) [
(replace: ?answers1) [ $sentme ["So you can't call me sleepyhead, can you?"] ]
[$typingtext [Carolin is typing...] ]<ctm|
(live: 4000ms) [
(set: $elapsedtime to (round: time / 100) )
(set: $typingtime to $typingtime - $elapsedtime)
(if: $typingtime = 0) [
(replace: ?ctm)
[ (display: "So you") ]
(stop:)
] ] ]
}

3 - Installing macros

...really, I can't find a single tutorial about installing macros for sugarcube on twine 2. Please guys?

I REALLY hope I'm not being a burden, it's just a lot of things to wrap my head around in this change of formats. A giant thank you in advance!

Comments

  • edited July 2015
    With SugarCube you generally define css classes. So you might write <span class="greenish">This text is green.</span> Then in your passage you'd write something like:
    .greenish {
    color: #138808; 
    }
    

    If you really didn't want to write out that <span>, you can also put it in the widget passage as something like:

    <<widget "greentext">><span class="greenish"><</widget>>

    Then you'd write in game <<greentext>>This text is green.</span>

    You should be able to do the second using the <<timedcontinue>> macro as part of the replace macro set available on the SugarCube website.

    To insall macros you just paste them into the story javascript area.
  • You didn't say which version of SugarCube you're using, so I'm going to assume your using 1.x. Don't. You're better off with SugarCube 2.x for new projects (see: SugarCube 2 install instructions for Twine 2).

    Also, to be fair, I should point out that a save mechanism has come/is coming to Harlowe.

    west wrote: »
    1 - Harlowe's set

    In Harlowe I can make "(set: $sentme to (text-colour: "#138808") )" and then use the $sentme [] to make the text green. This is a huge help. Does sugarcube have something similar?
    SugarCube uses standard CSS. So you'd define something like the following in your Story Stylesheet:
    .sentme {
    	color: #138808;
    }
    
    Usage (custom styles markup and HTML markup):
    @
    
    <span class="sentme">This is "sentme" text using HTML markup.</span>
    

    west wrote: »
    2 - Timing macro and hook

    I use a combination of hook and timing macros to give conversations some dynamism in the game. I can't find anything similar to it in Sugarcube. Here's a full example of a whatsapp conversation, where a "carolin is typing..." take place before the actual answer and the "So you" is another passage:

    […]
    The following SugarCube 2 example should be roughly similar to what you were doing in Harlowe (see the footnotes for additional details).
    @
    
    1. I have no idea what $typingtext was supposed to represent, so I simply made it italic.
    2. I have no idea what the initial value of $typingtime was, so I simply used a static delay of 4 seconds.

    west wrote: »
    3 - Installing macros

    ...really, I can't find a single tutorial about installing macros for sugarcube on twine 2. Please guys?
    Macros go in your Story JavaScript. That said, what macros are you trying to install and where did you get them?

    Claretta wrote: »
    If you really didn't want to write out that <span>, you can also put it in the widget passage as something like:

    <<widget "greentext">><span class="greenish"><</widget>>

    Then you'd write in game <<greentext>>This text is green.</span>
    You cannot, actually. The raw HTML formatter does not allow invalid markup, which is what you've created by splitting the opening and closing tags of the <span> between constructs like you have.

    The best thing to do here would be to use the custom styles markup as in my example above.
  • Thanks, Claretta!! The <span> part is really helpful, it's going to help me a lot! Thank you a lot!!!

    I'm trying to make the second part happen but I can't seem to make any macro combinations. Currently, to simply substitute 4 alternatives to a print of the next passage, I'm trying this:

    • <<choice "Good morning to you, too.">>
    • <<choice "(Say nothing)">>
    • <<choice "Of course, babe.">>
    • ( <<click "Yes, I will">> <<print formal answer 1<<choice "Yes, I will.">> <<endclick>> )

    ... where "formal answer 1" is the next passage and "Yes, I will" is the frase on the click button. What am I doing wrong here?
  • Hey, MadExile! Sorry I commented without talking about you (I left the page open while trying to resolve things in Twine, so I kinda lost the track of time).

    The custom styles markup is really useful, I think it's better than Harlowe's set, as I can use the same style for the whole game. I'm going to try you solution for the timed replace now! And I'm trying to install the Combined Replace Macro Set. I copied it into the project's script but isn't working (even Leon's standard example, with the house, is not working on my Twine, even with the imported HMTL.
  • edited July 2015
    west wrote: »
    And I'm trying to install the Combined Replace Macro Set.
    Are you using the appropriate SugarCube version?
  • west wrote: »
    And I'm trying to install the Combined Replace Macro Set.
    Are you using the appropriate SugarCube version?

    I'm using the 2.0! I didn't thought it would be a problem.

    And I just saw the thread about the save game on Harlowe. That's amazing news, really. (especially for those with long games)
  • Sorry, poor wording; that's not what I meant. I mean, are you using the version of the Combined Replace Macro Set that is compatible with SugarCube 2?

    If not, then you can find it on SugarCube 2's website (under Downloads > Add-ons > <<replacelink>> macro set).
Sign In or Register to comment.