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

Click and Append in Twine 2, Sugarcube 2

$
0
0
I used Twine 2 + Sugarcube 2 for Ludum Dare over the weekend, and ran into a problem with <<click>> and <<append>>.

My goal is to show a conversation unfold, where each paragraph ends with a clickable > that adds the next line of the conversation below it. I was able to get this 95% working with <<click>> and <<append>>. The problem is that you can click the > multiple times and get the text to repeat down the page. I tried nesting a <<remove>> in the <<click>> but it didn't seem to work because the <<click>>s themselves are nested--so removing the first also removes the code that makes subsequent <<click>>s work.

Is there an easier way to accomplish this? Here's a sample of how I have it implemented without the <<remove>> (the version that repeats text if you click > more than once).

Thanks!

"It's ugly as sh..." The girl begins but a hissed "Iris!" from her mother cuts off the profanity midway.<<click " >">>
<<append "#conv1">>"Can I look around?" the boy asks, and he's already looking through the doorway into the small downstairs bathroom. <<click " >">>
<<append "#conv2">>"Yes, but we won't be here long today. This is just to see if there's anything we need to fix or replace before we move in next week."<<click " >">>
<<append "#conv3">>The boy pelts upstairs immediately. The mother looks at Iris, then smiles. "Check the downstairs with me?"<<click " >">>
<<append "#conv4">>Iris shrugs. "Sure." The pair walk into the living room together. You [[watch|DFoyer P1_T1]] them leave.
<</append>><</click>>
<</append>><</click>>
<</append>><</click>>
<</append>><</click>>

<span id="conv1"></span>
<span id="conv2"></span>
<span id="conv3"></span>
<span id="conv4"></span>

If Conditions (Harlowe)

$
0
0
I've checked the Harlowe manual repeatedly and tried searching through the forums, but been unable to find an answer:

Is there a list somewhere of what conditions are allowed in if statements?

So far I've come across: is, contains, > < >= <= (but not =< or =>)

But I'm wondering if there are any others. If someone could fill in the rest or point me towards the documentation I'm unable to find I'd really appreciate it.

Why are some of my students having issues with importing their file?

$
0
0
Some of my students were able to create and save a .html file, but today when they wanted to continue working on their story by "importing from file" they were met with this error message: "sorry. no stories could be found in this file"
I haven't experienced this issue, and it didn't happen to everyone. Any thoughts or suggestions would be greatly appreciated.

Adding a background image to a passage + making images responsive

$
0
0
Hello,

So this is a two parter for Harlowe:

1. How do I add an image into a passage and have it appear as the background and be responsive to the size of the screen (so it fills the screen no matter how big or small it gets - without distorting the dimensions though.)

2. How do I add a regular image into a passage and make it responsive like the text?

Thanks!

Reviving old macro for Sugarcube?

$
0
0
---Using Twine 2 local/downloaded version, Sugarcube 2.2 (I think), Firefox 45.0.2,---

I am using Twine 2.0, Sugarcube 2.2 (I think), and Firefox 45.0.2

I am trying to use this old Twine 1 screen-shaking macro in Twine 2 with Sugarcube 2.2. I suspect the issue lies in how v2.0 defines things, and thus probably requires far more knowledge of Javascript that I have (next to none) to fix.

What's worse, when I copy/pasted the macro's javascript into the story's javascript section (don't pity me), it actually broke the Sugarcube Cyclinglink package, so that things such as <<timedinsert>> no longer worked until I removed the old code.

I suspect this macro was a little too obscure to get updated for the new versions of twine/sugarcube.

Any help in resuscitating this poor old macro would be much appreciated!

-Liyamu

(Original macro source: https://gist.github.com/dariusk/4651698)

Here's the screenShake Javascript:
function screenShake(time) {
  console.log(document);
  var el = document.getElementsByClassName('content');
  baz = el;
  console.log(baz[0]);
  el[0].className = el[0].className + ' shake';
  if (time > 0) {
    setTimeout(function () {
      el[0].className = 'content';
    }, time);
  }
};

// the screenShake macro. Adapted from Emmanuel Turner's article on creating Twine macros. http://eturnerx.blogspot.com/2012/12/how-to-create-custom-macros-in-twine.html
try {
  version.extensions['screenShakeMacro'] = {
    major: 1,
    minor: 0,
    revision: 0
  };
  macros['screenShake'] = {
    handler: function (place, macroName, params, parser) {
      var time = parseInt(params[0]);
      if (typeof time !== 'number') {
        time = 1000;
      }
      
      // we're overriding the fade function. It behaves as usual except it runs screenShake() if time >= 0.
      fade = function (el, options) {
        var current;
        var proxy = el.cloneNode(true);
        var direction = (options.fade == 'in') ? 1 : -1;

        el.parentNode.replaceChild(proxy, el);

        if (options.fade == 'in') {
          current = 0;
          proxy.style.visibility = 'visible';
        } else current = 1;

        setOpacity(proxy, current);
        var interval = window.setInterval(tick, 25);

        function tick() {
          current += 0.05 * direction;

          setOpacity(proxy, Math.easeInOut(current));

          if (((direction == 1) && (current >= 1)) || ((direction == -1) && (current <= 0))) {
            console.log('swapping fader proxy out');
            el.style.visibility = (options.fade == 'in') ? 'visible' : 'hidden';
            proxy.parentNode.replaceChild(el, proxy);
            delete proxy;
            window.clearInterval(interval);

            if (options.onComplete) options.onComplete();

            if (time >= 0) {
              screenShake(time);
              time = -1;
            }

          }
        };

        function setOpacity(el, opacity) {
          var percent = Math.floor(opacity * 100);

          // IE
          el.style.zoom = 1;
          el.style.filter = 'alpha(opacity=' + percent + ')';

          // CSS 3
          el.style.opacity = opacity;
        };
      };
    },
    init: function () {},
  };
} catch (e) {
  throwError(place, "screenShake Setup Error: " + e.message);
}

And here's the screenShake default CSS:
@keyframes shakeit {
  0% { transform: translate(2px, 1px) rotate(0deg); }
	10% { transform: translate(-1px, -2px) rotate(-1deg); }
	20% { transform: translate(-3px, 0px) rotate(1deg); }
	30% { transform: translate(0px, 2px) rotate(0deg); }
	40% { transform: translate(1px, -1px) rotate(1deg); }
	50% { transform: translate(-1px, 2px) rotate(-1deg); }
	60% { transform: translate(-3px, 1px) rotate(0deg); }
	70% { transform: translate(2px, 1px) rotate(-1deg); }
	80% { transform: translate(-1px, -1px) rotate(1deg); }
	90% { transform: translate(2px, 2px) rotate(0deg); }
	100% { transform: translate(1px, -2px) rotate(-1deg); }
}

@-o-keyframes shakeit {
	0% { -o-transform: translate(2px, 1px) rotate(0deg); }
	10% { -o-transform: translate(-1px, -2px) rotate(-1deg); }
	20% { -o-transform: translate(-3px, 0px) rotate(1deg); }
	30% { -o-transform: translate(0px, 2px) rotate(0deg); }
	40% { -o-transform: translate(1px, -1px) rotate(1deg); }
	50% { -o-transform: translate(-1px, 2px) rotate(-1deg); }
	60% { -o-transform: translate(-3px, 1px) rotate(0deg); }
	70% { -o-transform: translate(2px, 1px) rotate(-1deg); }
	80% { -o-transform: translate(-1px, -1px) rotate(1deg); }
	90% { -o-transform: translate(2px, 2px) rotate(0deg); }
	100% { -o-transform: translate(1px, -2px) rotate(-1deg); }
}

@-webkit-keyframes shakeit {
	0% { -webkit-transform: translate(2px, 1px) rotate(0deg); }
	10% { -webkit-transform: translate(-1px, -2px) rotate(-1deg); }
	20% { -webkit-transform: translate(-3px, 0px) rotate(1deg); }
	30% { -webkit-transform: translate(0px, 2px) rotate(0deg); }
	40% { -webkit-transform: translate(1px, -1px) rotate(1deg); }
	50% { -webkit-transform: translate(-1px, 2px) rotate(-1deg); }
	60% { -webkit-transform: translate(-3px, 1px) rotate(0deg); }
	70% { -webkit-transform: translate(2px, 1px) rotate(-1deg); }
	80% { -webkit-transform: translate(-1px, -1px) rotate(1deg); }
	90% { -webkit-transform: translate(2px, 2px) rotate(0deg); }
	100% { -webkit-transform: translate(1px, -2px) rotate(-1deg); }
}

@-moz-keyframes shakeit {
	0% { -moz-transform: translate(2px, 1px) rotate(0deg); }
	10% { -moz-transform: translate(-1px, -2px) rotate(-1deg); }
	20% { -moz-transform: translate(-3px, 0px) rotate(1deg); }
	30% { -moz-transform: translate(0px, 2px) rotate(0deg); }
	40% { -moz-transform: translate(1px, -1px) rotate(1deg); }
	50% { -moz-transform: translate(-1px, 2px) rotate(-1deg); }
	60% { -moz-transform: translate(-3px, 1px) rotate(0deg); }
	70% { -moz-transform: translate(2px, 1px) rotate(-1deg); }
	80% { -moz-transform: translate(-1px, -1px) rotate(1deg); }
	90% { -moz-transform: translate(2px, 2px) rotate(0deg); }
	100% { -moz-transform: translate(1px, -2px) rotate(-1deg); }
}

.shake {
	-webkit-animation-name: shakeit;
	-webkit-animation-duration: 0.8s;
	-webkit-transform-origin:50% 50%;
	-webkit-animation-iteration-count: infinite;
	-webkit-animation-timing-function: linear;
  -moz-animation-name: shakeit;
	-moz-animation-duration: 0.8s;
	-moz-transform-origin:50% 50%;
	-moz-animation-iteration-count: infinite;
	-moz-animation-timing-function: linear;
  -o-animation-name: shakeit;
	-o-animation-duration: 0.8s;
	-o-transform-origin:50% 50%;
	-o-animation-iteration-count: infinite;
	-o-animation-timing-function: linear;
  animation-name: shakeit;
	animation-duration: 0.8s;
	transform-origin:50% 50%;
	animation-iteration-count: infinite;
	animation-timing-function: linear;
}
.shake{
	display:inline-block
}

Locally adding image as background

$
0
0
Ok so I'm trying to figure out how to locally reference an image for the background. It took some digging but I figured out how to display an image in a passage like so (done in Snowman):
<img src="C:\Users\Me\Documents\Twine\Stories\my fire emblem wife.png" width="300" height="500">

And I know that in CSS both background: and background-image: can be used to set an image as the background but I haven't been able to figure out the right code combination to actually work. I always just get a white background, and I'm not sure if this is a thing where it won't appear when I do test/play but it will show up in publication (I read this may be the case for some) but since I got the other way to show up I feel like it's just not working. Anyone have any ideas or should I just stick to referencing url's to make it easier?

Image background vs regular ol' image insert

$
0
0
How do I make:
<img src= "c:\users\dideditor\desktop\background.jpg">

Into a permanent background for my game??? If I add the above to my CSS I get a big fail and I've messed around for an hour now...

[harlowe] How do you click through options?

$
0
0
I'm still not completely familiar with the terms, so I was iffy on how to phrase this question.
Anyway, I played a couple twine-made games to see what the engine could do and a lot of them used this effect where you could click through options on the same line, and when you settled on one thing, you could move on from there.

I looked around the internet for this but I couldn't find anything, or maybe I just didn't understand them.

Getting a number from adding strings of variables?

$
0
0
Basically I'm setting monsters race, $npc.race, as either "$race1", "$race2" etc and having the actual $race1 etc being objects that house that race of monsters stats. I need to get to a number that is say, kept in $race1.variable.

So I need to be able to add $npc.race (returns $race1) and .variable together to get at the number kept in $race1.variable.

The only way I am able to figure out how to do this, it gives me strings. I have also tried Number() and parseInt(), but those return blank.

What trick am I missing?

Question about (save-game:) and variables (Harlowe)

$
0
0
So, I fashioned a save and load menu by putting a bunch of stuff in a passage with the header tag. In itself, the saving and loading works perfectly fine, but at some point I decided to add a functionality that displays an "(empty)" behind the slot name if you haven't saved to it yet and the date and time of the save, plus what chapter the player was at if they have saved to it, so now it looks like this:

{(link:"Save game")[(text-style: "underline")[Save to:]
|A>[(link:"Slot A ($SLOTA)")[(set: $SLOTA to "(current-date:)" + "|" + "(current-time:)" + "|" + "$Chapter")(replace: ?B)[](replace: ?C)[](if:(save-game:"Slot A"))[Game saved!](else:)[Saving failed!]]]
|B>[(link:"Slot B ($SLOTB)")[(set: $SLOTB to "(current-date:)" + "|" + "(current-time:)" + "|" + "$Chapter")(replace: ?A)[](replace: ?C)[](if:(save-game:"Slot B"))[Game saved!](else:)[Saving failed!]]]
|C>[(link:"Slot C ($SLOTC)")[(set: $SLOTC to "(current-date:)" + "|" + "(current-time:)" + "|" + "$Chapter")(replace: ?B)[](replace: ?A)[](if:(save-game:"Slot C"))[Game saved!](else:)[Saving failed!]]]]}
{(link: "Load game")[(text-style: "underline")[Load from:]
(link: "Slot A ($SLOTA)")[(load-game:"Slot A")]
(link: "Slot B ($SLOTB)")[(load-game:"Slot B")]
(link: "Slot C ($SLOTC)")[(load-game:"Slot C")]]}

$SLOTA, $SLOTB and $SLOTC are set to "empty" at the beginning of the game and $Chapter is set accordingly at the beginning of each new chapter. So, theoretically this should work, but what happens is this: When I click on "save game" or "load game" after saving to one of the slots, the message containing the date, time and chapter is displayed as intended. But when I load that save and then click on save or load again, it says "empty" again. At first I thought it was because the variables for the messages were actually set after the game is saved (the set macro was originally after the save-game macro), but even when I moved that part before the actual saving part (as displayed above), the problem persisted. So, why are the values for those variables not carried over after loading? It seriously doesn't make sense to me, from everything I know about how harlowe works, this should do what I want it to... It's not exactly a gamebreaking issue so I can keep working without problems, but at some point I'd like to fix this and I have no idea where the problem even lies...

Have a error report that won't go away even when *fixed*

$
0
0
So I get an error when testing my game.

Error: <<set>>: bad evaluation: Cannot read property '1' of undefined
And of course I checked and found a misspelled variable, but after correcting the misspelled variable I get the same message and hovering over the message brings up the same variable with the same spelling before I corrected it. Like this:

Before fix:
$CastlePrint to $CasstleSize

After fix:
$CastlePrint to $CastleSize

the error message still displays the first, but that is not what it says in my code:
<<set
$CastleSize to 1
$CastlePrint to $CastleSize

>>

I have tried rewriting the entire statement and copy pasting the correct spelling and closing twine to restart, but that doesn't do anything.

Audio not playing in Twine 2 (Sugarcube 2), no errors thrown

$
0
0
Hey everyone,

I'm trying to get audio playing using Twine 2, using the Sugarcube 2 story format. I've got all my code in place, but no audio is playing and there's no error being thrown. Its probably a typically stupid blind noob error I'm making, but here we go.

Just to clarify, I'm testing my audio in my story using "Publish to File" and opening it in Firefox, because I'm using the desktop version of Twine 2. The audio is stored in .mp3 form upon Dropbox in a publicly accessible folder.

Anyway, this bit of code is stored in a passage I've named StoryInit, where I'm caching all my audio.

<<cacheaudio "youre a fool" "dropbox link here">>

And then later on I try to call it in a separate passage in my story using...

<<audio "youre a fool" play loop>>

It doesn't play. There's no errors. What could I possibly be doing wrong?

Increase font size in twine passage-editor

$
0
0
Hi all. Sorry for bad english.

Is there any way to increase font-size in twine passage-editor? I mean not how the font looks "in game", but how it does for developer, when he work with text in twine local client.

Thanks in advance!

Harlowe default responsiveness of text = too small, too narrow!

$
0
0
Hi all, my game in Harlowe looks great on desktops, but when the screen is narrowed for mobile:

1. The text size goes ridiculously small.
2. There is a lot of wasted blank space on both sides of the passage.
3. The undo/redo button takes up a bunch of space, reducing text size/passage space further.

How do I solve these 3 problems? In particular I want to get rid of the undo/redo buttons.

In a Twine 1.x game I made, I used the below code to control this issue, but it doesn't seem to work with Harlowe:
/* Shrink the page when viewed on devices with a low screen width */
@media screen and (max-width: 960px) {
  .passage { font-size: 100%;}
  #passages { width: 70%; }
}
@media screen and (max-width: 840px) {
  .passage {  font-size: 100%; }
  #passages { width: 80%; }
}
@media screen and (max-width: 720px) {
  .passage { font-size: 100%; }
  #passages { width: 90%; }
}

Pathfinding in Twine

$
0
0
Hi,

I was wondering if someone can give me some pointers on how to do pathfinding for NPCs in Twine. Since passages do not necessarily correspond to locales, I don't see an easy way of doing this.

I imagine that there are some info on this already, so pointers would be great.
Thanks.

PS) I am new here, so I should remember to mention that I am using the standard format (Harlowe?).


Harlowe - Table pop-in?

$
0
0
I've just downloaded 2.0.11 to solve the issue with the default passage transition not working in Chrome. I was using a table to create rows and columns of 'doors', which seemed to be shaping up nicely. This table is now initially absent whenever you go to the passage (although the links can still be clicked on) and then pops into existence after about five seconds.

Any idea of a solution? Put it in a div that transitions in? Use an alternative to tables?

"Tags of last visited passage"

$
0
0
Hi. A question about Harlowe.

So, if I want to make mechanic that checks what tags last visited page has... how do I do it? Is it possible?

I'm having a Player Appearance passage. It can be opened any time from the sidebar. Now, I'd like to make it change according where do you open it. For example, it would add some descriptions if you open it from passage with tag "forest."

Also, a related question. Is it possible to make (goto:) move you to last passage that contained certain tag? For example, forcing player to go back to the last "forest" tag they visited.

Regarding the (history:)

$
0
0
I am using Twine 2 with Harlowe 1.2.2

In some of my passages I use the "(history:) contains" to call certain hidden text to appear later into the story.
If a player hasn't visited the passage, then the player doesn't get to see that text, and therefore sometimes certain other variables or functions aren't called because the (history:) state is false.

I'd say I use it fairly often especially with regards to preventing extra lives from being given to the player when revisiting a passage where it was given.

However, there are a smaller amount of times when it is used for other fucntions like I mentioned in the first paragraph.

That being said, I have been using the debug-startup passage/function to test certain passages. However, I can't seem to figure out a way to force the history to contain any passage history.
Is there a way?

I have something like this in the debug-startup passage:
(set: $a to true)
(set: $b to true)
(set: ((history:) contains "Passage.") to true)

But when debugging any passage to test it, it gives me an error:
"I can't put a new value into the logic value 'false'."
Which I think means it can't do what I'm asking...so to be clear...is there another way to do what I'm attempting to do?

I'd really prefer to not have to go through and set up new variables for particular passages that I later call on for these situations, but if I must, I must.

Thanks.

Is there any way to let the player choose the background color? (Harlowe)

$
0
0
And by that I mean the color applied to the entire background, throughout the entire game. Basically this:

html{
background-color: rgb(xxx, xxx, xxx);
}

Except chosen by the player, either once at the beginning of the game or at any time through a link in the header. It would be the simplest thing in the world if variables worked in the stylesheet, but as far as I can tell, they do not. Unfortunately I am not at all well versed in css, so... is there any workaround for this? I am aware that there is the (background:) macro, but that only colors the space immediately under the attached hook and I want the entire background to be filled in (plus I'd like to avoid having to manually apply a macro to literally every single passage in the game if at all possible, though if it's the only way, I'll do it...)

The Nike Air Max can be all dressed upwards inside darker glowing blue suede

$
0
0

The form regarding Nike’s <a href="http://www.niketrainersukv.co.uk/">nike air max outlet uk</a> Turbulence LS has more than a few similarities on the Air Greatest extent Travas, plus it wouldn’t end up being unjust to telephone that the particular Travas’ solution, sleek, souped-up step-brother. The Turbulence LS may be a representative in the Air flow Max household, however it doesn’t actually seem similar to you. Presenting some sort of nylon and also nylon uppers plastic protected within modest perforations, top of the rests on top of an subjected air system sole and is particularly now available in two colorways: ebony as well as hair off white. It’s your silhouette this screams athleisure, just as appropriate for the working monitor while it would be to a new unhurried Wednesday afternoon.

Surroundings Greatest extent Day time 2016 has take place and absent, but it surely appearance Nike stored a handful of great <a href="http://www.niketrainersukv.co.uk/">nike trainers sale womens</a> frees pertaining to afterwards 2010. Below, we have a peek at half a dozen impending Atmosphere Utmost THAT Payment produces within a variety of variations along with colorways including the "Infrared" plus digital camo glance over which will appease 'heads which have missed away in 2013's "Duck Camo" atmos collaboration. In a different place, there may be <a href="http://www.niketrainersukv.co.uk/">nike trainers sale mens</a> wooly takes on good deep blue in addition to dark-colored coloration clogged colorways having teeth bottoms, the exciting Pendleton-esque blended substance edition, the black-based binocular this looks to work with a street lighting offline, including a clean comprise together with navy blue canvas along with brown leafy suede. There's lots of numerous topics taking the following, but it looks like no less than some of these could discharge for a wrap.

You don’t ought to be a new garments moose to understand this denim is really a importance for every wardrobe–big or perhaps compact. This textile provides lastly found it’s strategy to feet, courtesy of Nike’s most up-to-date Air conditioning Maximum silhouette this creates good use of the item. The particular <a href="http://www.niketrainersukv.co.uk/">cheap nike trainers online</a> is all dressed upward inside dark azure suede as well as denim but it seems to be completely excellent. Suede could be the the vast majority stakeholder below as it is parked , on the mudguard, back in addition to ribbons plate giving a couple of flushes regarding denim occupying the area commonly appropriated to get mesh. That unit is usually concluded away which includes a periodontal singular plus tan suede accents to the language as well as the darkish laces to complete this away from.
Viewing all 1844 articles
Browse latest View live