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

[harlowe] How can I round a random number without it showing when I test the passage?

$
0
0
Let's say I generate a number as part of an equation that makes it very likely that it will have a decimal. How can I round it down (that is, disregarding the decimal part) without it being printed automatically?

Help debugging this HTML please

$
0
0
Hey!

I'm still pretty new to Twine and teaching myself basic HTML and CSS. Wondering why this piece of code isn't working? Have tried debugging myself to no avail.

<div class="fade-in four"><i><span class="zuberitext">"Character A speech"</span></i></div>
<div class="fade-in five"><b>"Character B speech"</b></div>
<div class="fade-in six"><i><span class="zuberitext">Character A speech
<div class="fade-in seven">More of the same speech from Character A
<div class="fade-in eight">End of the same speech from Character A" </span></i></div>

<div class="fade-in nine">Do you [[choice|passage]]? Or do you think [[choice|passage]]?</div>

I removed the particulars of the story just to give an idea of the passage shape. The classes I have are a timed fade in for text and particular colour for Character A's speech.

Any ideas greatly appreciated, cheers!

What's the deal with (display:) and computed values?

$
0
0
Hi everyone, I only post as a last resort. This is driving me insane.

the code: (set:$Selection to "(Print:($Options's 1st's Page))") $Selection (display:$Selection)

evaluates to: "Conversation-DoNothing" then error: I can't (display:) the passage '(Print:($Options's 1st's Page))' because it doesn't exist.►

What's up with (display:) and computed values? how can I get around this and have it display the passage "Conversation-DoNothing"? What causes this?

If I write: (set:$Selection to (Print:($Options's 1st's Page))) $Selection (display:$Selection)

It comes up with: Conversation-DoNothing (display:)'s 1st value is a (print:) command, but should be a string.►

[Sugarcube 2.16.0] Pluck a tagged passage from an array

$
0
0
I have several passages with several tags like this:
:: Event1 [event suburbs]

My sidebar uses tags().includes("event") check to show some special info, and that works fine.
However when I try to get all the passages with "suburbs" tag, I don't get any. The code I'm using:
<<set $suburbs to Story.lookup("tags", "suburbs")>>

To get that particular passage into the array I need to change it to:
<<set $suburbs to Story.lookup("tags", "event,suburbs")>>

But the set of tags might be different per passage, so I need a way to get all the passages, one of which tags is "suburbs". Is there a way to do this?

After I get the list of these passages I need to create a link, which would pluck one passage and <<goto>> it. But I get an error with different variations of this code:
<<link "To the Suburbs">>
    <<set _e to $suburbs.pluck()>>
    <<goto _e>>
<</link>>

Could you help me, please?

P.S. using sugarcube 2.16 with entwine, if that matters.

Creating If Else Statement

$
0
0
Hey!

I'm trying to use If Else statements to display particular passage text depending on the player's previous choices.

Passage C is reached by the player through Choice A or Choice B (this has a longer path).

I want to display certain text is the player reaches Passage C through Choice A and different text if reached through Choice B.

I've looked at tutorials but can't seem to figure out how to phrase my statement to make it work. I'm using Harlowe on Twine 2.

Previous function doesn't work

$
0
0
I would like one of my passages to have a "Back" link that takes the user to the passage they viewed immediately before. The twine wiki tells me that the following code is what I need.

[[Back|previous()]]

Rather than linking to the previous, though, the above command just auto-creates a new passage called previous() and links there. That's not what I want. What am I missing?

[harlowe] multiple conditions in an if macro

$
0
0
i'm trying to make a customizable point buy calculator - right now, this is my code:
POWER: $statPWR (if:$statPWR is < 16 and $pointTotal is > 0)[(link-repeat:"[increase]")[(set:$statPWR to it + 1)]] (if:$statPWR > 6)[(link-repeat:"[decrease]")[(set:$statPWR to it - 1)]]

i'm trying to get that if statement to work - for the time being, i'm going to try nesting the if statements, but i'd like a better solution.

edit: i was being dumb, my friend helped me out, it's working now. i don't know how to delete a post, if that's something you can do, but this is resolved.

Missing Hook - Ignoring Conditions Except When They Apply

$
0
0
I want a click ignored if a hook isn't present:
(click: ?Bunyon)[(if: $located is "Quicksand")[(goto: "Lakeside")]

This works when the hook is present, but when it isn't says -
The (click:) command should be assigned to a variable or attached to a hook.

So, I want to do something to test if the hook is present - like this:
(if: $inv contains "Rusty Axe")[(click: ? ... etc.]

Or maybe -
(if: $inv contains "Rusty Axe" and click: ? ... etc.]

But that doesn't work either.

Any help would be gratefully appreciated.

New Version of Twine 2.0 Not Working

$
0
0
Hi all,

I've just, to my regret, installed the latest version of Twine 2.0 on my Windows machine. On starting it up I get the following error:
Message: Cannot set property 'id' of undefined
File: unknown
Line: unknown
Column: unknown
Stack:
TypeError: Cannot set property 'id' of undefined at IMPORT_STORY (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:40:12189) at i.(anonymous function) (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:84:5845) at r.value (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:84:4841) at dispatch (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:84:4102) at importStory (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:9:14310) at chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:41:15776 at chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:41:15665 at Object.loadAll (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:41:15822) at chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:52:31866 at Object.init (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:53:101)

Does anyone have any idea what's gone wrong, and where I can get the installer for the previous version?

Thanks,

J. J. Guest

Weird Visual Bug

$
0
0
Not sure why, but the sidebar in the editor is overlapping the text margins. It's not a big deal but it is kind of annoying. Any idea how to fix this?

How do you print macros inside links?

$
0
0
I am using SugarCube 2.14.0 . Right now I am working on a new project on my own and I am trying to make a macro show right in a link.

This is the one im trying to use:

I am thin for my height of $playerheight, my weight of $playerweight is spread so that I appear quite lean.

The above is in the double '[' s

Keyboard commands in Sugarcube

$
0
0
Hey, so I'm currently using Sugarcube 1.0.35 on Twine 2. I was wondering if there's any possible way to switch to a certain passage if you hit CTRL+ALT+T on the keyboard (at any time). I know this is really weird and specific but help would be very much appreciated!

[harlowe] How to add comments to my passages?

$
0
0
I'm trying a new game, but it's becoming so complicated that I rely on memory to know what each passage does and why. Is there a way to add comments, like you can in other languages?

Day/Night and Seasons, How would I Implement with widgets?

$
0
0
Hi,

Ive been racking my brains for several hours with this thinking of different ways to do it without too much javascript as my skills with it are pretty basic.

I would like to count the turns using a variable $turns,so as per another post I know i can use <<set $turns to 0>> in the PassageReady. I already have the variable in my $player.turns so can reuse it. What I would like to do is for every lets say 20 turns set another variable $timeofday ["morning", "afternoon", "evening", "night"] and eventually also have seasons as a variable based on the amount of turns. I can figure out how to do the latter though I know its probably something basic I dont know how to count the amount of turns, I was thinking of lets say every 10 turns the $timeofday changes and every 200 the time of season changes. I am going to do these as widgets and add them to PassageReady/PassageDone

To add some more information the purpose is basic 2 different sets of text/actions occur depending on the time of day (the passages can be revisited), also random events will occur depending on time of day. In addition to this other factors such as health (health system already in place) will be effected depending on $season.

I am using Twine 2.1.1 and SugarCube 2.14

Any illumination on this would be greatly appreciated as I think if I can get this one figuered out it should cascade to the other few features I would like to implement.

Event trigger after a set amount of time? (SugerCube)

$
0
0
Heya, so I'm trying to create an event that appears after a certain amount of time in-game has been reached (using the Javascript shown here).

For example: I would like that after 1 week in-game has happened, it will take the reader to a certain passage/event automatically. But... I'm not entirely sure how I can do that.

I've been looking through the forum and miscellaneous sites for some help but I can't really find anything that works so far.

Does anybody have any tips on how I can do this? Thank you !

Setting variable values within a single passage

$
0
0
I am trying to replicate the menu-based conservation model from Inform 7 in Twine 2.0. I am using Harlowe. While I think I understand how the (set:) macro functions, I cannot figure out how to trigger a change in the value of a variable based on clicking on a link that keeps the reader within the same passage (as opposed to moving them to a new passage where I could clearly just reset the $variable there). Here is the code I am using:
(set: $convo to 1)

Opening text.....

Please select one:

(link: "(1) >ASK PETER ABOUT HIS MOOD")["It sucks, bud," Doug says, "I can;t figure out how to code this passage," (set: $convo to it +1)]

(link: "(2) >ASK PETER ABOUT HIS LIFE GOALS")["To be honest with you, I can't see my way out of this coding challenge at the moment." (set: $convo to it +1)]

(link: "(3) >YOU'RE An IDIOT, PERIOD")["Only reason I hang out with you is because you make me feel cool. Get with the program," Doug says.

Dougs looks at a floating plastic bag, caught by the wind between two derelict buildings." (set: $convo to it +1)]

(if: $convo >= 4)[(link: "Sweet!")[(goto: "Next passage")]

Essentially, I want do want the link "Sweet" to appear until the reader has reader all three segments of the conversation, regardless of which order they are read in. I suspect there may be a simpler manner to achieve this goal.

How do I print text based on what the last passage visited was?

$
0
0
I've been googling around for this for a bit now, and can't seem to find the answer. I have a feeling it must be pretty simple, and has probably been asked and answered somewhere (link me please!), but I'm a complete noob when it comes to even simple coding.

What I have are multiple passages which lead to a single passage, but I want the single passage's text to change dependent upon which passage you came from.

I realize that I could have a bunch of different passages that are unique, but the differences are so minor that I know it would be a lot easier in the future if I didn't have to make five copies of a single passage and then edit minor details after-the-fact. If I know the code I need, I can do all the variations in a single pass, and in a single passage.

How do I print text based on what the last passage visited was?

$
0
0
I've been googling around for this for a bit now, and can't seem to find the answer. I have a feeling it must be pretty simple, and has probably been asked and answered somewhere (link me please!), but I'm a complete noob when it comes to even simple coding.

What I have are multiple passages which lead to a single passage, but I want the single passage's text to change dependent upon which passage you came from.

I realize that I could have a bunch of different passages that are unique, but the differences are so minor that I know it would be a lot easier in the future if I didn't have to make five copies of a single passage and then edit minor details after-the-fact. If I know the code I need, I can do all the variations in a single pass, and in a single passage.

need help organizing data (Sugarcube 2.6)

$
0
0
Hey everybody,

I wrote a little quiz game, which I am not unsatisfied with. I have my passages, which hold the quiz questions, organized like this:
0x0 0x1 0x2 0x3 0x4 0x5 0x6 etc.
1x0 1x1 1x2 1x3 1x4 1x5 1x6 etc.
2x0 2x1 2x2 2x3 2x4 2x5 2x6 etc.
3x0 3x1 3x2 3x3 3x4 3x5 3x6 etc.
4x0 4x1 4x2 4x3 4x4 4x5 4x6 etc.

The first digit (before the "x") marks the difficulty level, the third digit (after the "x") marks the round. So, as players answer their questions right or wrong, they move up and down the difficulty range, whereas the round value automatically increments after each round.

So far so good. But after playing several rounds I found the static approach (that you move automatically from e.g. round 4 to round 5) hinders replayability, because a player will mostly repeat the same questions.

This is why I want to randomize the question path, meaning that the game automatically chooses the next passage from a pool of existing round numbers. So I could just go and
<<set $rounds to [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, 21]>>

pick one element as the next passage destination, remove it from the array and so on...

BUT:

My questions are follow-up-questions, they are organized in groups of three, e.g. questions 0 through 2 cover one topic, question 3 though 5 the next, 6 through 8 ....

So randomly jumping from one question to another would mess up these blocks of questions.

How could I organize the questions in blocks? Let's say random picks 9, which means the player gets questions 9,10 and 11 and then the next question block is picked by random again.

Thanks for your help,

richVIE

ps. Is there maybe a solution which allows me to define blocks of different lengths?

How do I print text based on what the last passage visited was?

$
0
0
I've been googling around for this for a bit now, and can't seem to find the answer. I have a feeling it must be pretty simple, and has probably been asked and answered somewhere (link me please!), but I'm a complete noob when it comes to even simple coding.

What I have are multiple passages which lead to a single passage, but I want the single passage's text to change dependent upon which passage you came from.

I realize that I could have a bunch of different passages that are unique, but the differences are so minor that I know it would be a lot easier in the future if I didn't have to make five copies of a single passage and then edit minor details after-the-fact. If I know the code I need, I can do all the variations in one
Viewing all 1844 articles
Browse latest View live