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

Does anyone have Khaloopdxp's .html file on adding music to Harlow?

$
0
0
For some reason, I can't download it. The only save options I get when right-clicking it are, "Save image as . . ." and , "Save link as . . ."

Strange beginner question.

$
0
0
Hi! I've messed around a bit with Twine before, and decided to do it again now that 2.1 is available. After installing it and launching it I'm faced with this, however;

dd357aea7a.png

Yep, that's it. If I press "Twine" I can click on "Show library" or "Quit", though nothing happens if I do so. "Edit" just have options of cutting, pasting etc. I can't do anything, not even shut the program down except with the task manager. I've tried reinstalling it, and I'm using the correct version (the Win 64, as that is my OS. I've tried the Win 32 version as well, though).

Health bar in right side bar or in a status passage

$
0
0
Hey,

I'm trying to add a health and a mana bar to my game. The healthbar and manabar supposed to change their lengths when the $health and $mana values change. I have a "stowable" right side bar that uses the Sugarcube 2 style to open and close. Now, I simply add the HTML code as is:
<div class="health-bar" data-total="1000" data-value="1000">
  <div class="bar">
  	  <div class="hit"></div>
  </div>
</div>

to the story passage that is tasked to display status related data to the player. At this point I became to suspect that the structure of the HTML code (more precisely the class hierarchy) was not respected by SugarCube 2. This is because the result ended up being all over the place. Meanig that the elements did not line up on eachother rather got scattered.

Here's the CSS code:
health-bar {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  width: 200px;
  height: 20px;
  padding: 5px;
  background: #ddd;
  -webkit-border-radius: 5px;
  -moz-border-radius: 5px;
  border-radius: 5px;
  position: relative;
}
.bar {
  background: #c54;
  width: 100%;
  height: 10px;
  position: relative;
  
  transition: width .5s linear;
}

.hit {
  background: rgba(255,255,255,0.6);
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 0px;
  
  transition: width .5s linear;
}

This was obviously added to the stylesheet of the story. It addresses all 3 html elements that were declared above. We are creating a healthbar that plays a transition (we could call animation) that decreases the health bar over time leaving a lower opacity (shadow) of the health bar behind, which then aligns with the health bar that overlays it as it decreases.

Now the JavaCode is a macro that I simply add to a link and use it to decrease the health bar using a fixed value.
/% Main passage %/
<<decrease_HP>>

JS code:
// Reference the elements of the health bar
$(document).ready(function()
{
  var hitBtn = hBar = $('.health-bar'),
      bar = hBar.find('.bar'),
      hit = hBar.find('.hit');
}

// Define macro to test the health bar:
Macro.add( "decrease_HP",
 {
    handler : function(){
// grab HTML defined data values
var total = hBar.data('total'),
        value = hBar.data('value');
    
    if (value < 0) {
	// we are dead transition to game end
      return;
    }
    // max damage is essentially quarter of max life
    damage = 100;
    var newValue = value - damage;
    // calculate the percentage of the total width
    var barWidth = (newValue / total) * 100;
    var hitWidth = (damage / value) * 100 + "%";
    
    // show hit bar and set the width
    hit.css('width', hitWidth);
    hBar.data('value', newValue);
    
    setTimeout(function(){
      hit.css({'width': '0'});
      bar.css('width', barWidth + "%");
    }, 500);
    
    if( value < 0){
      // dead, dead and dead, go to Game End
    }
}
  });

Now, the code will most likely not work, because I've just written it on my phone without syntax check or linting. I only wanted to provide as much info as I could out of the top of my head until I get back to my computer.

Anyways, I have two problems with my solution:
1. The health bar HTML elements are not aligned as they are supposed (on top of eachother overlaying one another) instead they are rendered below eachother. I suspect there's a better way to define HTML in sugarcube passages, but no idea how.

2. The health bar does not react to value change, meaning the transition can't be seen nor the result of the transition (a lower health value presented on the health bar). Now, the transition part is not that important to me, but I at least want to see the results of a decreased health bar in my RightSideBar passage.

Any help would be welcome!
Thank you!

How to forbid an (if:) to repeat in a loop, once it has been displayed once ?

$
0
0
Hey again !
I'm still trying to figure out how to do stuff, and I can't find a good way to do what I want...
I'm on Harlowe 2.0 and Twine 2.1.0

Alright, so here is the thing, I'm trying to do a loop which will return to
[[Room]]

every once in a while.

When it does, I'd like Harlowe to check what is new to the story, thanks to variables (when stuff happens, I create a variable named $StuffA, and give it the value 1)

That way, I can do, inside [[Room]]
(if: $StuffA is 1)[Oh you did this !]

The thing is, once the program has said to you that you did StuffA once, you don't really want to hear about it again.
So I thought about doing :
(if: $StuffA is 1 and $said is 0)[Oh, you did this ! (set: $said to 1)]

It would work that way, I guess. But it implies for me to create a new variable $said, for each event that occurs in my story, which isn't convenient.

Does anyone know of a better way ?...

Thanks a lot !

Fake conversation using time and live ?

$
0
0
Hey there, it's me again.
I'm trying to "simulate" a conversation.
I've been trying multiple things, and discovered "Time" and "Live".

So far, here I am :
//Sent by// $name: "''Fuck off, why would you go and tell mom AND dad I didn't do shit ?!''"

(live:1s)[
(if: time >=2s and time <4s)[$nameC is writing...]\
(if: time >=4s)[
//Sent by// $nameC: $c["''Seriously ? Are you talking to me?!''"]
]\
(if: time >=5s and time <8s)[$nameC is writing...]\
(if: time >= 8s)[
//Sent by// $nameC: $c["''I told them BECAUSE you didn't do shit ffs!''"]
]\
(if: time >=9s and time <12s)[$nameC is writing...]\
(if: time >= 12s)[
//Sent by// $nameC: $c["''You didn't do ANYTHING !''"]
]\
(if: time >15s)[(stop:)]]\

(live:) checks time every second in order to show new lines of text.
It works fairly well, although I'm sure you'll have better ways of doing this, which I'd gladly receive !

There is one issue though, because of the loop nature of this method, it re-prints what $nameC says, and her text is colored.
(set: $c to (color: "#D87093"))\

Every time it prints her text anew, the color doesn't charge fast enough, and her text blinks.

Any way to go around that ? I'd really like to keep her color...

And as always, thanks for your help !




[Sugarcube 2 from 2.13 to 2.14] a story format named “SugarCube 2 (local/offline) already exists

$
0
0
Hey there,

Using Twine 2.1
I tried to replace my SC2 2.13 files with the SC2 2.14 files, I tried to move SC2 to a different location, but no dice. I still get this error when trying to add SC2 2.14 as a new story format inside Twine 2.1:
(a story format named “SugarCube 2 (local/offline)” already exists

Path
file:////C:/Users/Disane/Documents/Twine/StoryFormats/SugarCube-2/format.js

Any help please?

[Snowman] story.render failing

$
0
0
I apologise for asking this since I know very little Javascript to work with Snowman, but I've done great advances porting my Harlowe game to Snowman.

I have these two passages:
::render
<%= story.render("content") %>

::content
<a style="color:red" id="hook">Link</a>
<script>
	$('#hook').click(function () {
			story.show("render")
		})
</script>

You run ::render, it displays ::content, with a link that when clicked runs render again. It works perfectly.

Now change ::content like this:
::content
<a style="color:red" id="hook">Link</a>
<script>
	$('#hook').click(function () {
			story.show("render")
		})
</script>

Some other text.

And now, the story.render() function fails with an Unexpected token message.

Can you tell the reason for this? My final goal is building a loop that renders several passages like ::content next to each other.

Thanks!

Randomized backgrounds per passage

$
0
0
Hello! I've been trying to add backgrounds to specific passages in a Harlowe Twine 2 project using javascript. It's fairy easy to show a random background image from a directory attached to <body onload="..") but that would only randomize the background when reloading the game, which is not what I want.

The closest thing to a solution I have seen is this- http://twinery.org/forum/discussion/2529/harlowe-1-0-1-javascript-dynamic-background-images which is doing something with hidden inline images that doesn't quite make sense to me.

Is there another way to do this? Again, what I am attempting is to pick a random numbered image from images/ as a page background, but only for specific passages.

Thanks in advance!

Twine creates an empty Applications folder in my home directory each time I start it.

$
0
0
I am not sure if this is a bug or if I did something wrong.

Each time I start Twine, it creates an empty folder in my home directory. Funny enough it even sets the folder icon to be the same as the system Applications directory. Of course I delete this folder as soon as I see it. Some software (annoyingly enough) creates directories in my documents folder, but the home directory usually doesn't get polluted except for the usual "\..*"-files.

If Twine creates this on purpose (e.g. to store your compiled stories) - is there a simple way to change this?

Blank screen on debug/play -- how do I avoid? Sugarcube 2

$
0
0
Hi, I'm new to Twine (and loving it) but I am having a lot of problems intitialising the game either in debug or play mode. Most frequent problems are:

On debug/play, it returns to a story screen with only 1st version of my story saved (???)
On debug/play, it loads a blank white screen and nothing happens

Currently, I am struggling with the blank white screen. In the past, if I reloaded Twine a few times, it would work, but now there isn't anything I can do and it provides no information about what is wrong.

Would love it if anyone has any ideas as to how to get past this!

Using Sugarcube 2 on desktop version

Problem switching to Twine 2.1 on Linux

$
0
0
I'm trying to get Twine 2.1 running on my computer, but it's not running properly. I'm running Linux Mint 18 MATE ("Sarah").
I had no problems with Twine 2.0, and I can still run it fine.

When I run 2.1, however, I get this error:
Spoiler:
ERROR:desktop_window_tree_host_x11.cc(1131)] Not implemented reached in virtual void views::DesktopWindowTreeHostX11::InitModalType(ui::ModalType)

It still opens the program and I can make and import stories, but:
1. Selecting "Show Library" does nothing.
2. Quitting/Exiting doesn't work. I have to manually shut it down from the terminal (and nothing saves when I do this).
3. When I open the imported story (the one I made in 2.0), I get the following error in the terminal:
Spoiler:
var o=t.staggerAnchor;o||(o=t.staggerAnchor=yt("stagger-anchor"),o.__v_frag=t),it(o,n);var a=t.staggerCb=k(function(){t.staggerCb=null,t.before(o),ot(o)});setTimeout(a,i)}else{var s=n.nextSibling;s||(it(this.end,n),s=this.end),t.before(s)}},remove:function(t,e,n,r){if(t.staggerCb)return t.staggerCb.cancel(),void(t.staggerCb=null);var i=this.getStagger(t,e,n,"leave");if(r&&i){var o=t.staggerCb=k(function(){t.staggerCb=null,t.remove()});setTimeout(o,i)}else t.remove()},move:function(t,e){e.nextSibling||this.end.parentNode.appendChild(this.end),t.before(e.nextSibling,!1)},cacheFrag:function(t,n,r,o){var a,s=this.params.trackBy,u=this.cache,l=!y(t);o||s||l?(a=ke(r,o,t,s),u[a]?"$index"!==s&&"production"!==e.env.NODE_ENV&&this.warnDuplicate(t):u[a]=n):(a=this.id,i(t,a)?null===t[a]?t[a]=n:"production"!==e.env.NODE_ENV&&this.warnDuplicate(t):Object.isExtensible(t)?b(t,a,n):"production"!==e.env.NODE_ENV&&Ur("Frozen v-for objects cannot be automatically t

TypeError: Cannot read property 'major' of null
at VueComponent.loadFormat (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:9:28014)
at VueComponent.<anonymous> (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:91:1885)
at VueComponent.loadFormat (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:7:1149)
at VueComponent.ready (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:60:28233)
at VueComponent.En.t._callHook (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:8:4283)
at VueComponent.n (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:8:11547)
at VueComponent.n (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:8:10239)
at VueComponent.Hn.t.$emit (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:8:10933)
at VueComponent.En.t._callHook (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:8:4299)
at e (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:8:8994)

and again, no changes save.

The program itself is in my /opt folder, while the stories are stored in ~/Dokumente/Twine/Geschichten (my OS is in German).

I can continue to use 2.0, but I would like to know if anyone can figure out what's going wrong. Thanks for your help.


Side question:
Whenever I open Twine 2.0, it sets the permissions of my ~/Dokumente/Twine/Geschichten folder to 'dr-xr-xr-x 2'
Even if I change it with 'chmod 755 Geschichten' to 'drwxr-xr-x 2' it switches back whenever I open the program. Is this normal/necessary?

[SugarCube 2.12.1] Modifying sidebar CSS during passage transitions

$
0
0
Hi,

I'm trying to add a mechanic to my story where the background color of the sidebar changes to reflect the time of day in the story, which passes by in real time and can be sped up and slowed down. This system I've written works pretty well while a passage is being displayed, but creates visual artifacts during passage transitions.

Long story short, I use setInterval() to create a game tick, and during each tick I update the game's internal clock and update the styles on various elements.

During a passage transition, some time after PassageDone, the StoryCaption is redrawn and the custom styles are reverted to default. The styles are corrected during the next game tick, but this leaves a few milliseconds where everything is the noticeably the wrong color.

Is there a better way to dynamically recolor the UI bar? Failing that, is there some way to reliably hook into UI bar updates so I can reapply custom styles before those updates are rendered?

Relevant snippets of code below:

StoryInit Passage
<<set $game_clock to new Date(Date.UTC(0, 0, 1, 12, 0, 0))>>
<<set $time_factor to 1>>
<<run window.setInterval(window.gametick, 33)>>

Story Javascript
// ...
window.lastTick = new Date().getTime();
window.gametick = function() {
    var now = new Date().getTime(), 
        interval = now - window.lastTick;
    window.lastTick = now;
    
    window.timeSystem.addTime(interval);  // updates $game_clock
    window.uiSystem.updateUI(); // modifies DOM
}
// ... 
window.timeSystem = {
    addTime: function (interval) {
        var clock = variables().game_clock,
            timeFactor = variables().time_factor;

        clock.setTime(clock.getTime() + (interval * timeFactor));
    },
    // ... 
}
// ... 
window.uiSystem = {
    // ... 
    updateUI: function () {
        var time_system = window.timeSystem;

        // calculate new background colours based on current game time
        var bgColor = this.getTimeGradient(this.colors.bgPanelDay, this.colors.bgPanelDelta),
            textPanelColor = this.getTimeGradient(this.colors.textPanelDay, this.colors.textPanelDelta),
            dropShadowColor = this.getTimeGradient(this.colors.dropShadowDay, this.colors.dropShadowDelta);
		
        // update any DOM elements displaying the current time and date
        jQuery(".timespan").text(time_system.getTime());
        jQuery(".dayspan").text(time_system.getDays());

        // recolour the background, using the new colors
        jQuery("#ui-bar, #ui-bar-2").css('background-color',  bgColor);
        jQuery("body, .story-box").css('background-color', textPanelColor);
        jQuery("#ui-bar, #ui-bar-2, .story-box").css('box-shadow', '0px 0px 5px 0px '  + dropShadowColor);
    }
    // ... 
};

Harlowe Formatting Problem

$
0
0
I decided to move up to Harlowe 2.0.0 since there are new macros that I wanted to use. The problem is, there is no formatting in my passages. Macros are normally pink, strings are blue, etc. Everything is plain black text. I don't know if this is supposed to be happening or if it's because I changed a 1.2.3. Harlowe project to a 2.0.0. project.

I am currently using 2.1.0. Windows 10 32-bit version of Twine. Is this normal or is there an error on my side?

As a side note, I got the formatting to come back randomly, but then none of the 2.0.0. macros were recognized.

SugarCube 2.13.0 — controlling all playing audio and making it fade out?

$
0
0
From the documentation I see that there's ways to play, pause, and stop audio through the group IDs, but do the other commands work for those group IDs as well? I'm trying to fadeout all playing audio rather than hard-code the fadeout by hand but this:
<<audio ":playing" fadeoverto 3 0>>

doesn't appear to do anything.

Is the playlist method the only way to accomplish this?

Background image won't fill window(width) SugarCube 2.12.1

$
0
0
Using SugarCube 2.12.1, I am having trouble getting the background image to fill the window without it wrapping. The image fills height and two thirds width and then fills the rest of the right side with a wrap of the left third.
I have tried this:
# body.forest { background-image: url(h++p://myimage.jpg);
# position: fixed;
# top: 0;
# left: 0;
# min-width: 100%;
# min-height: 100%;
# }
Can anyone help me out with the correct solution?
Thanks

counter tecnique

$
0
0
I'm using Harlowe 2.00. I've tried to set a variable to 100 and then count backwards: (set: $SunCollission to it - 1) The problem is that this does not count backwards. What is a better counting method?

Thanks.

Can anyone see what I messed up here?

$
0
0
I had this working so that their was a background image with the text and links formatted and justified to the right with a small margin. Tag map is set to the passage in question twine 2.1 sugarcube 2.12.1
#ui-bar {
	display: none;
}

body.map {
  background-image: url(http://i.imgur.com/EzI203S.jpg);
  background-attachment: fixed; 
  background-repeat: no-repeat;
  background-size: contain; 
 }
body.map passage {font-family: New Times Roman, Times, Serif;
   font-size:30px; color: white; margin-right:20px; text-align:right;  
}

body.map a { 
  color: orangered; 
}

body.map a hover { 
  color: crimson; 
}

Am using audio macros but no audio will play? (Sugarcube 2)

$
0
0
I am attempting to make a looping background music track that won't restart every passage. I am using these macros in my StoryInit passage:

<<cacheaudio "bgm" "Audio/temple_of_the_mystics.wav">>
<<audio "bgm" loop play>>

My audio is saved in the twine stories folder, in a subfolder called "Audio" as above

Is it just because a .wav is too big to load? I'm trying to get the structure in more than anything.

Any advice would be much appreciated! I'm sure I'm missing something obvious.

Any progress on proofing formats?

$
0
0
This has been brought up before, but not fully addressed. Is there a proofing format that will allow the passage names to be selected along with the rest of the Twine? Right now, the paperthin 1.0 doesn't allow the passage names to be copied and there is no print function. This is a significant issue for teachers using Twine. Right now I have my students pasting to notepad then manually retyping the passage names. Any suggestions?

Check if a day have past, and make a calcul.

$
0
0
Hi,

Here is the calendar I use : Here

My Question is :

Is it possible with the widget above, that at the end of a day a calcul is done? something like :
set $GMoney+=((random(1, 3)*$Population)/2)

And don't do that on Sunday. (I'm sure it will be to simple if I don't put a condition ;))

Thanks.
Viewing all 1844 articles
Browse latest View live