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

Remove duplicate values from an array (when you don't know where/how many duplicates may exist)

$
0
0
Hi everyone,

I'm working in Harlowe Twine 2.0.

I am creating an in-game vocabulary assessment that tests players as they progress through the game. I have an array $questCompleted1 which includes a list of datamap variables $vocab1, $vocab2, $vocab3. I am using the array $vocabAssessment to add arrays from completed quests to another array so that I can randomly select a vocab variable to test the players based on completed quests. Now I would like that as players complete additional quests I could add an array from other quests to the array $vocabAssessment. So something like, the following: (set: $vocabAssessment to it + $completedQuest2) where $completedQuest2 is equal to ($vocab3, $vocab4, $vocab5). The issue is that now $vocabAssessment contains $vocab1, $vocab2, $vocab3, $vocab3, $vocab4, $vocab5)... $vocab3 is produced twice. Is there a way to remove duplicates in an array?

linkappend within a linkappend

$
0
0
What do I need to change? right now when I click on "Click1 it prints line 2 and 3. I want it to print only line 2 with the "click2" that would then print line 3

example text 1 <<linkappend "click 1" t8n>>,

example text 2 <<linkappend "click 2" t8n>> <</linkappend>>.

example text 3 <</linkappend>>.

Sugarcube 2: How to put text into a box

$
0
0
I tried a few searches but couldn't find any code that would allow me to display story text in a box. I am very new to CSS so it is possible that I don't even know what I'm looking for. I searched text box, story box, text border.
Does anyone know what I'm talking about and how to do that?
Thanks

Processing order?

$
0
0
Hello again, guys.

Just a little Question:

What is the Processing-Order for Passages in twine? As far as i know, HTML documents are processed from the most inner to the most outer Level. But how work the twine-based syntaxes? If i look at the if-cases, i would assume it works srictly from the top to the bottom, but can i rely on this?

For exaple, i have a widget, that stores a value into a variable, and then the variable is printed in a passage. So, can i be shure that:
<<widgetXY>>
<<print $VarXY>>

will work correctly, or should i use a slighlyx more weired syntax like
<<div>>
  <<div>>
    <<widgetXY>>
  <</div>>
  <<print $VarXY>>
<<//div>>

or else, to force the needed order?

Thank you!

Harlowe - displaying a link to a passage if the player visited another passage

$
0
0
I'm trying to create a story where the outcomes change depending on which order the player explores a house. For example, if a player visits room X first, they will be unable to visit room Y, but they can still visit room Z.

Here's the code I'm trying to use:
(if: (history:) contains "Bathroom") [
[[Kitchen.]]
]
[[Bedroom.]]
[[Living room.]]


I get this error message:
"The (if:) command should be assigned to a variable or attached to a hook."

What am I doing wrong?

Twine 2.0 in iPhone

$
0
0
Is it possible to download Twine 2.0 to an iPhone?
I want to show a story prototype on my iPhone. But when I download it in html format from my gmail, it shows nothing.
Any solution to this?

Twine Sugarcube Image Border

$
0
0
I'm trying to create a sort of Turn Based Strategy game. For this I've divided my map into 64 pieces, however I can't figure out how to mark each section as being in player or enemy possession. The idea I had was to use either red or blue borders, but I literally can't find anything about doing that.

I'm using Sugarcube 2

Fadeout issue (Sugarcube 2.11.0)

$
0
0
I'm using the following to fade out text, in order to simulate death/gameover.

The problem I have is that once the text has faded away, it pops back up again and remains on the screen.

How would I adapt this so that once the text has faded away, it remains gone?
body.gameover .passage {-webkit-animation: fadeout 10s;
       -moz-animation: fadeout 10s;
        -ms-animation: fadeout 10s;
         -o-animation: fadeout 10s;
            animation: fadeout 10s; width: 500px; margin: 250px 0 0 50px; }
@keyframes fadeout  {from {opacity: 1;} to {opacity: 0;}}

Thanks in advance.

How do I link variable images with

$
0
0
<<set $pies = [ "Blueberry", "Cherry", "Cream", "Pecan", "Pumpkin" ]>>

  <<set _x = $pies.pluck()>>


<<set $x = $pies.pluck()>>

 
I'll choose the <span id="pie"></span>, please.\
<<timed 3s>><<replace "#pie">><<link "OPTION 1" >><<print '<img src="' + $x + '.jpg" height="100" width="100">'  >> <<goto _x>> <</link>><</replace>>\
<<next>><<replace "#pie">><<link "OPTION 2" >><<goto $x>><<print '<img src="' + $x + '.jpg" height="100" width="100">'  >> <</link>><</replace>>\
<</timed>>
This doesn't work.
<<link [img[$x][$x]]>> <</link>> 
This ,while not what I want to set out to do, also doesn't work for various reasons which I dont understand. First <<link>> only reads $x as $x and not as a value from an array..

Okay, I got the image to work by putting the <<print ...>> code before the <<link>>.

That made me realize that the image will be the same one each time unless I can print $pies.pluck() instead of $x for the <<print>> image variable.

Perhaps a loop..



Edit 3:
IT works
<<timed 3s>><<replace "#pie">><<link "OPTION 1" >><<print '<img src="' + $pies.pluck() + '.jpg" height="100" width="100">'  >> <<goto _x>> <</link>><</replace>>\
<<next>><<replace "#pie">><<link "OPTION 2" >><<goto $x>><<print '<img src="' + $pies.pluck() + '.jpg" height="100" width="100">'  >> <</link>><</replace>>\
<</timed>>
Suddenly $pies.pluck() works for me and now my code goes through different random images.

I was used to $pies.pluck() not working
because of stuff like this
<<link [[$pies.pluck()|$t]] "$t">><</link>>

Chat Bubble-Like Stylesheets/Twine 2, Harlowe

$
0
0
Does anyone have any good examples/codes for a style sheet possessing the livelihood of a modern texting application? Specifically in the Harlowe Story Format?

linking to a twine game from inside a twine game

$
0
0
Basically I want one of the endings in story 1 to link to the start of story 2
I guess I need to publish story 2 first and put a clickable url in the passage of story 1. Is there a way to do that?

sugarcube2
2.11

how can i implment dropdown list in sugarcube 2

$
0
0
i would like user to select one of the values from a dropdown.
they will eventually be navigated to a passage which depends on the value they chose.

how do i implement this in sugarcube 2/twine 2

thanks

How Do you get an Inventory button to show up on the side bar in SugarCube format for the Twine vers

$
0
0
the Twine version before the Beta that is out. Also what do you put in the JavaScript passage?

[Harlowe] Arrays/Datamaps, creating a timetable

$
0
0
Harlowe, Twine 2. I was hoping someone could help me work through what I'm trying to accomplish. I've read up on arrays and datamaps but don't yet have the full sense of all the possibilities of those two things.

I want to create a train timetable that as the player moves from passage to passage it reduces each train arrival time and when the first reaches zero, it's removed it from the list and a new one is added at the end of the list. Each train has a "time", "color", and a "direction".

I've written the following array that refreshes itself exactly how I'd like but since it's an array it only handles one set of the attributes I want: "time". Ideally the other attributes follow "time" as it counts down.

In a preceding passage I set:
(set: $time to (array: (random: 3,4),(random:6,7),(random:9,10)))

[[Next|test]]

Then this reduces the "time", moves the first index to the end when it reaches 0, and shifts the others down:
(set: $time's 1st -= 1)
(set: $time's 2nd -= 1)
(set: $time's 3rd -= 1)

(if: $time's 1st < 1)[(set: $time's 1st += (random: 9,10))(move: $time's 1st into $time's 4th)]

(print: $time)

[[Refresh|test]]

Datamaps seem the best way to manage the various attributes needed for each train, but as far as I've been able to figure they don't store their data in a particular order like arrays. Therefore I can't shift the indexes in the same way. Any thoughts or ideas?

Using a variable to change variables linked to that variable in sugarcube

$
0
0
For my game I have 64 areas, each area has three slots for a commander with their own respective troop numbers, morale and special ability.

I want to make it possible to remove or assign commanders to each area, as well as assign or remove troops or influence their individual morales through a general management screen.

What I currently did (which is most likely extremely messy) is assign each area with a number and then have each area have it's own variables for each commander (area1commander1, area1commander 2, area2commander 1 etc.)

The only way I can think of to change this would be by using a lot of if statements in the management screen.
Example:
<<if $area is 1>><<set $area1commander1 to $chosencommander1>><</if>>

This will be extremely inefficient and messy though. Is there a better way to do this?
Thanks in advance

Using a timed response function

$
0
0
So I'm really new with Twine and I'm working on a project just to familiarize myself with twine. Here's the scenario , my introduction has some text (with two links underneath). After 2.5 seconds if the player hasn't clicked on anything I want the game to automatically take him to another piece of text. I've created this text and named it "The End". Here is the code I've used
{(live: 2.5s) [(goto: "The End")]}

Is this wrong ? If so, how to make it work ?

Is there a way I can add variables to the sidebar?

$
0
0
I'm using Sugarcube 2 and I was wondering if there was an easy way to just add a few variables to the sidebar that way they are always tracked.

Just simple things like the time, location, currency, etc...

Sidebar elements order (Sugarcube 2.11.0)

$
0
0
I'm playing around with a sidebar inventory system using simple (if true then print) macros, but whatever I name the sidebar passage for the inventory system, it places it at the top above all the other links.

I want the inventory to be last in the sidebar list.

I could live with it being at the top, but the problem is that as the list of carried items grows, the little '<' icon I have for collapsing the sidebar doesn't get moved down, so ends up being overlapped by the other links.

Sound looping 'pop' (sugarcube 2.11.0)

$
0
0
Yes, I realised I've asked this before, but it was one part of a double question and never really got discussed much.

I can't be the only one who uses loops on their audio tracks so I'm putting this out to anyone who's discovered a way to mask the little 'pop' noise you hear when the sound clip ends, then starts its next loop.

I use Audacity to create my sound files and did try fading out the clip, but this only accentuates the split.

Any ideas appreciated.

Auto-collapse SugarCube UI bar after link is pressed

$
0
0
Im using SugarCube 2.11.0 on Twine 2.0.11. I have added some links with the StoryMenu passage on the left sidebar (UI bar). With the button on the top you can expand and collapse the sidebar. Now I would like the sidbar will be collapsed after a link is clicked on the StoryMenu - but only if "@media (max-width: 800px)" rule matches. How can I implement this?

This is because on mobile devices the sidebar overlaps the story passage. So the sidebar is collapsed by default. The player has to expand the sidebar to press the link. The passage is loaded "under" the sidebar. Now the player has to collapse the sidebar manually.
Viewing all 1844 articles
Browse latest View live