Quantcast
Channel: Help! with 2.0 - Twine Forum
Viewing all 1844 articles
Browse latest View live

Showing a link between passages in storyboard without actually creating a clickable link?

$
0
0
Good evening,

I'm using JavaScript to move from passage to passage, but I'd like to be able to show links in the storyboard without them showing up in the passage. Right now I'm doing a workaround like:
This is a random passage. <Destinations>[[one]] [[two]] [[three]]</Destinations>

And then I have some CSS like:
Destinations { display: none; }

I'm wondering if there is possibly a more elegant way? I started digging into the Snowman source code a bit.

Also, as an aside, I've been having very good luck using custom tags and then matching them with JQuery and replacing them with richer "components".

Complicated if-else statement

$
0
0
Hey there, I'm pretty new to twine and I had a question on whether or not it's possible to create an if-else statement that takes into account some rather complicated variables or if I should find a workaround.

From what I can tell it's not possible to include multiple if's or else's within the same if-else statement, so I thought I'd try making two different ones. At it's most basic, it looks like this:

<<if $seen_2 eq "yes">>Text description if you've seen passage 2
<<else>>Text description if you haven't seen passage 2
<<endif>>

However, I'd like to make it so that if you haven't seen passage two but have seen at least one of two other passages that it will display different text. So I tried inserting another if-else statement, but I can't seem to get any sort of 'unless' statements to work. It looks like this:

<<if $seen_4 or $seen_5 eq "yes" unless $seen_2 eq "yes">>Text description if you've read 4 or 5 but not passage 2
<<else>>Text description if you haven't read passage 2 but have seen 4 or 5
<<endif>>

If anyone knows the correct syntax to get this all to work in one passage then I would be very grateful. Otherwise I might see about getting it to lead to one other passage so I can do what I want.

Passages won't auto-create - Help needed

$
0
0
I saw on a tutorial video that when you make a text link in your passage, and the passage link hasn't already been created, it will automatically create it for you. Of course, I can make the passages myself, but it would make it way faster if it automatically made it itself and every time I do close the passage, it doesn't create them automatically, it just has an arrow pointing to a red X. If there is nothing you guys can do, thats perfectly fine, I'll just use the + Passage button, I was just wondering if this was removed in a recent update, or different in the client, or anything like that. Thanks!

Call an object method with a widget argument

$
0
0
I have several things such as the height and hair color that the player can set about the PC from a pre-defined list. Those lists use a basic setup. They are a link that replaces an above span with a phrase describing what they've picked. Basically it's getting to the point of being somewhat hard to figure out what I'm looking at, and I'd like to make all that into a widget. I believe the following should mostly work.
<<widget "pcConfigLink">><<link $args[0]>><<set $playerCharacter.$args[1] = $args[2]>><<replace ".pc"+$args[1]>><<pc+$args[1]>><</replace>><</link>><</widget>><<widget "pcConfigLink">><<link $args[0]>><<set $playerCharacter.$args[1] = $args[2]>><<replace ".pc"+$args[1]>><<pc+$args[1]>><</replace>><</link>><</widget>>

I would be able to call it for example with:
<<pcConfigLink "Towering" Height 4>>

However it's not liking $playerCharacter.$args[1] for some reason. Any suggestion on how to get this working?

missing ) after argument list and unexpected token

$
0
0
I am using Harlowe 1.2.4 and Twine 2.1.3 and I'm getting an error on several mobile devices, the error (alert) is: "missing ) after argument list", while on other devices "Unexpected token =>". I believe that the issue is from the code below, the error didn't came up when I excluded this passage, however everything seems fine to me. Any solution or suggestion?
{   <div class="container home-menu">
    <div class="row content-1">
        <div class="col-xs-12 text-center">
            <!-- Menu -->
            <img style="height:90px;" src="res/images/splash_logo.png"/><br>
(unless: (saved-games:) contains $_autosave_slot and (datavalues: (saved-
games:)) contains $_autosave_filename)[(goto: $_start_passage)]
}''<span class="home-button">[[New->$_start_passage]]</span><br>
<span class="home-button">(link: "Continue")[(load-game: $_autosave_slot)]
</span>''<br><a href="#" onClick="closeMeNow();" class="home-
button">Exit</a>
            <!-- Credits -->
<div class="bottom-links"><a href="contact.html"><span style="color: 
white;">some text</span></a><br>
            <a href="credits.html"><span style="color: white;">some text</span></a></div>
        </div>
    </div>      
</div>
<script> function closeMeNow() { navigator.app.exitApp();} </script>

Right and Wrong answers in SugarCube 2

$
0
0
So im trying to make it where there's a keypad that has the code 9-4-6-2, I want the player to input the code into a textbox. If the player gets it right, he/she will get sent to a specific link. But if they get it wrong it will say Incorrect or something like that.

Can't remove default hover over link styling.

$
0
0
Hey everyone!

I'm on SugarCube 2.18, Twine 2.1.3, and I can't seem to remove the default effects when hovering over links.

This is my css for the links:
a {
  color: DarkSlateGray;
  border-bottom: 1px solid DarkSlateGray;
}
a: hover {
 text-decoration: none;
}

I'd like to have the links not change at all when mousing over them. "text-decoration: none" doesn't seem to do anything. If anyone has any idea what I'm doing wrong, it would be much appreciated. :)

double brackets now create broken links

$
0
0
I have been using Twine 2.1.3 online version on my chromebook (chrome browser) and Twine 2.1.3 windows version on my windows desktop. I have been exporting and importing the document via google drive. This has worked well for several days but today the file has started to misbehave on both versions of Twine.

Now when I try to create a passage using double brackets (e.g. [[test]]), Twine creates a broken link and no new passage. If I click the big "+passage" button, and manually name it the name I am trying to link to, the link works correctly.

Any suggestions on what went wrong or how I can get my file working correctly again?

Thank you!

How to disable em-dash in SugarCube?

Sugarcube - Passage Link that just changes variable

$
0
0
Imagine you're programming a store. You have a passage named [[Store]] and maybe five items for the player to choose from to buy.

So you have options to buy [[Lamp]] or [[Table]] or [[Microwave]] but you have to create a passage for each item you buy, when really all you need to do is <<set $itemBought to "Table">>. And you don't need to have the "You've bought the BLANK" in multiple passages, so the literal buying passage would just be

<<set $itemBought to "Table">>
<<goto YouHavePurchasedSomething>>

Now, two lines of good doesn't need a passage, and if your store has a lot more than just five items, making a passage for every single one is beyond tedious. Is there a possible way that when you have a multiple links for [[Buy the BLANK]], clicking it just changes a variable?

I would imagine it to be something like [[Buy the Table|<<set $itembought to "Table">>]], but all that does is create a passage titled <<set $itemBought to "Table">>, and I don't know where the passage destination would fit into that. A different macro might be needed.

Any help is greatly appreciated.

Twine Crashes On Start

$
0
0
Hi all,

I have recently downloaded twine 2.1.3 for Windows (32-bit). After I have installed the file and try to open it, Twine crashes immediately and I am given the error "nwjs has stopped working". I have been unable to find a solution anywhere so if anyone has any ideas, I would be very grateful - I am desperate to use it!

In case it is of relevance, my Laptop is running Windows Vista 2007 service pack 1 (is this the issue????). I have tried reinstalling the download multiple times but it still does not work.

Any help would be much appreciated

Thanks!

How to do character creation in SugarCube

$
0
0
Hi there!
I'm really new to SugarCube and twine... or programming in general and I have a few questions. Mainly about character creation.
Now, I don't want to make something super fancy, but I'd like the players to be able to choose things like their race, hair color, eye color, etc.
Sadly I don't really know how to do it. I have a rough idea, but I don't really know how to work with array's and variables.
How would for example letting the player choose their eye color look like?
Thanks a lot in advance^^

Twine 2|Harlowe 2.0.1 - Problems with coding another mini-game...

$
0
0
Okay. Here's the thing. I'm trying to get this frankly simple word game based on Last Letter/Shiritori programmed, and I'm having obscene numbers of problems with it. Most of it, I'm sure I can work out with a (few) good nights' sleep and some serious poking. However, I'm running into the same problems over and over again, so I'm going to dump this out here and see if anybody is willing to help me figure out at least a small part of it. (I'm not giving up and dumping my programming problems on the forum, I'm just sticking it out there to see if someone can figure it out faster than I can. (I'm sure someone can. I'm not really that great with programming. Only been doing this for half a year. Sporadically, at that.))

What I have so far are two passages, a bunch of arrays (one of which is my '$All_Words' array, and then there are the two sets of alphabetical arrays ('$Word_Starts_A' and '$Word_Ends_B' (and all the other letters involved))), three so-to-speak AI characters, and the player character.

All of the arrays are in the first passage, and that's about it. This passage is, however, set to (display:) the second passage.

What I'm trying to do is have Richter's "Catch" (which is the word that starts the game in-story), when clicked, start a timer. Which it does. The nifty little line of code below works perfectly.
(text-color: red)[|Begin>["Catch."]](click: ?Begin)[(live: 1s)[(set: $tick to it + 1)]]

Once the timer starts, the game pops up three options randomly chosen out of the '$All_Words' array for the player to (possibly) click on to add to the list of words. I had this working, but then re-did my arrays and basically stripped out all of the original coding, so... I need to fix that. (I will probably do so tomorrow on my lunch break.)

It's the stuff that goes along with that timer that doesn't want to work. Namely, me trying to get one of the 'AIs' to put up a word after x seconds. And this little piece of code is... not working. To say the least.
|Catch_Game>[]
(set: $Catch_Word to (either: ...$Word_Starts_H))(set: $Player to (either: "Richter","Aster","Marta"))(set: $Catch_Post to 1 + (either: 1,2,3,4,5,6))
(if: $Catch_Post equals $tick)[(append: ?Catch_Game)[(if: $Player is "Marta")[(text-color: yellow)["$Catch_Word"]](if: $Player is "Aster")[(text-color: green)["$Catch_Word"]](if: $Player is "Richter")[(text-color: red)["$Catch_Word"]]]]

All of the math on that first line works, all of the character word stuff works... but I can't get the word to post when the $tick gets to the number $Catch_Post rolled. It just sits there from the get-go. This is probably me using a faulty macro, as it keeps telling me, but I don't know how to write that to make it work. (Relative newbie, with definite newbie mistakes.)

Also, I realize I need to, once the word's been posted, re-roll the number to add to $Catch_Post, re-roll the $Player, and figure out what $Word_Starts letter I'll need by finding the $Word_Ends array the previous word belongs to. Also, I'll be adding a penalty/shuffle to the player's three options if a word isn't posted by them within 20 seconds, or if the word doesn't start with the correct letter.

...I think I bit off more than I can chew, to be honest.
Something in my brain is telling me that what I'm trying to do can be done. I just don't know what the heck I'm doing. So even if it's just hints on how to fix a single part of my giant mess, I'll be happy to see if it's enough to get the ball rolling again or if I'm just... stuck.

To recap, the three biggest problems I'm having:
1) How is this supposed to be written?
(if: $Catch_Post equals $tick)
2) How do I re-roll the $Player and $Catch_Post additive variables?
3) And what would you feed the string "Home" to in order to make it identify the $Word_Ends_E array as containing it?

[Sugarcube] Tailored time system not functioning properly

$
0
0
Greetings,

Haven't been on in a while but for the most part I've been attempting to manage any problems I come across on my own, and it's been going reasonably well until this current juncture.

What I'm trying to do exactly is to convert a preset variable aka $Seconds, or something similar, into minutes. So 60 seconds would be equal to 1 minute 0 seconds, 90 seconds would be equivalent to 1 minute 30 seconds and 153 seconds would be converted to 2 minutes 33 seconds and so on, so forth. I'd prefer to do it in this manner rather than using javascript or anything else that I may have trouble integrating other systems with as essentially time will be the controlling factor in many game mechanic variables, from combat to disease incubation time to resting etc etc, so I would ideally want something that I can simply add + seconds or + minutes to any interaction and it will automatically translate onto the clock in the UI.

The following is an old draft of the code I had planned to use for this purpose.
<<nobr>><<silently>>

<<if $UITimeRestart neq true or $mm lt 0>>
<<set $mm to 0>>
<</if>>

<<if $UITimeRestart neq true or $hh lt 0>>
<<set $hh to 0>>
<</if>>

<<if $UITimeRestart neq true or $h0 lt 0>>
<<set $h0 to 0>>
<</if>>

<<if $UITimeRestart neq true or $m0 lt 0>>
<<set $m0 to 0>>
<</if>>

<<if $UITimeRestart neq true or $ss lt 0>>
<<set $s0 to 0>>
<</if>>

<<if $UITimeRestart neq true or $ss lt 0>>
<<set $ss to 0>>
<</if>>

<<if $mm gte 60>>
<<set $mm -=60>>
<<set $hh +=1>>
<</if>>
<<if $mm gte 120>>
<<set $mm -=120>>
<<set $hh +=2>>
<</if>>
<<if $mm gte 180>>
<<set $mm -=180>>
<<set $hh +=3>>
<</if>>
<<if $mm gte 240>>
<<set $mm -=240>>
<<set $hh +=4>>
<</if>>
<<if $mm gte 300>>
<<set $mm -=300>>
<<set $hh +=5>>
<</if>>
<<if $mm gte 360>>
<<set $mm -=360>>
<<set $hh +=6>>
<</if>>
<<if $mm gte 420>>
<<set $mm -=420>>
<<set $hh +=7>>
<</if>>
<<if $mm gte 480>>
<<set $mm -=480>>
<<set $hh +=8>>
<</if>>
<<if $mm gte 540>>
<<set $mm -=540>>
<<set $hh +=9>>
<</if>>
<<if $mm gte 600>>
<<set $mm -=600>>
<<set $hh +=10>>
<</if>>
<<if $mm gte 600>>
<<set $mm -=600>>
<<set $hh +=10>>
<</if>>
<<if $mm gte 600>>
<<set $mm -=600>>
<<set $hh +=10>>
<</if>>
<<if $mm gte 600>>
<<set $mm -=600>>
<<set $hh +=10>>
<</if>>
<<if $mm gte 600>>
<<set $mm -=600>>
<<set $hh +=10>>
<</if>>


<<if $hh gte 24>>
<<set $hh to 0>>
<<set $Day +=1>>
<</if>>

<<if $hh gte 10>>
<<set $h0 to "">>
<</if>>

<<if $hh lt 10>>
<<set $h0 to 0>>
<</if>>

<<if $mm gte 10>>
<<set $m0 to "">>
<</if>>

<<if $mm lt 10>>
<<set $m0 to 0>>
<</if>>

<<if $ss gte 60>>
<<set $ss -=60>>
<<set $mm +=1>>
<</if>>
<<if $ss gte 60>>
<<set $ss -=60>>
<<set $mm +=1>>
<</if>>
<<if $ss gte 60>>
<<set $ss -=60>>
<<set $mm +=1>>
<</if>>
<<if $ss gte 60>>
<<set $ss -=60>>
<<set $mm +=1>>
<</if>>
<<if $ss gte 60>>
<<set $ss -=60>>
<<set $mm +=1>>
<</if>>
<<if $ss gte 120>>
<<set $ss -=120>>
<<set $mm +=2>>
<</if>>
<<if $ss gte 180>>
<<set $ss -=180>>
<<set $mm +=3>>
<</if>>
<<if $ss gte 240>>
<<set $ss -=240>>
<<set $mm +=4>>
<</if>>
<<if $ss gte 300>>
<<set $ss -=300>>
<<set $mm +=5>>
<</if>>
<<if $ss gte 360>>
<<set $ss -=360>>
<<set $mm +=6>>
<</if>>
<<if $ss gte 420>>
<<set $ss -=420>>
<<set $mm +=7>>
<</if>>
<<if $ss gte 480>>
<<set $ss -=480>>
<<set $mm +=8>>
<</if>>
<<if $ss gte 540>>
<<set $ss -=540>>
<<set $mm +=9>>
<</if>>
<<if $ss gte 600>>
<<set $ss -=600>>
<<set $mm +=10>>
<</if>>
<<if $ss gte 600>>
<<set $ss -=600>>
<<set $mm +=10>>
<</if>>
<<if $ss gte 600>>
<<set $ss -=600>>
<<set $mm +=10>>
<</if>>
<<if $ss gte 600>>
<<set $ss -=600>>
<<set $mm +=10>>
<</if>>
<<if $ss gte 600>>
<<set $ss -=600>>
<<set $mm +=10>>
<</if>>

<<if $ss lt 10>>
<<set $s0 to 0>>
<</if>>

<<if $ss gte 10>>
<<set $s0 to "">>
<</if>>

\\\\\\\\REPEAT CODE AS NECESSARY TO ALLOW FOR NUMBERS OUTSIDE OF MAXIMUM PRESET BRACKETS\\\\\\\\\

<<if $UITimeRestart neq true or $mm lt 0>>
<<set $mm to 0>>
<</if>>

<<if $UITimeRestart neq true or $hh lt 0>>
<<set $hh to 0>>
<</if>>

<<if $UITimeRestart neq true or $h0 lt 0>>
<<set $h0 to 0>>
<</if>>

<<if $UITimeRestart neq true or $m0 lt 0>>
<<set $m0 to 0>>
<</if>>

<<if $UITimeRestart neq true or $ss lt 0>>
<<set $s0 to 0>>
<</if>>

<<if $UITimeRestart neq true or $ss lt 0>>
<<set $ss to 0>>
<</if>>
\
<<if $UITimeRestart neq true>>\
<<set $UITimeRestart to true>>\
<</if>>\

<<if $mm gte 60>>
<<set $mm -=60>>
<<set $hh +=1>>
<</if>>

<<if $mm lt 0>>
<<set $mm to 0>>
<</if>>

<<if $m0 lt 0>>
<<set $m0 to 0>>
<</if>>

<<if $hh lt 0>>
<<set $hh to 0>>
<</if>>

<<if $h0 lt 0>>
<<set $h0 to 0>>
<</if>>
<</silently>><</nobr>>

<b>$h0$hh:$m0$mm:</b>$s0$ss

<<click "Seconds Time">><<goto "Time Test">><<set $ss += random (120, 180)>><</click>>
\
<<set $UITimeRestart to true>>\

This is a draft of the time system I've been working on. I had to work around the fact that the <<repeat>> macro <b><i>still</b></i> would not function for me when:

A) I upgraded twine to the latest version
B) I tested the example provided by the sugarcube wiki with Twine 2 and using both Sugarcube 1x and Sugarcube 2x, whilst having to readapt the system to work with 2x

So I was forced to use a more long hand method, which is by no means effective AND to add insult to injury some values will not display properly, and I have no idea why. Today, I planned on restarting the whole system from the ground up because frankly this system is far too lengthy for something that sounds so ideologically simple on paper.

Today I've tried to circumnavigate the fact that the <<repeat>> macro does not seem to function properly with this instead:
<<set $minutes to 0>>
<<set $seconds to 0>>


<<set $seconds to 300>>

<<if $secondsover60 eq true>>
<<set $seconds -=60>>
<<set $minutes ++>>
<<set $secondsover60 to false>>
<<elseif $secondsover60 neq true>>
<<if $seconds gte 60>>
<<set $secondsover60 to true>>
<</if>><</if>>

<<if $seconds gte 60>>
<<set $secondsover60 to true>>
<</if>>



There are $seconds seconds and $minutes minutes.

Which also does not function properly.

Would appreciate any input/help on this matter.

Harlowe: Returning to Last Page which has (or doesn't have) a certain tag.

$
0
0
Hello ..

I'm working on a rudimentary RPG in Harlowe 2.1.1. I have passages for the rooms in my "dungeon" (Tagged: MAP), and separate pages for simple turn-based-combat (Character's Attack and Monster's Attack, Tagged: COMBAT).

Combat cycles back and forth between those pages until someone is dead. After you win the battle, I want the character to leave combat and return to the last "MAP" page.

The usual ...
(go-to:  (history:)'s last)
isn't going to work, since inevitably the last several pages have been combat, not inside the map itself.

Can I create a link to go back to the last page with the tag "MAP", or the last page NOT tagged "COMBAT"?

Alternatively, skipping tags altogether, can you store passage names in variables, and call them as links later? For example, on the last map page I could:
(set: $returnpage to "Room1")

Then after combat, create a link to go back to $returnpage. I have tried this in a few different ways, but I can't seem to get the syntax correct.

Sorry if these are obvious questions - I searched for quite a bit before posting to no avail.

Thanks!

How do I keep count of something?

$
0
0
Hi there! I'm a teacher trying to teach Twine with a bunch of enthusiastic primary-aged writers. They want to know how to do all kinds of things and I am doing my best to stay one step ahead of them. At the moment I am trying to figure out how I can keep count of something, like the number of keys collected.

At the moment I have (if: $key is 3) as a conditional to show the text that allows the reader to open the door. I have (set: $key is '0') and the beginning of my story.

What do I use to increase the count of $key by a given value? Something like (set: $key +1)?

Sorry if this question has been asked and answered elsewhere. I didn't exactly know what to search for. Thanks for your assistance! :)

[Harlowe][Twine2] Is it possible to set a value in a Datamap to a reference to a different Variable?

$
0
0
I'm starting to learn Twine, and I thought I'd go about making a small framework to familiarize myself with the system.
What I'm trying to do is set up a Datamap called "Door" that has a key/value pair of "openCondition",$doorUnlocked.
Now what this does is set "openCondition" to whatever $doorUnlocked was when "Door" was created. That's fine, but what I need is "openCondition" to be a reference to $doorUnlocked so that when $doorUnlocked changes, "openCondition" changes as well.

Is this something that can even be done in Harlowe? If so how?
If not, does it work in Sugarcube or any other format?

Thank you for your time.

Can't publish to file from a duplicate file

$
0
0
Hey everyone!

On Twine 2.1.3, I made a duplicate of one of my Twines, and only from that game, nothing happens when I click "publish to file". It's the same when doing it from the "hub menu", or from inside the game.

Just wanted to see if this was a known issue or just me.

JQuery Question(s)

$
0
0
Hi everyone!

When I saw that Sugarcube had jquery support I got really excited, but I'm struggling with what I assume is a simple issue related to not understanding how the story format is implemented. Maybe it's better to just show what I want to do:

https://jqueryui.com/

I want to add this library to my story and then use some of the UI widgets in it!

So... questions:

1) Hey, is this a good idea even? Like will this seriously break anything if I try to do this?
2) If it's fine, where should I add this at or how should I add it so that it doesn't break anything?
3) Maybe more of a sub question but: Is extending Sugarcube this way even a good idea?
4) Do I need to do anything special to use this library once it's installed? Like... do I need to attach jquery handlers in a specific place to make them work?
5) If anyone can point me to a blog post or something where someone has already done something like this: Please do!

I'm pretty handy with Javascript and I've become pretty comfortable with the way that twine/sugarcube processes it within the context of the story, but that's only with code that I write and then specifically attach through either the window namespace or through the documented handlers, so I just really want to make sure that I do things in such a way where I don't reinvent the wheel or make an error in planning that will cause me to have to do a big refactor later if I want to update Sugarcube to a new version.

Thanks!

Weird Bug in sugarcube 2.x Twine 2.x where a double slash comment causes bad evaluation

$
0
0
Background:

I was stuck for 2-3 days in my twine game project and decided to get help from forums. I was trying to create a workaround and simplfied version of my code to demonstrate the problem. And I have found this weird bug where a comment with two backslash causes following crush fault:
Apologies! An error has occurred. You may be able to continue, but some parts may not work properly

Error [StoryInit]: <<run>>: bad evaluation: $Distinct is not defined.


Code goes to StoryInit passage
<<run (function() {
	
// problem workaround

$Stat = function(id, start) {
	
	
	// default gain updater that's a normal stat expected to have
	this.getUpdate = function(amount) {
		
		return new $Updater(
			[ new $Modifier(this.id, new $Fn(this.modify, new $Args(amount), this)) ]
		);
	};
};

$Distinct = function(updaters) {
		

	var here = "is not important and this is simplfied code from my project"		
	// it's whether $Modifier or $Requirement that both has id property

	return "if you remove the comment above everything works fine?!"
};

})();>>

This is simplfied and cropped from my project. If you simply create an empty twine with story format sugarcube 2.x add a StoryInit and replace the code above, then try to run project. You should get the error that I got. Simply remove the comment that's in $Distinct object. Everything works fine.


http://www.mediafire.com/file/5msmwwa0rs17an1/bug_workaround.html

here is the workaround that you can load into twine. let me know what do you think.
Viewing all 1844 articles
Browse latest View live