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

Items in bulleted list appearing before body text - Twine 2.1.1 Harlowe story format

$
0
0
Hi there,

I am writing a mystery novel (in Portuguese) and I am placing the action choices at the end of the passage, using the bulleted list markup (similar to Birdland Camp). When I play the story and reach a passage with bulleted items they are always shown immediatelly and the body text after. It's seems like the bulleted items are not afftected by the default transition effect. And this is a bit of a bummer, revealing the options before showing the text.

Does anyone have this problem and/or knows how to solve it?

Here is a bit of what I'm doing (though is in Portuguese I think you can follow the logic)
— Isto vai demorar muito? É que tenho uma reunião importante daqui a uma hora — disse Raul, mostrando impaciência.

* [[Vai demorar o tempo que for preciso...|tough]]
* [[Vamos começar em breve. Só precisamos de mais uns minutos.|polite]]

Thanks everyone!

José

Why element appended to DOM is not avaliable immediately after $(content).append(child)?

$
0
0
I'm using Twine 2.0.11 and SugarCube (v1.0.34) bundled with it.
I'm playing with some JavaScript and found something I don't quite understand.
Why element appended to DOM is not avaliable immediately after $(content).append(child)?

(1)
prerender["addSomethingToDom"] = function (content) {

	if (tags().contains("dynamic")) {
                               
        var child = "<div class='game' id='one'></div>";
        var grandchild = "<div class='game2' style='width:20px;height:20px;background:white' id='two'></div>";
        $(content).append(child);
        
        var target;
                
        target = document.getElementById('one');
        //target not defined...
        $(target).append(grandchild);
        
        //but if we wait 10 ms it works
        waitForElement('#one',function(){
            target = document.getElementById('one');
            $(target).append(grandchild);
        });        
    }
}

(Not shown: waitForElement function body, but I think it's irrelevant)

In jQuery I can write, for example:

(2)
$('#main-div').mouseover(function() {

        var child = "<div class='game' id='one'>Dynamic!</div>";
        var grandchild = "<div class='game2' style='width:20px;height:20px;background:red' id='two'></div>";        
        var grandgrandchild = "<div class='game3' style='width:40px;height:20px;background:green' id='three'></div>"; 
        $('#main-div').append(child);        
        var target;        
 
        target = document.getElementById('one');
        $(target).append(grandchild);
        target = document.getElementById('two');
        $(target).append(grandgrandchild);
});

And it works, append after append.

As for my SugarCube example, I've found a workaround by adding a timeout, although I'm not fond of this solution.
I am interested in understading what's a difference between (1) and (2), so I can implement something more elegant.
Anyone care to elucidate me?

PS.
I know I can chain appends i.e. $(content).append(child).append(grandchild); that would solve this particular case.
But my original code is a little different and doing this is not an option.

Install on Linux

$
0
0
Hi all ~
I'm trying to install Twine 2 on Debian, but its not clear what to do after I download and unpack the .zip file. Running ./Twine in the terminal twine folder first told me i was missing libnss3.so, so i installed that and now its telling me I'm missing libcups.so.2, which i can't find a package for in debian. im also just worried that im in a mad chicken race after all these packages. I don't understand why there's not a requirements.txt folder, so i can just download the dependencies in an easier way... I think I'm just doing something very wrong?
I have twine 1 installed (from github), that was a very easy clear install. Im very confused and just want to get this to work, please offer any advice you may have, if you installed Twine on Linux before how did you do it?

Harlowe 2 Passage editor bug?

$
0
0
Help, this is driving me crazy:
5Lo7jky.png
Does it only happen to me??
That "line count dot" hides the text I'm writing it REALLY bugs me.
Only happens with Harlowe 2.
Happened to me on the online editor, with Firefox AND Chrome, and also on the offline Twine software.

Assigning Stats

$
0
0
I think I'm in the right place for this question. If not, please let me know.
Okay, into the question: How can I set up an initial stat assignment? And I'm using Harlowe btw.
I just started using Twine 2 for my courses in Game Design. I love Twine and have so many great ideas that I want to keep working on this story I'm making even after the assignment for school is done. So, I've set up stats for the player to have that I want to have checks later on for and I can't seem to find anything by searching that will help me set this up properly. So far I have this:
<img src="https://twinery.org/forum/uploads/Uploader/61/d5415f3ff56baaff43ffa12df9384e.png" />
This is the page where stats are explained to the player/reader and then they get to choose which stat they want their first (out of three) initial points put into. Once the player clicks one of these it'll go to this page:
<img src="https://twinery.org/forum/uploads/Uploader/94/9ed90f01cee33ea154ba2c878e0140.png" />
However, when I test this Second Point page I get this:
<img src="https://twinery.org/forum/uploads/Uploader/da/e0faf4b3cd534a0160d0591a75032c.png" />
I clicked Strength as the first point so what I wanted to happen is it read:
Strength (2)
Intelligence (1)
Dexterity (1)
Endurance (1)
Agility (1)
Speed (1)
Instead, it's apparently changing ALL the stats to 2 instead of only the stat clicked in the first point assignment page.
Perhaps I'm missing something stupidly simple but like I said, I just started working with Twine 2 and I'm honestly proud of how far I've gotten so far. Am I maybe missing something like "if this is clicked then add 1 to $str? Because in debug mode I'm seeing it running all of those (set:$stat to $stat+1) instead of only the one being clicked.

More if questions

$
0
0
Twine: 2.1.1
Harlow: 2.0

Ok so, I've been working with Harlow on and off today and I've come to something that has me stumped. In a normal programming language it would be simple, but I'm not sure how to proceed with Harlow.

So the idea that I want to run with is to have long passages slowly build themselves as the user makes choices. Basically, scenes evolve as a whole rather than one passage to the next.

For instance:

Name?

(Choices
Dennis
Hailey)

(User chooses Dennis and both choices vanish and a new block of text appears:)

Nice to meet you Dennis, how old are you?

(Choices
18
25)

Etc.

This is something I used to do in Quest Text, but everyone told me to move to Twine so that's what got me here.

So I've figured out that I need to use Hooks, so I've got:
"Name?"

["Jesse Jackson"]<nameDisplay|
["Taylor Swift"]<nameDisplay|

(click: ?nameDisplay)[(if: ?nameDisplay is "Jesse Jackson")[Right] (else:)[Wrong] ]

e0c26fd869c73fd84449e2de3d66aeba.png

I attempted to convert the ?nameDisplay to a variable ($nameDisplay) but I think I'm missing something?

Impossible to importe an archive file

$
0
0
Hello !
Sorry to bother the community, but I run into an issue that is rather new to me.
I've written a story, and exported it to an archive file. When I try to reimport it on my computer (a Mac with OSX.11), it works, no matter which browser I use. But when I try to share it with other people it doesn't. They click on the "Import from file" button and select the aforementioned file, and the software loads for a second, but then nothing shows up on the stories page. The miniature of the story they would be supposed to click on in order to access the source never shows up. It's as if the file I sent them was blank - not even an error message is displayed.
Would you by any chance have a hint on what may cause this?

Back to last passage and random generation

$
0
0
Twine version 2.1.0
Sugarcube 2.21.1

I'm currently writing a Twine game for my University assignment but I've got a few obstacles I can't overcome.

Within some of my passages, I've got descriptive passages which appear in multiple locations. I'm having trouble creating a "Back" link which returns to the previous passage.

The other query, I'm trying to create a passage which randomly generates a street of buildings using some basic parts.

StoryInit
<<set $Shops to either("Large grocery store","A small brothel")>>
<<set $House to either("A single room apartment","An unlit dormitory")>>
Streets
While walking through the alleys, you pass <<print $Houses,$Shops,$Houses>>

If someone could be kind enough to help, I'd really appreciate it.

Many thanks

Using and Updating the StoryMenu?

$
0
0
Hello, i am trying to learn how to use the StoryMenu in a dynamic way.

How would you go about updating the StoryMenu from passage to passage? Say if you have simple day system that would display Monday to Sunday with a string, and have a go to sleep passage, which would then progress to the next day and display that in the StoryMenu?

Also if you have simple value like an integer or something like.

Thanks :)

checking for specific object within array

$
0
0
Twine 2.1.1
Sugarcube 2.14.0

I have recently switched to Sugarcube from Harlowe and after watching some videos on youtube and implementing the inventory system from the Twine Wiki, i have run into a problem.
I want to be able to check if i have a specific object in my inventory array, but what works for values does not work for objects.

I'm new to programming in general and the idea at the moment is to prevent the player from picking up the same items twice.
<<if $inventory.indexOf("$sword") == -1>>
<<linkreplace"Pick up the sword">>//You've picked up the sword!//<<addToInv $sword>><</linkreplace>><<else>>There used to be a sword here.
<</if>>

The object is successfully added to the inventory and i can print it and its values just fine, but when i return to the same passage where i got it, i can pick it up once more.

The code works as intended if it's just "sword" instead of "$sword".

I'm probably going about this all wrong, but i have not been able to find anyone else doing something similar so i turn to you. Does anyone know how to make this work?

[Twine 2.1.1][Sugarcube 2.14.0] checking for specific object within array

$
0
0
I have recently switched to Sugarcube from Harlowe and after watching some videos on youtube and implementing the inventory system from the Twine Wiki, i have run into a problem.
I want to be able to check if i have a specific object in my inventory array, but what works for values does not work for objects.

I'm new to programming in general and the idea at the moment is to prevent the player from picking up the same items twice.
<<if $inventory.indexOf("$sword") == -1>>
<<linkreplace"Pick up the sword">>//You've picked up the sword!//<<addToInv $sword>><</linkreplace>><<else>>There used to be a sword here.
<</if>>

The object is successfully added to the inventory and i can print it and its values just fine, but when i return to the same passage where i got it, i can pick it up once more.

The code works as intended if it's just "sword" instead of "$sword".

I'm probably going about this all wrong, but i have not been able to find anyone else doing something similar so i turn to you. Does anyone know how to make this work?

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!

Can I add a scrollbar to a specific passage in sugarcube v 2.14.0

$
0
0
I'm having a minor issue with one of my passages in twine. I have a sort of store page set up, with numerous options for things to purchase, HOWEVER I have too many items to fit on to a single page unless i fullscreen the game. Is there a way that I could add a scrollbar that would appear in the non-full-screened version of my game?

Statement with "(If: $value1 is false OR $value2 is false)"

$
0
0
Hello everyone !

I'm completely new to Twine. I tried a first simple story, but then of course I wanted to complicate it a bit, and that's when everything went wrong :)

Here's my problem : I created a story with 3 rooms to look into. The player has to go into the 3 rooms or into 2 specific one of them to continue with the journey. Let's call the rooms $room1, $room2 and $room3.

So basically :
- The player goes to $room1 and $room2 (or $room2 and $room1) then $room3 --> He follows the journey
- Or he can go to $room3 first, then $room1 and $room2 (or $room2 and $room1) and at this point he is forced to go back to $room3 again to continue (a text "come back to $room3" appears when this is the path chosen).

What I want Twine to understand is this :
If the player went to $room1 <b>OR</b> $room2 when he gets to $room3, then a specific text appears <b>AND</b> he can visit [[room1]] if that's the room he didn't go into, <b>OR</b> [[room2]] if that's the other one.

I thought this could work :
(if: $room1 is false or $room2 is false)[Specific text]
(if: $room1 is false)[ [[Go to room1]] ]
(elseif : $room2 is false)[ [[Go to room2]] ]

But it doesn't work... I'm wondering if this can be linked to the fact that there is a lot of different conditions according to the path the player chooses ?

Cause there are 3 possible ways :
(If: $room1 is true <b>OR</b> $room2 is false)[specific text 1]
(If: $room1 is true <b>AND</b> $room2 is true) [specific text 1 + <b>[[New path]]</b> ]
(if : $room1 is true AND $room2 is true <b>AND</b> $room3 is true] [specific text 2 + [[New path]] ]

I'm sorry if I don't explain very well ! I'd really, REALLY appreciate if you could give me your ideas about how to make it work ! Thanks a lot !!! :D


Health/Cooldown Bars (sugarcube)

$
0
0
Hello all,

I've been working on an action RPG combat system using twine, and I've been using the <<repeat 100ms>> and <<replace>> macros to dynamically update player health bars, and cooldowns to the next enemy attack.

I used this method for my health bars: https://twinery.org/forum/discussion/2751/health-bars
But due to the rapid replacing of such health bar images every 100ms, the health bars don't update smoothly at all, and rather they flash rapidly.

My new idea was to just create an entirely new set of updating health bars using Javascript and/or html/css. But I have no idea where to start (even after months of learning javascript and css, I'm still lost when it comes to complicated coding).

https://www.w3schools.com/w3css/w3css_progressbar.asp I've been reading up on using a css progress bar, and triggering a move() function using javascript. However, I already have some complex "damage calculations" in place using the default Sugarcube macros, and I have no idea how to use those story variables to affect the css progress bar's width %.

Here's an example of :
<<repeat 100ms>>
    <<set $enemy_cd to $enemy_cd - 1>>
    <<if $enemy_cd <= 0>>
        <<set $enemy_cd to 0>>
        <<enemy_attack>>
        <<stop>>
    <</if>>
<</repeat>>


My <<enemy_attack>> widget basically resets the $enemy_cooldown variable to 50 (basically the enemy attacks the player every 5 seconds) and restarts the repeat macro.

I guess this explanation has been rather long-winded, but what I'm ultimately trying to achieve is to use a css progress bar, and get javascript to "use" the $enemy_cd variable to determine the % of the progress bar's width value... i.e. when $enemy_cd is 50, the width of the bar is 100%, and when $enemy_cd is 0, the width of the bar is 0%.

Can anyone help? ;_; I've been really struggling with javascript functions.

Include Macros Does Not Exist

$
0
0
I tried using:
<<include "passage">>
I checked the documentation and it said it was added on 2.15. I'm currently using 2.16.

Edit: Twine didn't change the story format of the story. It still runs are 2.12.
Although, I tried it again on a newly created story and it still doesn't work.

Adding a mouseover/hoverfunction that activates hidden passage links (Twine 2, Sugarcube 2)

$
0
0
I was wondering if it is possible to add a function in Twine 2 where a player is taken to a new passage when they move their mouse cursor over a certain text. For example, if there is a bit of text that says: "Don't look at the black cat", and the player is taken to a new passage if they move the cursor over "black cat". I am using Sugarcube 2. Any help would be greatly appreciated!

The if, either, and set functions. NEED HELP! T2.0

$
0
0
Ok so I'm at a part in my story where depending on how long you take inside a house, depends on the scene in the next passage. Basically I want to have an either function generate 5, 10, 15, or 20 and then depending on which one of those numbers it is, depends on which passage you are taken to when you click on the link for the next passage. The passages are the same scene, just happening differently. So for instance if you spend 5 or 10 minutes in the house, then the next passage finds you walking up on two men talking to one another. However, if you spend 15 or 20 minutes in the house, then clicking the link to the next passage will have you in the same scene, but instead of talking the two men are already fighting with each other. I tried setting a variable to the either function, and then using the if function to check the variable and then use a go-to link, but I'm just not doing it right. Theres something I'm missing. Any help is much appreciated. Thank you.

SugarCube not available as a format

$
0
0
SugarCube used to be available as a format, now it doesn't show up at all. I try to install the format.js and Twine states that SugarCube is already there. I have tried this in 2.1.0 as well as 2.1.1

I try to run a story written in SugarCube and nothing happens. Any ideas?

download link for 2.1.0?

$
0
0
Version 2.1.1 has a bug that won't let me add new story formats so I was wondering if anyone had the download link to 2.1.0.
Viewing all 1844 articles
Browse latest View live