Yes, I did a search, and read the other posts, but mine is a bit different and I could not apply those answers to my story.
I'm trying to create a page where some of the text changes depending on previous decisions the player made. Say, if they chose to be an elf or a dwarf.
This is what is not working: after all, you are <<if $race = elf>> an elf <<else>> a dwarf <<endif>>
Is there a comprehensive guide to Harlowe I can use? Getting bits and subtle hints after half an hour of searching, and then having to ask in a forum, is not what I want to spend my whole day in.
Comments
Twine 2 general documentation is here: http://twinery.org/wiki/twine2:guide. Running through the tutorial under "Learning Twine 2" will help a bunch with understanding basic syntax.
As far as I know, Harlowe doesn't use the <<foo>> syntax.
Syntax looks something like this:
Have fun!
(set: $race to "dwarf")
After all, you are (if: $race is "elf")[ an elf.](else:)[ a dwarf.]
I GUARANTEE you it will work.
I'm making a test game to avoid something horrible to happen to my main one. So the variables will be different.
Setting the variable, page 1:
(set: $sx to "neither")
(link: "I'm a baby boy")[(set: $sx to "boy")(goto: "Name")]
(link: "I'm a baby girl")[(set: $sx to "girl")(goto: "Name")]
using them in page 2:
What's your name, (if: $sx = boy)[mr](else:)[miss]?
I have another question, related to this. Do I make another thread, or ask here?
Let's say I want a creature to have a random colour from a list (which I know how to do), but later, I want it to generate loot based on that colour: namely, red paint for red creatures, yellow for yellow ones, etc., so the character can paint their house later. (I will try inventory management later, but feel free to give me tips if you want to, I'm writing down everything)
(thanks to @Sharpe for the last one)
Just select the color and assign it to a variable each time you want to create a mob and it's associated loot.
You can do something like this:
You don't have to set the loot at the same time as the mob type. I just dumped it all together as an example. Also, at some point @L said he was going to allow multiple variables in a (set:) like in Twine 1.x but I am not sure those have been implemented yet.
So to store a random variable I set them, and then... what?
I tried this, but neither works, they just give me the value0 thingie
[(set: $variable1 to "value0")(either: "value1", "value2", "value3")]
(set: $variable1 to "value0")[(either: "value1", "value2", "value3")]
(set: $variable1 to "value0")(either: "value1", "value2", "value3")
The (set:) in your code ends at the first closed parenthesis so the (either:) does nothing which is why you are only getting 'the value0 thingie'.
Same with (set: $variable1 to [either: "value1", "value2", "value3"])
Parentheses matter. Don't panic. You'll get it.
That actually solved it. I just did not know where to put double () or add [] instead
Into to next question, I'm obsessed with trying complicated things in my story. Right now, is letting the player read the page text, and waiting for them to click a word to show them the prompt to define their own feratures, like eye color. Not very relevant to plot, but I feel this will help them "bond" with their character (the story requires they actually care)
Here is the monster I created. It is not reanimating!
(set: $eyecolor to "noeyes")
(if: $eyecolor is "noeyes")(link: "What color are you eyes?")[(put: (prompt: "My eye color is...") into $eyecolor)]
I tried adding a prompt to [page text]<c1, but it did not work
In this case, however, I can answer this one.
You are super close to the answer. Instead of Page Text, you can put the name of a passage and then it will show up that way.
Anyway ...
From here on is for @Rafe not @Sage so there's no misunderstanding.
Harlowe doesn't yet have a way to do what you are asking without some additional javascript added to your story.
See http://twinery.org/forum/discussion/comment/6468/
One workaround without having to do the above javascript hack is to change the way you are displaying your passages.
Source passage:
Target passage (named prompt_passage for this example):
Of course, you don't have to send them back to the prior passage. I just don't know enough about what you're doing in your passage to know how to end it.
(Out for the evening.)
Sorry... I disagree. Not about the new post thing, do whatever you want...
But the code I posted DOES work. I am currently using it in a published story
There is a chance I didn't understand the question... but the code does work. Where do you think I went wrong?
EDIT: I HAVE NO ADDED JAVASCRIPT
There I edited it so you can see my intended meaning. I didn't even look at or try your code so have no idea what it does or doesn't do. K?
No... I totally get that. I was able to tell which one you were addressing. I was saying that the code I posted, I think, does what he needs it to. I should have used the QUOTE thingy, but I was saying I disagree with the part where it says Harlowe can't do that. I disagreed because I was making it work.
I asked you, at the end of it, where I went wrong because I know you are a better coder than I am. My code works though, so I was wondering where you were saying Harlowe can't.
Anyway, sorry for any confusion.
The click-replace you suggested is one of the things I really like about Harlowe, btw.
And as for coding, I'm still a n00b when it comes to Twine. I've seen some of your responses in other threads, you're understanding is pretty good, buddy! Now I really need to go out. It's Saturday night!
REALLY!!!????
haha- thank you! I've been trying.