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

[Sugarcube 2] - Using an external editor

$
0
0
As I've mentioned before, I am very green as far as JavaScript is concerned, so the code I'm using is something I found on StackOverflow. Essentially, I'd like to be able to edit my passages in Notepad++ and then link to those files within the passages. Is this possible how I'm attempting it (or in any other way)?
<<silently>>
<<script>>
$(document).ready(function() { 
    $('#pageContent').load('test.html');
}
<</script>>
<</silently>>
<div id="pageContent"></div>

Twine 2.0/Harlowe Images and Dropbox

$
0
0
I have a story in Twine 2.0/Harlowe that makes use of many images. As a test run, I put images in Dropbox and referenced them with proper addresses and such. They show up in the story fine... as long as it's on the desktop used to link them, and nowhere else. I'm working in browser, so I can get them to show whether it's Chrome or Firefox.

I need to get these images visible on someone else's machine, not just mine, without a lot of work.

But if I Publish to File, copy to flash drive, and hand the flash drive off to someone else, the links break. This happens even if the second computer is the owner of the Dropbox folder where the images are stored... they definitely have permission. And the breakage also happens if I use a second computer and can sign into Dropbox using my account.

The only solution seems to be to open up the Twine file editor, once for every new computer, and manually recopy every single link. This is an effective workaround, but clearly an impractical one. My audience is strictly internal/co-workers at the moment, with whom I can share Dropbox access, but I'm not telling my readers/players that they must paste in all the art addresses.

Other potential solutions I see but might waste my time:
* Web hosting of the images rather than Dropbox
* Saving all images to flash drive and praying the file extension remains the same when slotted into a new machine

There's got to be an easier way... what am I missing?

Thanks in advance.

harlowe - keeping variables through savegames?

$
0
0
yo
so i've got a save/load game function in my game at the moment (works if you close the tab, lets you visit the main menu, etc)

(this is a footer on every page:)
[Save Game]<save| || [Load Saved Game]<restore|
(click: ?save)[*Saved!*(savegame: "A")] (click: ?restore)[*If you're seeing this, the game failed to load.*(loadgame: "A")]

but!
i also have some settings id like the players to be able to customise (e.g 'show lock-in options' shows the final chances to see options)
You (if: $showlockin is "yes")[have](else:)[do not have] lock-in options enabled.
[Show Lock-In Options]<showlockin|
(click: ?showlockin)[You will now see lock-in options with LO tags.
(set: $showlockin to "yes")][Hide Lock-In Options]<hidelockin|
(click: ?hidelockin)[You will no longer see lock-in options.
(set: $showlockin to "no")]

the only problem is...
if a player saves the game, then goes to the menu, and changes the options... restoring their save game will reset the options to whatever they were when the save was made. making a new save keeps the options, but stops them returning to their previous point (deleting the old save forever; they have to restart).
is there any way to make certain variables carry over between saves?

TL;DR can't keep flags through savegames, how fix

"An error occurred during startup while initially synchronizing story files"

$
0
0
When I launched Twine a minute ago, I got the error below. Any thoughts?
Message: Cannot set property 'id' of undefined
File: unknown
Line: unknown
Column: unknown
Stack: 
TypeError: Cannot set property 'id' of undefined at IMPORT_STORY (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:41:19603) at i.(anonymous function) (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:91:5845) at r.value (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:91:4841) at dispatch (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:91:4102) at importStory (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:9:25334) at chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:48:10972 at chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:48:10861 at Object.loadAll (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:48:11018) at chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:60:31950 at Object.init (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:61:212)

Alter passage text before it is rendered?

$
0
0
@TheMadExile Yes, I know you already could not fathom it, but hear me out.

I'm a lazy bastard who has a list of things I'd like to replace with a styled version.
<<set _replaceList to []>>

<<set _replaceList["ADept"] = "@@aStyle;ADept@@">>
<<set _replaceList["BDept"] = "@@bStyle;BDept@@">>
<<set _replaceList["CDept"] = "@@cStyle;CDept@@">>
}>>

I may add/delete/change the department names and styles of each of them, and I don't want to hunt through all my Passages for each of them. Really, it's just like Harlowe's replace, instead on a particular String instead of a hook.

So, what's this crazy method you spoke of? Does it use postrender/predisplay?

Also, is there a better way to define the replaceList array?

How to limit the inputs on a button's execution. Or maybe an alternative solution?

$
0
0
Hi All. I'll keep it brief.

I have a button that executes its contents, then goes on a 5 second "cooldown" before it can be clicked again. Part of its contents however is a <<repeat>> macro which basically subtracts 0.1s from the $cooldown variable every 100ms, replacing a text span that indicates how much time is left every 100ms as well.

The problem: I can spam click that button really fast, resulting in multiple <<repeat>> macros going off, and multiplying the subtraction so that it subtracts A LOT faster.

Is there a workaround to the problem, or am I coding this button the wrong way? Is there a more creative way of doing this? :(

The button is something like:

<<button "This goes on cooldown">>
<<if $cooldown > 0>>Do nothing
<<elseif $cooldown is 0>><<set $cooldown to 5>><<repeat 100ms>><<set $cooldown to $cooldown - 0.1>><<replace "#timer">>Cooldown: <<print $cooldown>>s<</replace>><</repeat>>
<</if>>

Making link hooks conditional in harlowe 2

$
0
0
I'm using datamaps to track the player's state, and it would be really nice if I could make the appearance of certain links depend on specific stats being set to specific values. As an experiment, I made a really quick prototype container and link:
{(set: $player to (datamap: 
"Name", "Bob", 
"strength", 10, 
"dexterity", 8,
"wisdom",3,
))}

(if: $player's strength < 5)[[You can barely move the boulder]]
(else:)[[You casually toss the gigantic rock over your shoulder and move on]]

This obviously generates an error- the if macro says "the command should be assigned to a variable or attached to a hook," but I thought I'd done both; $player's strength is a valid variable, and there are no spaces or anything between the macro and the hook. Am I making an obvious syntax gaffe, or are links not intended to be combined with the if: macro?

Include other part of code in dynamic approach (Php-like)

$
0
0
Hi,
In the tutorial of Twine 2.0, I did not understand well how can i create a part of a code outside the page or the passage which can be included in multiple passage or page. (Like Php do to html in webpage)
To avoid repeating each time the same code at each passage ?

Thanks for your help

Background Music in Harlowe

$
0
0
Hi all, I've made a few Twine fictions using Twine 2 (whatever the most recent is, it's all updated on my computer) and Harlowe 1.2.1. I am fairly dedicated to using Harlowe, since I do well with the macros and don't have time right now to teach myself a whole new story format.

I am looking to include just one sound in my story if possible. I just want an ambient soundtrack of "space noises" in the background of the passages. It is about 14 minutes long, so if the reader continues to play I would like the soundtrack to loop if possible. It doesn't need to change based on passage, just keep playing in the background. Is there a way to do this in Harlowe? I know that everyone here argues that SugarCube is better for sound, but I'm hoping that since this is fairly straightforward, someone can help me manage it in Harlowe.

Thanks!

Table in Sugarcube 2?

$
0
0
Hi! I am pretty new to Sugarcube. I want to make a table that compares stats between two objects. Is there a way I can do this? Thanks!!

[Sugarcube] If within number range

$
0
0
Is there something I can put in an "if" statement to test if something's within a certain number range? Something like:
<<if $Percent is 1-50>>Thing!<<endif>><<if $Percent is 50-100>>Other thing!!<<endif>>

I know that as an alternative I could do something like:
<<if $Percent is gt 1>><<if $Percent is lt 50>>Thing!<<endif>><<endif>><<if $Percent is gt 50>><<if $Percent is lt 100>>Other thing!<<endif>><<endif>>

But this produces much more clutter and is slightly more time-consuming, so I figured I'd ask if there was already a built-in "within these numbers" command for if statements that I didn't know about.

Thanks so much!

How to make random variable for sugarcube2

$
0
0
How do i make a random variable fro text?

how to code an animated ellipsis in Twine?

$
0
0
I'm fairly new to Twine, and I was wondering how to code an animated ellipsis using Harlowe?

[SugarCube 2.13] Unable to use multiple radiobutton groups on the same passage?

$
0
0
I'm designing a passage a game with a passage that has a few customizable options. For reason of clarity and aesthetics alone I was opting to utilize the <radiobutton> macro as opposed to an anchor when I noticed what seemed to me to be odd behavior.

When using the radiobutton macro the first grouping will have the id assigned as expected, but the second does not. Instead of an ordering applied to the ID you'll receive a "Not a Number" designation to the ID.


Example:
<<nobr>>
<table>
	<tr>
		<td width="40%">
			Measurement system:
		</td>
		<td>
			<<if $imperial eq true>>
				<<radiobutton "$imperial" "true" checked>>
			<<else>>
				<<radiobutton "$imperial" "true">>
			<<endif>>
			
			<<if $imperial eq false>>
				<<radiobutton "$imperial" "false" checked>>
			<<else>>
				<<radiobutton "$imperial" "false">>
			<<endif>>
		</td>
	</tr>
	<tr>
		<td width="40%">
			Enable Cheats:
		</td>
		<td>
			<<if $cheatMode eq true>>
				<<radiobutton "$cheatMode" "true" checked>>
			<<else>>
				<<radiobutton "$cheatMode" "true">>
			<<endif>>
			
			<<if $cheatMode eq false>>
				<<radiobutton "$cheatMode" "false" checked>>
			<<else>>
				<<radiobutton "$cheatMode" "false">>
			<<endif>>
		</td>
	</tr>
</table>
<</nobr>>


Which results in:
<table>
	<tr>
		<td width="40%">Measurement system:</td>
		<td>
			<input id="radiobutton-imperial-0" name="radiobutton-imperial" type="radio" tabindex="0" class="macro-radiobutton">
			<input id="radiobutton-imperial-1" name="radiobutton-imperial" type="radio" tabindex="0" class="macro-radiobutton">
		</td>
	</tr>
	<tr>
		<td width="40%">Enable Cheats:</td>
 		<td>
			<input id="radiobutton-cheatmode-NaN" name="radiobutton-cheatmode" type="radio" tabindex="0" class="macro-radiobutton">
			<input id="radiobutton-cheatmode-NaN" name="radiobutton-cheatmode" type="radio" tabindex="0" class="macro-radiobutton">
		</td>
	</tr>
</table>

For the sake of curiosity I've swapped table rows around to see if the behavior was repeatable when sure enough whichever group of radiobuttons comes second is id'd with a Not a Number postfix.

Did I do something really dumb and implement the control incorrectly?

Harlowe 2.0.0 Fade In Transition Help!

$
0
0
It's been a while, Twinerites!

I'm having a really odd and probably simple problem with the effect of text fading in on each passage. I read up on a past thread in the discussions that gave a CSS code to disable the fade in transition, but it appears to work when it wants.

Here's an example of some code I have:
<div class="animated fadeIn">{(set: $stories_completed to 5)}

=><=

<h1>[[Begin|Start]]</h1></div>

Seemingly at random, the code fades in only once how I want it and some other times it fades in twice (which is ugly and what I don't want). I've done this in a number of different ways, including and excluding the transition suppression CSS. Any help with this is appreciated.

I figured out cycling links in Harlowe 2.1.0

$
0
0
I spent all evening working on cycling links, but couldn't find any guides written specifically for the newest version of Harlowe, so here's my solution for links that you click again and again to cycle through options:
(set:$place to (a:
"the cave",
"the bridge",
"the cliff",
"the lake"))
p>You walk until you reach (link-repeat:"|this>[it]")[(set:?this to $place's 1st)(set:$place to(rotated:1, ...$place))].
</p>
This will start with a link that says it, then cycle through the four locations.
I hope this helps somebody! If you have any questions please ask.

How to code a Lotto

$
0
0
So I'm new to coding and still in the very experimental stage with what I hope to do, I was wondering if it's possible to set up a lotto that draws from a list of flagged names. Basically certain actions would place these names into the pool and be drawn at random at some point, but I'm not at all sure how to manage that.

I've been mostly experimenting with sugar cube 2 so far.

How to increment variable in [[ ]] ?

$
0
0
Hello there, I'm fairly new to Twine, and I'm having a hell lot of fun.
I'd like to do something of that kind :
A damsell in distress !!

[[ Help -> Outcome]]
[[ Flee -> Outcome]]

And I'd like for the variable $courage to gain +1 if "Help" is chosen. How do I do ?
I've tried weird stuff like :
[[ Help -> Outcome ] (set: $courage to $courage + 1)]

But it didn't work. If there's anything I've explained badly, do say so !

Thanks in advance !

Sugarcube 2: Nested If statement problem

$
0
0
Hi! I'm likely doing something terribly wrong, being more a writer than coder, but I do know enough about coding to stay afloat... most of the time. I'm having a problem in a project, with an IF statement that contains another IF statement.
It works fine with this...
<<if $Light eq true>>
&nbsp&nbspRoom Description
&nbsp&nbsp<center>[[Exit links here]]</center>
<<else>>
&nbsp&nbspDark Room Description
<<endif>>
<center>[[Always visible exit link here]]</center>

But as soon as i try to use this...
<<if $Light eq true>>
&nbsp&nbspRoom Description
&nbsp&nbsp&nbsp&nbsp<<if $Stat lt 34>>Nothing
&nbsp&nbsp&nbsp&nbsp<<elseif $Stat lt 67>>Comment on env. hint
&nbsp&nbsp&nbsp&nbsp<<else>>Identified env. hint
&nbsp&nbsp&nbsp&nbsp<<endif>>
&nbsp&nbsp<center>[[Exit links here]]</center>
<<else>>
&nbsp&nbspDark Room Description
&nbsp&nbsp&nbsp&nbsp<<if $Stat lt 34>>Nothing
&nbsp&nbsp&nbsp&nbsp<<elseif $Stat lt 67>>Comment on env. hint
&nbsp&nbsp&nbsp&nbsp<<else>>Identified env. hint
&nbsp&nbsp&nbsp&nbsp<<endif>>
<<endif>>
<center>[[Always visible exit link here]]</center>

...I get errors popping up that the first IF has no closing statement, or that the Else is on it's own. Is the code seriously thinking that the nested statement's close is the main statement's close as well? The nested parts are working fine...

How to make text appear a few seconds after a click in Harlowe?

$
0
0
I'm fairly new to Twine and not sure how to do this.
I want a player to click on a certain word/sentence, and then after a few seconds make another sentence appear.
Viewing all 1844 articles
Browse latest View live