Hi, beginner here, so please bear with me. I’m writing an open-ended exploration game in Sugarcube that lets the player keep a journal of the things they discover using a textarea macro. Right now, I’m trying to use a variable ($DailyJournal) to contain the last journal entry that the player wrote, then using a link macro to append that variable (plus html formatting) to a second variable, $GlobalJournal, which contains all of the journal entries the player has written. In turn, I’m passing that variable to the div containing the journal.
Unfortunately, instead of getting the journal entries the player has written in order, I just get whatever the current value of $DailyJournal is, duplicated x however many entries the player has written. Is there a way to append the current value of a variable to another variable as an unchanging, static string? If not, is there a better way to do this?
Code follows. Thanks!
::StoryInit:: <<set $DailyJournal to ''>> <<set $GlobalJournal to ''>> <<set $DiscoveryName to ''>> <<set $Discovery to ''>> ::Cabin:: You're sitting at your cabin, dreaming of adventure. What do you do? [[Read your journal|Journal]] [[Go have an adventure!|Adventure]] ::Journal:: You take your journal down off the shelf and open it. <div id="MyJournal">My Journal: $GlobalJournal</div> [[Back|Cabin]] ::Adventure:: <<silently>><<set $Discovery = either("mountain","forest","sea","cave")>><</silently>> After a week of exploring, you discover a new $Discovery. What will you name it? <<textbox "$DiscoveryName" null "Writing">> [[Continue|Writing]] ::Writing:: Write about your adventure in your journal. How did you discover $DiscoveryName? <<textarea "$DailyJournal" null "Cabin">> <<link "Now back to your cabin" "Cabin">><<set $GlobalJournal += "<h2>$DiscoveryName</h2><br>$DailyJournal<br>">><</link>>