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

(Harlowe) Cycling Links which lead to different passages?

$
0
0
Newbie coder here. Using Twine 2 and Harlowe. I've successfully made a cycling link, and I'm now trying to get the subsequent internal link to lead to a different passage depending on which item in the cycling link is chosen. I tried to follow the instructions given in this thread:
https://twinery.org/forum/discussion/4937/cycling-link
However, I seem to be running into problem after problem as I try to tweak it. I'm sure there's at least one glaringly obvious error in here, but it's beyond me!

I'm just going to post the entire passage in case the problems stem from something I've done with the cycling link too.
you stand still. so very still. it is possible you are no longer able to move, in this space. and there is something different about you. at least, you're pretty sure you never used to have (set: $myVar to "vibrating membranes at the sides of your neck")<tw-link class='cyclingLink' data-cycling-texts='["vibrating membranes at the sides of your neck", "skin as soft and white as maggots, and just as cold", "curled teeth of such size that they cannot be contained by your lips", "a second pair of arms, these ones of immaterial golden haze", "black blood that prickles like thorns beneath your transparent skin", "pleochroic wings, which shiver with strange energy"]' onclick='clickCyclingLink(this, "$myVar");'>$myVar</tw-link>.

<center>

(link: "what else has changed?")[{|
(if: $"what else has changed?" is "vibrating membranes at the sides of your neck")[(goto: "membrane-hall")]
(elseif: $"what else has changed?" is "skin as soft and white as maggots, and just as cold")[(goto: "maggot-hall")]
(elseif: $"what else has changed?" is "curled teeth of such size that they cannot be contained by your lips")[(goto: "teeth-hall")]
(elseif: $"what else has changed?" is "a second pair of arms, these ones of immaterial golden haze")[(goto: "arm-hall")]
(elseif: $"what else has changed?" is "black blood that prickles like thorns beneath your transparent skin")[(goto: "blood-hall")]
(else:) $"what else has changed?" is "pleochroic wings, which shiver with strange energy")[(goto: "wing-hall")}]

</center>
As per the instructions (or at least my understanding of them) in the aforementioned link, I copied and pasted the second chunk of that code (from "[{|(if: $"what else has changed?"" onward) into all the possible linked passages. Was I wrong to do that? There arent any arrows connecting these passage boxes to the one with the cycling link in my editing view...

In any event, there are multiple problems that are resulting from this. One is that no matter what the cycling link is on, the internal link always leads to the passage "wing-hall", which is only supposed to be associated with the last item in the list. Also, I've gotten multiple error messages, which always look something to this effect:

tumblr_o7p467KxoN1sr3o60o1_1280.png

I just started learning how to do some basic coding yesterday. It hasn't even been twenty-four hours yet, so I'm a tad out of my depth with...well, everything, at this point. I appreciate your answers!!

Sugarcube 2: Modals don't work if starting from story's beginning

$
0
0
Hi all,

I'm using modals to give short descriptions of highlighted words in the story. They work perfectly well IF I start the story from a passage that has modals in it. However, if I start the story from the very beginning and play through to a passage that contains modals, nothing happens when I click the modal triggers. It doesn't throw any errors or react in any way. I'm almost positive it's a scope issue or something related to JS execution in relation to loading the DOM, but I'm not great with JavaScript.

This is the code that is in my story JavaScript:
window.openModal = function(modal, btn, span) {
	btn.onclick = function() {
    $(modal).fadeIn( "slow" );
}
$(span).click(function() {
  $(modal).fadeOut( "slow" );
});

window.onclick = function(event) {
    if (event.target == modal) {
        $(modal).fadeOut( "slow" );
    }
}
}

And this is the code in the passage where the modals are located:
<<script>>
window.onload = function () {
window.openModal(document.getElementById("teuthModal"), document.getElementById("teuthTrigger"), document.getElementsByClassName("close")[0]);

window.openModal(document.getElementById("oxyModal"), document.getElementById("oxyTrigger"), document.getElementsByClassName("close")[1]);

window.openModal(document.getElementById("coldModal"), document.getElementById("coldTrigger"), document.getElementsByClassName("close")[2]);
}
<</script>>

Any help would be much appreciated.

Change colour of cycling links & adding audio in Harlowe

$
0
0
Sorry for flooding the forum with questions.
I'm using Twine 2, Harlowe, and I'd like my cycling links to be a different colour than my regular links. I tried to model the code for this after the code for the colours of my other links/hovering links/etc, but since I am simply guessing, I'm not surprised nothing is happening. This is what I tried putting in my Story Stylesheet:
tw-link.class:cyclingLink {
color: #cc66ff)
font-weight: bold;
}

I also tried putting ' ' around cyclingLink, and using = in place of : after class. To no avail, probably for some obvious reason. I don't even know if Harlowe recognizes cycling links in this way. If not, is there some other way I could differentiate link types? Or perhaps I need to be adding this to the post itself? I tried that too, but no dice.


My other question, so as to not clog up the board even more, is about inserting audio into the story. I would like to implement looping background music. I've been looking around, but everything I've seen pertains to SugarCube and not to Harlowe. I tried using the SugarCube method, but surprise surprise, it wasn't compatible. I'm aware that I'll need to upload my music to a hosting site for this to work, but the ones other threads recommended are broken links. Is anyone aware of functioning sites I could use?
As a side note, I only have the one audio track for now, but in future I think I'll probably want to add new tracks for certain scenes or whatnot. I dont know if that influences the coding I should use or not.

Thank you so much for all your patience! I really am enjoying myself so far, even just with the learning process!

How do I get around return and back getting me into a loop?

$
0
0
I'm using twine 2 with sugarcube 2. I have several passages in my storymenu. For example, inventory and stats. If I click on inventory and then immediately on stats, I get stuck in them and can't get back to the story. The same thing happens if the stats for example has a depth of more than one passage.

I've seen some games where the ui bar is automatically hidden during certain passages, likely to get around this, but I have no idea how to do that. I've also seen some talk about making the history skip certain passages so the <<return>> skips past them, but I haven't a clue on how to do that either.

How to (display:) a passage when a condition is met, and remove it when the condition is not met?

$
0
0
so, i got this:
$males
$females
$babies

(link: "Make Males")[(set: $males to it + 1)] <!--adds 1 to $males-->
(link: "Make Females")[(set: $females to it + 1)] <!--adds 1 to $females-->

that's in a passage, and this in another:
(link: "Make Babies")[(set: $babies to it + 1)] <!--adds 1 to $babies-->

now, i want to say if the $males = 1 and the $females = 1 then (display:) the second passage and if any of the $'s is less than what the condition requires then hide the (display:) of the second passage.

Different backgrounds for different chapters (Harlowe)

$
0
0
How can I change the background image of a page based on the chapter?

Right now, the background is in the body tag, and the formatting for each chapter varies with a class tag. This method puts a box that holds the text floating over a full screen background image. Unfortunately, it also means that the whole story uses the same image, whereas I would like the story to change the large image based on the events and setting.

body {
background-color: rgba(189, 98, 44, 0.9);
background-image: url("https://upload.wikimedia.org/wikipedia/commons/3/34/Rub_al_Khali_002.JPG");
}
.redo { display:none;}
.undo { display:none;}
.desert {
background: rgba(255,251,244,.33);
color: rgba(71,62,2,1);
width: 1000px;
border: 2px solid white;
border-bottom-left-radius: 2em;
border-bottom-right-radius: 2em;
border-top-left-radius: 2em;
border-top-right-radius: 2em;
padding: 2cm 3cm 2cm 3cm;
}
.city {
background: rgba(255,251,244,.33);
color: rgba(7,4,2,1);
width: 1000px;
border: 2px solid grey;
border-bottom-left-radius: 2em;
border-bottom-right-radius: 2em;
border-top-left-radius: 2em;
border-top-right-radius: 2em;
padding: 2cm 3cm 2cm 3cm;
}

Can I change the body background in a class tag and keep the floating box? Can I create differently classed body tags? (.desert body, .city body) I've been searching through w3schools, but I'm not even sure what the thing I'm looking for is called.

Does anyone know where I can find the specs for building a custom Twine 2.0 story format plugin?

$
0
0
As the title says, I'm having a hard time finding anything resembling an API reference for the story formats, and trying to reverse-engineer from existing ones is not proving to be fruitful. Anyone know where I can find more info other than what each of the existing formats does/doesn't do?

The reason I'm looking is I would like to use the Twine editor to create a story and generate a non-HTML format for consumption by a web service.

Thanks in advance for any help/suggestions/links!

Problem with tildes in Harlowe Twine 2

$
0
0
Twine 2 & Harlowe.

I want to be able to put punctuation inside macros.

According to the "Verbatim markup" section of the Harlowe manual, if I want to use punctuation within a macro call, I should use tildes (or graves, it's not clear--the text says tildes but the actual mark they use is a grave). However, when I try this, it doesn't work. The output is always "unexpected markup". Can anyone tell me what I'm doing wrong? I've tried so far:
(print: "He said, "Hi." ")
(print: "He said, `"Hi."`")
(print: "He said, ~"Hi."~")
(print: "He said, ``"Hi."``")
(print: "He said, ~~"Hi."~~")

In another example, I can't seem to get question marks to work inside click-append, like so:
Do you want to make a wish? (click-append: "Do you want to make a wish?")[Ask and ye shall receive.]

With this example, the clickable link doesn't appear in the playthrough.

Is this just a known issue and I'll have to work around it? Thanks!

Amazing flashlight effect from My Father's Long Long Legs won't work in Harlowe

$
0
0
My Father's Long Long Legs has this cool effect where the text and background are black and then a flashlight illuminates the text and an image. The author shares the code here: http://www.mantlelabs.com/flashlight/#.V0dRpZErLIX

I"m a newbie so I just cut and pasted it to the passage I want to apply it to.

How do I get it to work in Harlowe?

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script>
$(document).light(function() {
$("body").mousemove(function(e){
$("body").css('background-position',(e.pageX - 250)+'px '+(e.pageY - 250)+'px');
});
});
</script>

Does anyone know if i can import pictures from my gallery? (Pictures on phone)

Twine 2.0 not working properly in iOS?

$
0
0
I'm trying out the online Twine 2.0 interface on my iPad and I'm finding that it doesn't appear to really work' when tapping individual passages, the text box never becomes editable — the on-screen keyboard doesn't appear, and an external one isn't able to type anything in the box. Further, when trying to test it live, the debug and play windows open in a second tab, but they're both completely blank. I haven't really seen this issue on the forum (most posts appear to involve importing or archiving, which seems to work fine for me) so I'm not sure what's up.

I've tried this on both an iPad Pro as well as an iPhone, in both vanilla Safari and Chrome.

Remove Option for Saving?

$
0
0
Twine 2.0.1, Sugarcube 2.6.2

Sorry to ask such a basic question but after searching the forum and the Sugarcube doc I've come up empty. How do I remove the option for saving?

The game I made in Sugarcube 1 used:
$("#menu-saves").remove();

But that doesn't work in 2.6.2.

Thank you!

Stylesheet and Passages

$
0
0
Greetings
I am rather lost as to where find information I require and I did not find it despite my searches. Therefore I am asking here and if(questionHasBeenAnsweredBefore = 1) or (didntSearchProperly=1) I apologize profusely.

I have little experience with coding, and I like to follow up on examples and tutorials. Here's what I want to do:

I'm using Twine 2.0, with SugarCube, and what seems to be the built-in stylesheet "ui-bar.css". By that I mean I loaded up Twine, selected SugarCube, and under Edit Story Stylesheet copypasted the entirety of ui-bar.css that is linked in the SugarCube reference.

What I have in mind, is displaying ingame variables inside the sidebar of SugarCube. Trouble is, I've no clue how to do that.
I already figure stats and level up menu, inventory system, turn based combat, and other simple RPG things like that to be done in looped passages. What I'd like to do is, besides the SAVES and RESTART buttons, to have also links to those passages, as per Inventory, Stats, etc. But most importantly - display of the variables, such as HP, maxHP, experience points, money, whatever. No graphics, just "variableName = $var" or something.

Here's what I see in my head when I say that:
bU9qqum.jpg

How do I do that? Any help or link to a tutorial is helpful, those I found didn't help me much.

Best Regards.

Is multiplayer at all possible in Twine?

$
0
0
To be more specific, all I would really need is a way for several people playing the same game to connect with each other in groups and for the people within such a group to share a common variable pool - that is, if one of their games sets a variable to a specific value I want that same variable in the other players' games to be set to the same value, as well. The rest I could easily do with some creative uses of those variables.
So, is there any way to accomplish this? Maybe some html workaround or something? I have a few really cool ideas I could do if I could just get several players to share the same variables...
I doubt this is all that relevant to my question, but I'm using Harlowe (though I'd be willing to use a different format if that's what it takes).

Time limit on story in Twine 2.0

$
0
0
Hi Guys!

First time posting here so I hope I'm doing this right, I tried to find an answer to this question on google for quite sometime.

So I am very new to Twine 2.0 and just Twine in general. I'm creating a story that has what I guess you would call a bit of an open world. I want to add an overall time limit for the player though, that activates at a certain passage and continues through multiple passages until the end of the game and counts down from a certain number of minutes until 0. I also dont want this to begin at the very start of the game either, only after about 7 passages.

Is this possible?

Cheers

twinery 2 how to add images?

Harlowe - can't get @media screen to work in stylesheet

$
0
0
Hey there,

I've been fiddling around with this for a while and looked at different tutorials and posts, but I must be missing something bleedingly obvious, because I can't seem to get the @media screen CSS to work even if I just copy-paste what other people say to have used.

So first I tried this.

@media screen and (max-width: 1280px) {
.passage { font-size: 120%; width: 51.2%; }

But then I read that that's a Twine1 thing (?), so I went with this, which I got from this post.

@media screen and (max-width: 1280px) {font-size: 1.2em;}

Changing the values for the font-size does nothing strangely enough. I removed anything else that alluded to font-size or margins (I do use "tw-sidebar {display: none;})

What I ultimately want to do with this is have about the same text width for every size of screen. I've noticed that for larger screen it makes the lines really long and it makes it hard to read, so I thought I'd make the margins and the text bigger when the screen size increases.

What am I missing? I hope any of you can point me in the right direction.

Is there a way to use the click macro with imagemap?

$
0
0
So linking to a passage with imagemap link is simple enough (just change the href to data-passage) but I was wondering if there was a way to use the <<click>> macro with imagemap coordinates as the link so I can set variables before loading the next passage.

Does anyone have any experience with something like that?

If statement, comparing previous() to couple passage titles utterly fails.

$
0
0
Greetings
This is using Twine 2.0 with Sugarcube story format.
My game has buttons for entering inventoryScreen, charScreen, travelScreen, from any passage where it's allowable. After visiting the passage and reading the information presented there, at the end there is <<return>> button to return.
I've been trying to get around the loop that is created when, say, from inventoryScreen we would have clicked charScreen.

I'd done so already with simply disabling StoryMenu (holding the buttons) when on inventoryScreen passage and the others. But I require additional functionality on these passages now, and <<return>> and the loop 'bug' that comes with it is making it impossible for me.

So, I came up with this (for debugging whether it even works):
<<set $lastVisitedPassage = previous()>>
  <<if $lastVisitedPassage == "ScreenMenu" || "travelScreen" || "inventoryScreen" || "charScreen">>
  <<print "result 1">>
  <<print previous()>>
  <<else>>
  <<print "result 2">>
  <<print previous()>>
  <</if>>

and with this
<<set $lastVisitedPassage = previous()>>
  <<if $lastVisitedPassage == ("ScreenMenu" || "travelScreen" || "inventoryScreen" || "charScreen")>>
  <<print "result 1">>
  <<print previous()>>
  <<else>>
  <<print "result 2">>
  <<print previous()>>
  <</if>>

The first ALWAYS renders the result 1, the second ALWAYS the result 2. If I change == into != the situation get's reversed, but still always.
By always I mean no matter if print previous() shows any of the passageTitles I want to exclude or a random like desertVillage that I made.

How is that even possible? Of that I am very curious, if not frustrated with.

Most importantly, how to make it work? Or how to make another way of circumventing the <<return>> loop bug without disabling the possibility for the player to enter the inventoryScreen and other passages from any point in the game world?

Also, I'd tried changing the StoryMenu special passage to turn the buttons into setter links, like so:
[[Inventory->inventoryScreen][set $lastVisitedPassage = previous()]]
but an technical error pops up.

Best Regards!

Can a default value be set with customScripts.updateNamedHook user input method?

$
0
0
This routine works fine, but I would like to pre-set the values.
if (typeof window.customScripts == "undefined") {
	window.customScripts = {
		updateNamedHook: function(hookName) {
			var value = $("input[name='" + hookName + "'], textarea[name='" + hookName + "']")[0].value;
			// Find the named hook node and set the text inside.
			$("tw-hook[name*='" + hookName + "']").text(value);
		}
	}; 
};

and in the passage I use the standard code
[]<Answer1|. <input type="text" name="Answer1" value="">

My screen has a menu of input fields using the above Javascript, then I progress to the next passage, which prints a report based on the inputs.

I would like to back up to the input screen and change one or more fields and then reprint.
But of course all the fields are blank and have to be re-entered

I tried
<Answer1|. <input type="text" name="Answer1" value=$Value1>

But that just pre-sets the data field with the literal "$Value1" rather than its contents
Viewing all 1844 articles
Browse latest View live