Quantcast
Channel: Twine Forum
Viewing all 3830 articles
Browse latest View live

Change room description after visit another room.

$
0
0
I think I need to set a variable of "visited" to be set to "true" after I visit another room, but I don't understand how to set this or how to get the descriptions in two other rooms to be changed after this variable is set.

Sorry, new to this and using 2.0.11 and harlow.

Place a small picutre in the top right corner

$
0
0
Hey all, I am trying to place an ever changing emoticon in the top right corner, to help display emotions, which is quite important for what I am creating. I did what I would normally do in HTML, and when I test Twine all I get is a broken image link in the top right. My twine is using Harlowe syntax, so that may be cause the issue.
Thanks

My CSS
	
	#content {
    position: relative;
}

#content img {
    position: absolute;
    top: 0px;
    right: 0px;
}

Inserted into the Twine Editing box, first line
<div id="content">
    <img src="smile/smile.jpg" class="ribbon"/>
</div>

Background Images: Scale & Positioning.

$
0
0
Hi all, I'm working on a very image heavy Twine at the moment, with the central idea being that you can walk to an environment frame by frame in a style similar to the original version of Myst.

I figured the best way to do this would be to make all my environment images backgrounds and then add any text and buttons over the top of this, but I'm having trouble getting my images to the correct position.

There are two problems, one is just the matter of what size to make the image so that it fills the screen without being excessively huge, and the other is how to centre it.

Ideally I'd be able to centre an image slightly bigger than the screen (basically giving it a "bleed"), but at the moment it aligns left.

current stylesheet looks like this:

body {
margin: 2%;
text-align: center;
background: [img[church1]];
}

EDIT: (tried adding a background-position: center; which...helps, it's now aligned to the centre left to right but not top to bottom, any way to do that?)

Any help appreciated!

"Replace" macro in Twine 2 using Harlowe

$
0
0
Hi!

I'd like to use the fabled replace macro in Twine 2 using harlowe. From what I've understood it's possible to have text appear and replace a line of text within a passage without going to another passage, allowing one to dynamically alter passages.

I've been unable to find how to do this within Harlowe however.

I'd greatly appreciate help on how to do this!

Thank you

Input a global sidebar in Harlow

$
0
0
Hi everybody,

I want to input a global sidebar that always displays a set of variables ($health $stamina etc). I already have the CSS the way I want the bar to be displayed, but I don't know how to write the javascript.

Thx GMan

Game of 21's in Harlowe

$
0
0
I am thinking of adding a mini-game to my Story, that is looped.

A,2,3,4,5,6,7,8,9,10,J,Q,K are the cards, and there are 4 sets of them, meaning you can have 4 of the same card if lucky.

If you get an A and a K, you get 21 or 11, depending on which you choose.

You can have up to 5 cards, if you go over 21, you bust, and if no-one gets 21, its the lowest of a 5 card trick that wins. You can click 'Hit' to get another card or 'Stick' to stay with the one's you have. Not sure if it is possible to do up to 4 people in the game, but you can have their numbers random each time.

Wonder if it is possible to make a mini-game like this?

How do I code 'if' variables?

$
0
0
I'm really new to Twine and I'm using it for a project.

I found a couple of different codes for possible instances around the forums, but I can't find the codes for 2.0/Harlowe. I want to be able to let the player pick up an item, have the game remember that they have the item, and then provide another possible option when you go back to the previous page.

i.e. you have the option to run away, but if you picked up a weapon, the game remembers and will also present the option to attack.

Hope this makes sense.

Using a JavaScript File in Harlowe

$
0
0
I have a working game of Blackjack, only problem is to import that file into Twine, is there a way to do this?

For example, a header called blackjack and in the CSS have html.blackjack ?
I have saved it as a JavaScript file, but how to I import it into Twine and used on a certain page, say that page is called 21's?

Mouse over sound

$
0
0
Is there a way to embed sound by using a "mouse over" instead of auto play in Twine 1.4.1?

Can cards for trading card games be coded on harlowe?

$
0
0
I was thinking about starting a game on this style, and wondered if it can be done with what we have now.

Hover sounds

$
0
0
I'm trying to get a sound to play on mouse hover over links. I've managed to get it working for the UI Bar (sugarcube) save and restart options, but it plays for no other links. Here's the code I'm using:

$("a").mouseenter(function(){
$("<audio></audio>").attr({
'src':'sound/transition1.ogg',
'autoplay':'autoplay'
})
});
Taken from: https://css-tricks.com/play-sound-on-hover/

How do I put a timer in Twine 2.0?

Make character's say player's name

$
0
0
Sorry for asking so many questions. Hopefully this will be my last one for a while.

How do I make a character in my game call the player by the name they input at the beginning?

I've used the very simple (Prompt: "What is your name?") for the beginning and, while it works, I don't know how to have the game remember the name you input.

Please help?

Can I link two stories? (Harlowe)

$
0
0
I'm very new to Twinery (2.0) so this might be a stupid question...

Is it possible to link two stories together, kind of like Story 1 being a chapter and Story 2 being the second chapter, etc.? By that, I mean can I use the same variable inputs from the first Story and then use them in the second?


Let me explain if I need to:
In my first "Story," I have it possible for the user to choose what they'd like their character to look like.
They can choose, lets say for their eye color, "Green," "Blue," "Brown," and some others.
I have this saved under "$eyecolor," which I use frequently throughout "Story 1."
In "Story 1" the user plays all throughout one area where they need to survive and figure out how to escape the area alive.
Now, let's say that the user finishes the adventure in this area, which was an opening area to set up the main story.
By the end of this one huge adventure, the user has already set up about 20 variables from deciding their name to their skin color, hair color, to their background.
That's a lot of variables in my opinion.
I have this huge opening adventure saved as "Story 1."
Now, I'd like to consider "Story 1" a chapter.
But, I'd like to have "Story 1," the opening aka chapter 1, lead on to another Story and be chapter 2.
WITHOUT having to ask the user for every single detail over again for the variables.
Of course, I'd like it to continue on and on with all the Stories becoming more chapters, like a book.
I'd like the chapters to flow fluently into one another and have the variables still intact from the last chapters.
I want to do this for organization purposes and for the sake of having a more "Congrats, you did't die!" vibe to it.


So if there is no possible way to link two or more stories together (while keeping the same variables), I'm okay with that. I can simply have it in one heap in "Story 1" and I'll be happy. I can't think of any way that linking Stories is possible, other than starting over with the variables, but it doesn't hurt to ask. I'd be more than glad to hear that this is feasible. :)

Thank you!

Using Replace macro with other whilst also utilising numbers. (SUGARCUBE, TWINE 2)

$
0
0
Greetings,

I've gotten pretty far on my character creation system thus far, but here it seems I have reached another impasse - and I believe that this information may yet prove useful to other's who may or may not know how to do this (I tried finding the related information on the forum but it appears as though this particular situation may require a more involved method).

In the code displayed below, I wish to make it so that when $Str is in the area for $S1 to be true, then $S1 would immediately replace any other $S# that may be true before that time. This is so that when trying to choose a specific level for each stat - the associated stat trait is then displayed so as to give the player a more informed level of detail as to their best course of action.

I was also wondering if it then would not be simpler to introduce the associated changes that affected the other stats (from these Stat Traits) there and then on this page rather than on a seperate one, but I found that each <span id> will only display changes for one and only one, even if they are cloned (or perhaps that's just my lack of knowledge on the matter).

I know that the below is wrong, and will not change with the $Str level because it has none of the necessary code or macro (this is my clean copy which is not full of failed tests etc) but my question is - how would I make something like this work?
Stat Points: <<set $Skills to 150>><span id="skills">$Skills</span>

Strength:  \ 
<span id="stats-str-minus">\
<<button "-">>
	<<if $Str gt 20>>
		<<if $Str eq 150>>
			<<run $("#stats-str-plus button").prop("disabled", false);>>
		<</if>>    
		<<set $Str -=2, $Skills +=2>>
		<<replace "#stats-str">>$Str<</replace>>
		<<replace "#skills">>$Skills<</replace>>
		<<if $Str eq 20>>
			<<run $("#stats-str-minus button").prop("disabled", true);>>
		<</if>>
	<</if>>
<</button>> \
</span>\
<span id="stats-str">$Str</span> \
<span id="stats-str-plus">\
<<button "+">>
	<<if $Str lt 150 and $Skills gt 0>>
		<<if $Str eq 20>>
			<<run $("#stats-str-minus button").prop("disabled", false);>>
		<</if>>
		<<set $Str +=2, $Skills -=2>>
		<<replace "#stats-str">>$Str<</replace>>
		<<replace "#skills">>$Skills<</replace>>
		<<if $Str eq 150>>
			<<run $("#stats-str-plus button").prop("disabled", true);>>
		<</if>>
	<</if>>
<</button>>
</span>\


<<if $Str gt -100 and $Str lt 40>>
<<set $S1 to true>>
S1 TRUE
<</if>>

<<if $Str gte 40 and $Str lt 70>>
<<set $S2 to true>>
S2 TRUE
<</if>>

<<if $Str gte 70 and $Str lt 90>>
<<set $S3 to true>>
S3 TRUE
<</if>>

<<if $Str gte 90 and $Str lt 115>>
<<set $S4 to true>>
S4 TRUE
<</if>>

<<if $Str gte 115 and $Str lt 135>>
<<set $S5 to true>>
S5
<</if>>

<<if $Str gte 135>>
<<set $S6 to true>>
S6 TRUE
<</if>>

I would appreciate any available support on the matter. Thank you.

Links

$
0
0
I am working on two different links, using Harlowe in Twine 2.0

The first is an external link, but I would like it to use the tw-link CSS, any advice?
<a id="tw-link" href="www.website.org" target="_blank">text</a>

The next is using it's own CSS, so that the link is different then a normal link, however I want it to link to a page inside the document, any advice
<a class="link2" href=internal location>text</a>

Thanks

else: macro won't run

$
0
0
This is probably some stupid small thing I'm missing and I honestly feel stupid for asking but I can't for the life of me find any place in my syntax that would cause this error. I have the following code:
(if: $gold >= $inncost)[
(set: $health = $maxhealth)
(set: $gold = $gold - $inncost)
You wake up the next morning refreshed and revitalized. The inn also has a complementary breakfast. You take the hell advantage of that, and leave stuffed and ready to take on the day.
](else:)[
The innkeeper takes one look at your pitiful wallet and throws you out onto the street. You think that the reaction is a bit extreme, but are grateful that she at least used the door rather than a window.
]

The if: hook runs fine if the condition is met, but the else: statement will never run. If the if: hook doesn't run then nothing runs. It's just a blank page.

The problem isn't the hook syntax. I looked at other posters having similar problems and they either don's use the hooks or put spaces between the hook and the macros. I triple checked that this wasn't the case and even if it is the code above is a copy-paste so you can double check as well. I'm so confused.

Sorry in advance if this gets solved in like 2 seconds. And thanks a bunch.

Numeric variable to string

$
0
0
Hello again my helpful friends!

I'm trying to show a random picture on the screen. I can make this work by using the either randomiser.

(set: $image to (either: "1", "2", "3"))
(print: ' <img src = "Images/Portraits/'+$image+"LF.png"+'"> ')

The problem is that I'm quickly getting far too many pictures to keep adding them as options with "either".
In short, I'd like to have this work with the random randomiser:

(set: $image to (random: 1, 100))
(print: ' <img src = "Images/Portraits/'+$image+"LF.png"+'"> ')

The problem with this is that it considers the random variable a number, not a string.
I've tried little hacks to get this working but no luck so far:

(set: $image to (random: 1, 100))
(set: $image2 to "$image")
(print: ' <img src = "Images/Portraits/'+$image2+"LF.png"+'"> ')


Many thanks to whomever can make this work!

Using variables in Harlowe

Displaying part of a random passage on click

$
0
0
Twine 1.4 and SugarCube 2.

Let's say I have a simple passage like this:
Some text and <<click "button">><</click>>.

When the button is clicked I want to: get a random passage from a list, then get a random sentence from that passage, and display it below the original text and button--with any links removed/deactivated (so only showing plain text sentence). So the player can keep clicking the button, and new random sentences will keep appearing below it.

I know I can display a random passage with:
<<set $passage to either("Passage 1", "Passage 2", "Passage 3")>>
<<display $passage>>

And I thought I could display a random passage on button click with something like this:
<<click "Show Random">><<set $passage to either("Passage 1", "Passage 2", "Passage 3")>><<display $passage>><</click>>

But that's not working.

As for grabbing a random sentence from the passage (rather than displaying the whole passage), and deactivating the links... I assume this is something I should try to do in prerender, via some kind of black magic vaguely like this?
Viewing all 3830 articles
Browse latest View live