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

Timed sound effects on mobile?

$
0
0
So basically when I use something like <<timed 2s>><<audio "bgm_song1" loop play>><</timed>>\, it works fine on my laptop browser but when I run the html on my android tablet or phone none of the timed sound effects work. Other timed elements work and sound effects that occur on passage loads or <<click>>s work. I was just wondering if I'm doing something wrong on my part or if there's a way around it or if it's just a limitation of twine on mobile devices.

Thanks

Line formatting question (SUGARCUBE 1.x)

$
0
0
Hello everyone. I'm working on a single player jrpg-ish turn-based combat system. I'm not particularly sure how to summarize the problem I'm having so I'll just try to be as detailed as possible:

Below is just an example of a passage that the player is linked to when he/she clicks on "cast firebolt". The <<Enemy_image>>, <<MP_regen>> and <<Actions>> are just widgets containing a whole bunch of <<if>> statements modifying various $variables. The <<Actions>> widget is particularly problematic.
<<Enemy_image>>
''<<print $enemy_name>>''
Level <<print $enemy_LVL>> <<print $enemy_type>>
Health: <<set $enemy_HP to $enemy_HP - $firebolt_PWR>><<print $enemy_HP>>/<<print $enemy_maxHP>>
Damage: <<print $enemyDMGmin>>-<<print $enemyDMGmax>>

<<set $playerMP to $playerMP - 50>>
Firebolt hits the <<print $enemy_name>> for <<print $firebolt_PWR>> damage!
<<if $enemy_HP <= 0>>You killed the <<print $enemy_name>>!<</if>>
<<MP_regen>>
<<if $enemy_HP > 0>><<Enemy_attack>><</if>>
<<if $enemy_HP > 0>><<if $playerHP > 0>>Actions:
<<Actions>><</if>><</if>>
<<if $playerHP <= 0>>[[Continue->Game Over]]<</if>>
<<if $enemy_HP <= 0>>[[Continue->Pre-victory]]<</if>>

<<audio "Firebolt" play>>


Here's my problem now: Most of the macros above as well as the widgets (especially <<Actions>>) contain TOO MANY lines of white space. Unfortunately, I can't just <<nobr>> the whole thing, because I want the output of the macros to be in a somewhat "list" order with line spacing like:

[[Cast Firebolt]]
[[Cast Heal]]
[[Cast Blizzard]]
etc
etc.

Since I'm new and do not know a better way of doing things, I simply made the above links to appear only <<if $firebolt is 1>> or <<if $heal is 1>> for example (the default at storyinit is 0... e.g. $firebolt is 0). The player plays the game and eventually gains new abilities, and I <<set>> the $firebolt variable to 1, thus making the link appear the next time battle is initiated. Unfortunately, this has the added side effect of the "invisible" [[Cast Firebolt]] taking up line spacing.

I guess the simplest way to put my question would be: Is there a way for these "non-activated" or "invisible" links to not take up white space until they are activated? Because right now the whole thing looks very messy. Any help or alternative suggestions would be greatly appreciated.

Ctrl + Z?

$
0
0
Stupid question and I'm hoping that I've just missed it, but is there an undo shortcut for when you've made a mistake entering text into a passage? I've accidentally deleted work but ctrl+z doesn't undo my carelessness. Twine 2.

[Harlowe] Sound effect to play on click

$
0
0
Hi all. Sorry for another question for something that is surely basic.

I've tried following other guidelines on this forum and JavaScript/CSS/HTML tutorials, but can't quite get what I want to achieve.

I can fairly easily get audio to play in the background (haven't decided if that is actually wise) but what I WOULD like is for a small beeping sound to play on cue when the player clicks on a particular word in one passage (basically to give the impression that the word is a button).

By the way. Does there exist some kind of database or collection of snippets for this kind of stuff?

dynamically change button text [Twine 2, SC 2]

$
0
0
Hey everybody,

I'm in need of a button (which triggers an audio play macro), which can be pushed only twice. My go was:
<<set $counter to 1>>
<<set $btntxt to $counter+1 + " more time(s)">>


<span id="btn">
<<button $btntxt>>
	<<set $counter -=1>>
	<<if $counter eq 0>>
	<<replace "#btn">>No more tries!<</replace>>
<<endif>>
<</button>></span>

After two clicks, the replacement macro is correctly triggered, but what do I need to do in order to change the button text after the first click?

Need help from JavaScript pros! [Twine 2 / SC]

$
0
0
Hey everybody,

lacking deeper knowledge of JavaScript I am facing a major problem here: For an educational game I want to include passages, in which the users have to drag and drop words into the right order. I found a script which covers about 90% of what I need, but I don´t know how to adapt it to make it work with twine / sugarcube.

I hosted an example here: http://deutschdetektiv.net/exp/put_words_in_order.html

Could anybody help making this work in Twine/SC?

I´d need the following changes:
    * instead of comparing the user result with the right answer and then displaying the <span id="correct!">, I´d like the user to drag and drop the words until they think they are in the correct order. * On clicking a button, the script shall compare the user sentence with the correct sentence (as stored in var content) and pass a boolean variable to Twine, which can be further processed within the passage. * Remove the <span class='exclamation' data-info='"+solution+"'>!</span>. I tried to do so myself, but the script stopped working.

I know this is a huge favor to ask, I can only hope that the feature might be handy for other users as well.

How to make a time system?

$
0
0
Hi everyone, I'm having a lot of problems trying to make a time system for my game. I want a sturdy time system because I want to make a business managment simulator kind of game, so I have to keep track of the day of the week, the day of the month, the month and the year, so this are my variables.

$hour
$minute
$weekday
$monthday
$month
$year

I need the game to do the basic maths while you are playing, like not going over 59 minutes or over 23 hours. I tried setting up a conditinal.

<<if $minute > 59>>
<<set $hour += 1>>
<<set $minute -= 60>>
<<else>>
<</if>>

Its the only thing that I can think of. For days of the week, I think it would be cool to have like a string of the seven days of the week and that when $hour reaches more than 23, the hour should go down to 0 again and the day of the week and the day of the month should change.

I dont really know if this or something like this has been answered here, but i searched for a bit and didn't found anything useful.

Thank you for your time and I will be happy to listen to every piece of advice that you could give me.

[Sugarcube 2] Twine 2: Adding sidebar elements after certain passages

$
0
0
I'm presently trying to add menus and stat displays to the sidebar- I'm using StoryMenu and StoryCaption, and both work fine until I try to add an if statement.

I'd like to prevent these from displaying until the intro to the story is done, is there someway to do so?
I've also seen some stories using set $ui, and adjusting the continue button itself. Is this a method for what I'm looking for?


EDIT:
I was passing variables incorrectly.
I would still like to know about using $ui, and if it's possible to add regular passage type links to the ui bar, instead of just menu buttons ( a la Save).

Whitespace appearing after a macro (Harlowe)

$
0
0
Hey!

I’m working on a character creation system in Twine 2.0 and have run into a problem with whitespace. At the moment the *buttons* work the way I want them to, however the code seems to be very clunky and not only does it produce an error but it produces an ever expanding amount of whitespace below the buttons every time they are clicked. I’ve tried using { } to place all the code onto a single line but this doesn't seem to work. Although it does place all the code onto a single line, when the buttons are pressed it seems to create new code. I assumed it was something to do with the link repeat macro but I tested that on its own and it doesn't produce whitespace when clicked. (Just to clarify I know the error is an issue but the whitespace appearing was a problem before I introduced that part)

Can anyone recommend a potential solution to this? The increasing amount of whitespace makes it impossible to write anything under the *buttons*.

Thanks!
(set: $Health to 5)
(set: $Attripoints to 5)
(set: $Apointsplus to true)

Attribute Points = [$Attripoints]<attripoints|

{Health = [$Health]<health| (link-repeat: "Health +1")[
(if: $Attripoints >= 1)[(set: $Apointsplus to true)]
(if: $Attripoints <= 8)and(if: $Apointsplus is true)[
(set: $Health to $Health +1)
(set: $Attripoints to $Attripoints -1)
(replace: ?health)[$Health]
(replace: ?attripoints)[$Attripoints]
(if: $Attripoints is 0)[(set: $Apointsplus to false)]]]
(link-repeat: "Health -1")[
(if: $Attripoints < 8)[
(set: $Health to $Health -1)
(set: $Attripoints to $Attripoints +1)
(replace: ?health)[$Health]
(replace: ?attripoints)[$Attripoints]]]}

[SugarCube 2] Creating choices within the same passage?

$
0
0
So I have a long passage.

I wish to include multiple choices that lead to different blocks of text displayed within the same passage.

To do this, say I have 2 buttons representing 2 different options. How do I make it so that when button 1 is clicked some text appears without leaving the current passage?

Time limit on choices in game (telltale-style?) [SugarCube 2]

$
0
0
I have multiple buttons corresponding to multiple choices the player can make. How do I add a time limit after which one of these choices is automatically selected?

Also preferably display the timer if possible...

Twine 2.0 Localization?

$
0
0
Hey there,

I've already searched through the forum/google but I still wonder whether twine 2.0 provides an easy system to localize the story into different languages? Something like an ID system which can be cross referenced with a spreadsheet or anything similar?

Thanks for your time,

Hellfish

how do i locate a text and pics in harlow

$
0
0
i want : my text, pic, video , to be at a specific place, like Y:??? X:???
cause actualy picture only go at the total left and i need 1 at the left 3 at the right and text in the middle
(yeah that a lot x) )
i need that to make a new kind a game with my friends but the only thing that we need is that....
(sorry if i do biiig mistake in english but im french :D )

i alrady got that code:

<img src=" (image link) " width="100" height="100" alt="...">

who alows me to put images
but i dont realy chose exactly where i want :/
if somones can help :'(

963693Nouvelleimagebitmap6.png

Embed Harlowe in HTML page?

$
0
0
I have a website with its own navigation bars on the top, right, and bottom sides of the page. I am trying to make a page that is a Harlowe story, but still has the site's navigation bars. We tried putting the Harlowe-generated page in an <iframe>, but the story contained links to third-party sites (using (goto-url:)), and those links loaded within the iframe (we wanted them to replace the whole page). We tried copying the <head> and <body> from the Harlowe-generated page into a new <head> and <div>, but then when twine navigated to any passage (including the start), the twine DOM elements became direct children of <html>, which made it harder to style things predictably. Can you think of good workarounds for either of these? Ideally without forking twine2/harlowe.

Comparing variables to find the highest value (TWINE 2, HARLOWE)

$
0
0
How do I set up an if statement to check if a variable is the highest out of four separate variables.

I assume I can say:

(if: $variable1 > $variable2 and $variable3 and $variable4)[run script A]
(if: $variable2 > $variable1 and $variable3 and $variable4)[run script B]
(if: $variable3 > $variable2 and $variable1 and $variable4)[run script C]
(if: $variable4 > $variable2 and $variable3 and $variable1)[run script D]

But what if there is a joint highest - how can I give an order of priority so that only one script runs no matter what.
For example, I want script a to take priority over scripts B, C, and D - so if A and C are tied, it is script A that gets run

Changing layout in sugarcube 2

$
0
0
I am trying to setup the layout for multiple panes using multiple divs. my simple test code i cant seem to get working each box is about 1/5th lower than the previous, so they don't line up at all. I am also wondering if flexbox does not work with sugarcube, I am not sure if I did something wrong but when I tried using it, I got a full page of garbage text.

css code
.floatbox{
margin: 1%;
float:left;
width:15%;
height:400px;
background-color: green;
}



code in the passage
<div class="floatbox">text</div>

<div class="floatbox">text</div>

<div class="floatbox">text</div>

Thanks

(pow:) macro is broken, takes wrong number of arguments

$
0
0
(pow:), the exponentiation macro, isn't working for me.

According to the Harlowe 1.2.2 documentation, (pow:) is supposed to take exactly two values, the base and the exponent. But when I write (pow: $w, 2.5) it doesn't evaluate. I'm told "1 too many values were given to this (pow:) macro. The (pow:) macro must only be given a number."

When I acquiesce to this nonsensical error and write (pow: $w) or (pow: 2.5), it evaluates to NaN. Of course, this is backwards. (pow:) shouldn't evaluate on one argument. You need a base and an exponent.

What is this beginner missing?

Check if the contents of a variable are an object or not

$
0
0
I'm using Sugarcube.

Simple question that I can't seem to figure out: How do I take an object
<<set $foo = {
    bar : 0
}>>
and check if it is or is not an object:
<<if isObject($foo)>>
    /%Do stuff here%/
<</if>>

[Sugarcube] Adding content to the Sidebar

$
0
0
So I'm wondering how you add content to the sidebar.
I'm gonna be honest, I have no idea where to even begin.

Essentially, what I want is my story's UI to be located on the sidebar. A "continue" button to allow the player to progress, a button to take them to the inventory screen, etc.
I guess I'm asking... How do I put <<click>> macros + their scripts and [[Link]]s so that they show up on the sidebar? Is it even possible?

[SC 2.6.2] Need help with addclass macro. (possible CSS-dumbness)

$
0
0
For a visual feedback system, I want to highlight <td>s in a table to show the player their development:
<<set $path to [1,2,1,2,2,3,1,2,1,2]>>
<table id="eval">
<tbody>
<tr>
<td>&nbsp;</td>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
<td>6</td>
<td>7</td>
<td>8</td>
<td>9</td>
<td>10</td>
<td>sum</td>
</tr>
<tr>
<td>Level 5</td>
<td id="4x1">&nbsp;</td>
<td id="4x2">&nbsp;</td>
<td id="4x3">&nbsp;</td>
<td id="4x4">&nbsp;</td>
<td id="4x5">&nbsp;</td>
<td id="4x6">&nbsp;</td>
<td id="4x7">&nbsp;</td>
<td id="4x8">&nbsp;</td>
<td id="4x9">&nbsp;</td>
<td id="4x10">&nbsp;</td>
<td><<print $path.count(4)>></td>
</tr>
<tr>
<td>Level 4</td>
<td id="3x1">&nbsp;</td>
<td id="3x2">&nbsp;</td>
<td id="3x3">&nbsp;</td>
<td id="3x4">&nbsp;</td>
<td id="3x5">&nbsp;</td>
<td id="3x6">&nbsp;</td>
<td id="3x7">&nbsp;</td>
<td id="3x8">&nbsp;</td>
<td id="3x9">&nbsp;</td>
<td id="3x10">&nbsp;</td>
<td><<print $path.count(3)>></td>
</tr>
<tr>
<td>Level 3</td>
<td id="2x1">&nbsp;</td>
<td id="2x2">&nbsp;</td>
<td id="2x3">&nbsp;</td>
<td id="2x4">&nbsp;</td>
<td id="2x5">&nbsp;</td>
<td id="2x6">&nbsp;</td>
<td id="2x7">&nbsp;</td>
<td id="2x8">&nbsp;</td>
<td id="2x9">&nbsp;</td>
<td id="2x10">&nbsp;</td>
<td><<print $path.count(2)>></td>
</tr>
<tr>
<td>Level 2</td>
<td id="#1x1">&nbsp;</td>
<td id="1x2">&nbsp;</td>
<td id="1x3">&nbsp;</td>
<td id="1x4">&nbsp;</td>
<td id="1x5">&nbsp;</td>
<td id="1x6">&nbsp;</td>
<td id="1x7">&nbsp;</td>
<td id="1x8">&nbsp;</td>
<td id="1x9">&nbsp;</td>
<td id="1x10">&nbsp;</td>
<td><<print $path.count(1)>></td>
</tr>
<tr>
<td>Level 1</td>
<td id="0x1">&nbsp;</td>
<td id="0x2">&nbsp;</td>
<td id="0x3">&nbsp;</td>
<td id="0x4">&nbsp;</td>
<td id="0x5">&nbsp;</td>
<td id="0x6">&nbsp;</td>
<td id="0x7">&nbsp;</td>
<td id="0x8">&nbsp;</td>
<td id="0x9">&nbsp;</td>
<td id="0x10">&nbsp;</td>
<td><<print $path.count(0)>></td>
</tr>
</tbody>
</table>

<<for $i to 0; $i lt $path.length; $i++>>\
	<<set $index to $i+1>>\
	<<set $id to "#" + $path[$i] + "x" + $index>>\	
	<<addclass $id "green">>\
	<</for>>\

I get the error
Error: <<addclass>>: no elements matched the selector "#2x4"
for each combination. I was wondering if the "#"-sign was the issue or am I addressing the <td>s incorrectly?

Viewing all 1844 articles
Browse latest View live