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

I figured out cycling links in Harlowe 2.1.0

$
0
0
I spent all evening working on cycling links, but couldn't find any guides written specifically for the newest version of Harlowe, so here's my solution for links that you click again and again to cycle through options:
(set:$place to (a:
"the cave",
"the bridge",
"the cliff",
"the lake"))
p>You walk until you reach (link-repeat:"|this>[it]")[(set:?this to $place's 1st)(set:$place to(rotated:1, ...$place))].
</p>
This will start with a link that says it, then cycle through the four locations.
I hope this helps somebody! If you have any questions please ask.

Issue with datamaps, arrays and saves

$
0
0
I know, it looks like a mess because it is... I'm struggling to create an inventory system.

What I want to do is:

1. User finds weapons or items, grab it. It's stored, but not equiped.
2. He/she select between those items, and decide if the character will equip, drop it, etc.

This is what I have up to now.

In a startup passage:
{(set: 
$weapons to (a:),
$max_weapons to 12
)

<!-- some weapon -->
(set: $iron_knife to (datamap:
"name","Iron Knife",
"desc","A random iron knife",
"slot","rh")) <!-- right hand -->

<!-- creates a link -->
(set: $i_iron_knife to "(link-reveal: 'Iron Knife')[
    (if: $max_weapons is $weapons's length)[NO SPACE, SORRY]
    (else:)[
        (set: $weapons to it + (a: $iron_knife))
    ]
]")

With this, I can use something like "Hey, you have found a weird $i_iron_knife, maybe it's a good idea to take it" anywhere. The problem is when I use something like this to retrieve data:
[code]Slot 1:{
(set: $slot1_name to $weapons's 1st's name)
(set: $slot1_desc to $weapons's 1st's desc)
(set: $slot1_slot to $weapons's 1st's slot)
}
[/code]

It works, but if I save and load the game, the "$weapons's 1st's name" and so on became invalid, because the datamap works like an array. "You can only access position strings/numbers ('4th', 'last', '2ndlast', (2), etc.) and 'length' of an array, not the string "name"."

Is it an expected behavior? Or am I doing something wrong?

Customizing list numbers

Sugarcube 2 - Replacing placeholder text

$
0
0
Hello, everyone. I'm currently working on my first Twine project as part of my Master's thesis. Although things are progressing nicely, I seem to have run into a snag.
<<nobr>>
<<set $location = "Woods [South] - Shack">>
<<set $roomWidth = 10>>
<<set $roomLength = 10>><</nobr>>
<<display "header">>
You pass through the [[door|woods1_entrance][$playerMoves +=1]] of the shack and scan your surroundings. The shack is <<print $roomWidth>> feet by <<print $roomLength>> feet. On the east wall, a small rusty <span id="shovel"><<click "shovel">></span><<replace "#shovel">>shovel<</replace>><<replace "#output1">>You pick up the shovel and put it in your backpack.<</replace>><</click>> hangs on a nail.

On the north wall, there is a small wooden table. On it, sits a <span id="lamp"><<click "lamp">></span><<replace "#lamp">><span id="keyItem">lamp</span><</replace>><<replace "#output1">>You pick up the <span id="keyItem">lamp</span> and put it in your backpack.<</replace>><</click>>.

<span id="output1"></span>

I've read TheMadExiles' post on a similar question, but what I'm wondering is can what I'm wanting to do be done?

For what it's worth, I've declared outputs' 1-5 in my story's CSS as per F2Andy's advice. If I could have my way, I'm looking for a solution that's somewhat of a "melding" of what I'm already doing and what F2Andy is doing.

Thanks!

Checkbox variable

$
0
0
Hello folks

I'm kinda new on the "programming world" and i'm having some trouble.. I want to make the variables in the checkboxes show up but I can't find the tutorial to do this (I'm using Harlowee Macros)... Basically I want that the game tells the player wich checkbox he or she didn't checked ( he/she needs to complete all the tasks, if not the game have to redirect the player to another passage saiyng wich tasks he didn't complete). Can anyone help me?

ps: english isn't my mother language so i dunno if I made myself clear
kek.

Providing a summary at the end of a game?

$
0
0
Does anyone know if it is possible to provide a summary of actions once a user comes to the end of a game?

This is using Mac Twine 2.0

I want to be able to give an end page once a user has clicked on a particular action so as an example;

'You have found the exit. Go through the exit'

leads to >

'Well done. You have completed all the tasks and now you are free'

Here is your report;

You made these choices <lists every option clicked on to get to the end>

I suppose it's a recap and list of all the [action] but not sure if it can 'memorise' this?

Many thanks

Strange beginner question.

$
0
0
Hi! I've messed around a bit with Twine before, and decided to do it again now that 2.1 is available. After installing it and launching it I'm faced with this, however;

dd357aea7a.png

Yep, that's it. If I press "Twine" I can click on "Show library" or "Quit", though nothing happens if I do so. "Edit" just have options of cutting, pasting etc. I can't do anything, not even shut the program down except with the task manager. I've tried reinstalling it, and I'm using the correct version (the Win 64, as that is my OS. I've tried the Win 32 version as well, though).

Applying style to named hooks

$
0
0
I'm sorry if this has already been asked (and it probably has, but I just can't find a relevant post).
I am trying (Twine 2, Harlowe 1.2.3) to apply a style to a bunch of named hooks, through a link.
Something like
This [is]<a| my [text]<a| with some [hooks]<a|.
(link: "Click!")[(prepend: ?a)[(text-style: "blur")]]
This doeasn't work, since prepend adds the given content in front of the target hook's content, not in front of the target hook itself.
Does someone know how to do that?

Color Synthax HighLight to Custom Story Format

$
0
0
Hi !
Is there any way to add/guide for adding color syntax highlight to Custom Story Format in the Twine editor ?

I am interested by Snowman and especially Protagonist variant but not having visual clues about the syntax make it hard to code.
It was requested for Protagonist here.

Thanks for your support !

PROGRESS BAR RESETS IN HARLOWE

$
0
0
I did a progress bar it starts but it resets when go with the middle...
How can I do?


<div class="progress-bar">
<br>
<div style="width: 76.7%"></div>
</div>

<style>

tw-story{
width: 100%
}


body { background: black; padding: 100px; margin: 0;}

.progress-bar {

background-image: url(./bar.png) ;
background-repeat: no-repeat;
width: 95%;
height: 10%;



}
.progress-bar > div {
color: white;
background: url(./sal.png);
background-repeat: no-repeat;
overflow: hidden;
white-space: nowrap;
margin: -84px 0px 1px 85px;
padding-bottom: 35px;
border-radius: 10px;
-webkit-animation: progress-bar 2s;

animation: progress-bar 2s;
}

@-webkit-keyframes progress-bar {
0% { width: 0; }
}

@keyframes progress-bar {
0% { width: 0; }
}
</style>

[Harlowe] Non collapsing spaces ?

$
0
0
I've programmed a rotating scrolling display:
(set: $message to "Caution!.......")(set: $mh to (font: "Courier New")+(hook: "message"))\
$mh[Message](live: .1s)[(set: $message to $message's (range: 2, length of $message) + $message's 1st)\
(replace: ?message)[(print: "&nbsp;"+$message+")")]]
It works fine when the $message contains no spaces. When it does, Harlowe (or HTML) does it's usual stuff: collapsing them, which leads to some quite unpleasant effects.
I was thinking of using some non-breaking spaces but "&nbsp;" obviously counts as 5 caracters for Harlowe, not one. So they are rotated to. And that's ugly.
What to do? I have no clue. Do you?

[Sugarcube 2.13.0] Passing arguments and widgets calling widgets

$
0
0
Hey there,

I come to you with another problem that I ran into.
I'm running SugarCube 2.13.0 and Twine 2.1.0

The issue is the following, I'm trying to implement a way in which the player can interact with the inventory of other objects in the game, by placing and taking items from their containers. I'm basically listing the items inside the player's and the inspected container's contents (items) and then offer actions that can take place on the given object. Such as moving items back and forth, inspecting item properties, etc.

I'm trying to do this using a <<widget>> which calls another <<widget>>. I've tested and been using recursive <<widget>> which had no problems whatsoever (probably because of the same arguments that get passed to them).
In my case I fail to pass the _item object to <<putItemInContainer>>. Since the latter throws an error that .hasOwnProperty of an undefined variable made the whole thing crash and burn. This is very interesting to me since, the other widgets have never been complaining. I imagine the for loop and the temporary _i (iterator value) adds a complication. I'm trying to remedy this by setting up a temporary variable: _item and reference the indexed item ($player.inventory[_i]). This also doesn't seem to help in this case.

I tried to substitute the <<putItemIntoContainer>> widget by taking out the part that was important to me with the hasOwnProperty check and then the calling of other widgets such as unequip and JS function call to transfer the item into the new container. Now, this substitution kinda fails too since I only get the last item that is then put into the container after the second try, which I can't take out, since the wrong item gets put into the container.

There must be a way to call transfertItem() using the correct arguents (_item) I just have no idea how.

Can anyone explain to me what is going on here?
Am I missing something when passing arguments to another widget?
/% when clicked, shows the contents of the container and the actions that can be carried out on them %/
/%TODO: Add option for the player to put their items into the container <<putItemInHere _container _container[_i]>>%/
<<widget "openContainer">><<nobr>>
	  <<set _container to $args[0]>>
	  <<linkreplace "Open container">>
		  <<if _container.length > 0>>
			  The $args[1] holds the following items:
			  <<for _i = 0; _i < _container.length; _i++>>
			  	_container[_i].name X _container[_i].count
			  	<<showItem _container[_i]>>
				<<inspectItem _container[_i]>>
				<<debugItem _container[_i]>>
			  <</for>>
		  <<else>>
			  @@color:orange;This seems to be an empty $args[1]!@@
		  <</if>>
		  <<if $player.inventory.length > 0>>
		  <<for _i = 0; _i < $player.inventory.length; _i++>>
		  	<<set _item to $player.inventory[_i]>>
			_item.name X _item.count
			<<showItem _item>>
			<<inspectItem _item>>
			<<debugItem _item>>
			<<linkreplace "Put _item.name in here">>
				<<putItemIntoContainer $player.inventory _container _item>>
			<</linkreplace>>
		  <</for>>
		  <<else>>
		  	@@color:orange;The player's inventory is empty!@@
		  <</if>>
	<</linkreplace>>
<</nobr>><</widget>>
/%
Places an item from on inventory into the other
$args[0] - source inventory
$args[1] - destination inventory
$args[2] - item, this needs to be already inside the source inventory
so that it can be moved into the destination inventory
%/
<<widget "putItemIntoContainer">><<nobr>>
	<<if $args.length < 3>>
		@@color:red:There aren't enough parameters passed to transfer an item.@@
	<<else>>
		<<set _item to $args[2]>>
		<<set _src_container $args[0]>>
		<<set _dest_container $args[1]>>
		<<if typeof _item !== undefined>>
			<<if typeof _item !== "string">>
			  <<set _item to getItemById(_src_container, _item)>>
			<</if>>
			<<if _item.hasOwnProperty("isEquipped")>>
				<<if not _item.isEquipped>>
				  @@color:purple;You place _item.name into a container!@@
				  <<transferItem _src_container _dest_container _item>>
				<<else>>
					<<if _item.hasOwnProperty('clothingType')>>
					  @@color:orange;We un-equipped your item and moved it!@@
					  <<unequip $player.clothing _item.clothingType>>
					<<else>>
					  @@color:red;no clothingType property on passed item (3rd argument).@@
					<</if>>
				<</if>>
			<<else>>
			  @@color:purple;you put _item.name into a container!@@
			  <<transferItem _src_container _dest_container _item>>
			<</if>>
		<<else>>
			@@color:red;[Error]putItemIntoContainer arg[0] or item is undefined@@
		<</if>>
	<</if>>
<</nobr>><</widget>>

[Sugarcube 2] - Using a button to check a variable

$
0
0
In the code below, am I attempting this in a way that is even remotely correct? Should the button be wrapped in a <<click>> macro or something similar?
<<if visited("Instructions")>>
{{{>> }}}Before we go any further, I'd like to know a little more about you. What is your name, young adventurer?
<<else>>\
{{{>> }}}Welcome to the land of Terra. Allow me to introduce myself. I am Az'rha and I will be your guide through this adventure. Before we go any further, I'd like to know a little more about you. What is your name, young adventurer?
<</if>>\
<span id="name">{{{>> }}}<<textbox "$playerName" "" autofocus>></span><span id="button"><<button "Enter">><<replace "#output1">>You say your name is $playerName, correct? Remember, you will be unable to change it later. &#8594; <<click "Yes">><<replace "#output2">>It is nice to meet you, $playerName.<</replace>><<replace "#output3">>[[Continue &#8594;|characterCreation2]]<</replace>><</click>><</replace>><</button>></span>

<span id="output1"></span>
<span id="output2"></span>
<span id="output3"></span>

Sugarcube 2 - Replacing placeholder text based on conditions

$
0
0
I got my original problem fixed but have run into another one. Is it possible to do what I'm wanting to do below? That is, can I have the interactive text replaced with something if the crate has been opened using the methods I'm using, or am I going about it completely wrong?
<<silently>>
<<set $roomWidth = 16>>
<<set $roomLength = 12>>
<<set $crateOpen = "{{{>> }}}In the northwest corner, there is a small crate (you opened it earlier).">>
<<if $cave_room1_crate == "Open">><<replace "#crateText">>$crateOpen<</replace>><</if>>
<</silently>>
{{{>> }}}You find yourself in a small room. The dimensions of the room are <<print $roomWidth>> feet by <<print $roomLength>> feet. 

{{{>> }}}Exits are [[north|cave_room6]] and [[west|cave_room2]].

<span id="crateText">{{{>> }}}In the northwest corner of the room, there is a small <span id="crate"><<click "crate">><<replace "#crate">>crate<</replace>><<replace "#output">>Inside the crate, you find a <span id="item">small silver key</span>, a large <span id="keyItem">Yellow Key</span>, and <span id="gold">25 gold</span>.<</replace>><<set $playerScore +=25>><</click>><<set $cave_room1_crate = "Open">></span>;</span> next to it, a medium-sized <span id="chest"><<click "chest">><<replace "#chest>>chest<</replace>>.<</click>>.</span> <span id="torch">A <<click "torch">><<replace "#torch">><</replace>><<replace "#output">>You take the torch from the wall.<</replace>><</click>> hangs on the wall.</span>

<span id="output"></span>

I tried moving the "If" statement lower in the code (in case it wasn't working because I was attempting to perform a function before the tag was created), but that still threw the "no elements matched selector" error. Thoughts?

Special passages in SUGARCUBE 2

$
0
0
hi!!!

trying to get the PassageHeader to work just as an experiment... i'm trying to display a power level value at the start of every passage...

<<print $power>>

damn think won't work... the passage after the PassageHeader is displayed fine...

what am I doing wrong...

i'm trying to like Twine but it's a pain in the butt trying to get the damn thing to work...

thanks

ps can't get PassageFooter to work either...

Help with Harlowe audio

$
0
0
Hi,

Just wondering if someone could provide any easy instructions for how to add audio using Harlowe.

I know at this point that SugarCube would have been a better option but I really don't have much more time to work on this project and adding the music will be the final touch. I don't need to do anything fancy- just run the music through the whole game.

What would I have to add to the JS section, and what else would I have to add to do this?

Thanks so much!

How to style individual buttons on a single page in sugarcube 2?

$
0
0
Hello all. Simple question: I want to have a few buttons on the same passage, and I want to style each of them differently.
I have absolutely no idea how to do that. If I edit the button class in the stylesheet, every button changes accordingly.

Can anyone help? :(

[Harlowe 2.0] Can't change color scheme to the old one.

$
0
0
Hi. I'm new to twine.

Harlowe 2.0 use black-on-white color scheme, but i want to change it to the old color scheme (white bg and black text). I'd found this code in the manual:
(enchant: ?page, (text-colour: black) + (background: white))
, pasted in a header tagged passage, but styles for background and text colors from a <tw-enchantment> tag get overwritten in the <tw-passage> tag inside the <tw-enchantment>. Are there any suggestions?

The needs of a Text Adventure with RPG Elements?

$
0
0
Hello everyone. I've been writing a story in Twine using its default story format for a very long time now but I've never wanted to publish my story using Twine since I felt it was only helpful in organizing my story.

I've looked for a game engine that could do what I've needed for well over 2 years now but my own shortcomings have made the task difficult. Just about ANY game engine could accomplish what it is I need, but I am NOT a programmer. I've learned several languages but am far from being competent with any of them and whenever I try to think for myself with the languages I know, my brain turns to scrambled eggs. Originally, when I first began writing my story in Twine, I thought Twine had limitations that made it impossible for me to create what it was I wanted within it. I know now that with some skill you can make some pretty fancy stuff with it. I think that I'd need to create my own story format to make the kind of game I would like with Twine however, and that's where my brain turns to scrambled eggs again. I'm hoping I can get some guidance and on where to begin and what kind of things I'd need to make in order to support the kind of game I'm making.

The kind of game I'm making would be part Visual Novel, part Text Adventure, part RPG and would be presented in the following manner:
gxyeeo.png
ofepem.png
mwvasz.png
(ignore the flavor text)

Here's a list of some features my game would need to function:
  • Web Fonts; specifically Cinzel or at least a way to use Cinzel as the primary font.
  • Text Color Coding; this would be needed to help the reader identify codex links of different types (people, locations, lore), as well as speech, attributes, and items.
  • Codex; a built-in codex that the player can bring up with a click at any time and put away at any time, letting them resume where they left off.
  • Inventory; some kind of inventory would be helpful but it would not need to be extremely in-depth. A simple listing of items you've acquired would be more than enough so long as the player can bring up this list and resume the story at any time, like the codex.
  • Attribute Checking; some support for saving various character and item attributes as well as checking against them for success and failure when making choices in the story. This could be done in the background, though a Attribute Window and Status screen would be preferable.
  • Adjustable HUD; the window containing narration would need to move or vanish according to what the player is doing. Sliding to the right to make room for the Attribute Window or sliding off screen completely for the Codex or Inventory.
  • Saved History; the narration window should allow the player to scroll up to see the entirety of their current chapter including the choices they've made thus far as well as an option to view previously completed chapters with all the choices they made.
  • Save/Load Functionality; the length of my story would make this a requirement. Multiple save files would be preferably.
  • Character Portraits; the portraits I have are not heavily animated, but some support for animation would be needed as the portraits would slide on and off screen as characters enter and leave scenes.
  • Sound/Music; self-explanatory.

I think that's about it.
The list must make me look like I'm over my head, and maybe I am. I've thought about giving up on several occasions, but what I've written for the past several years is very important to me and I'd like to present it to people in some fashion. I have the support of an artist, and I've tried to make up for the lack of programming with my own skills but I've discovered just how terrible I am at that particular area.

Regardless, if I must, I'll continue to try if someone here can help point me in a good direction.

Is Twine still a good option for me with my requirements?

Live Countdown Bar (Sugarcube 2.0)

$
0
0
So I had this idea for a mechanic in the game I'm writing. But I'm a bit at a loss how to write and implement it.

The premise is this. In battle, you're presented with a full bar that slowly depletes (Indicating the time you have). There is also a button. You click this button to deal damage, so you want to furiously click this as much as possible before the timer bar depletes.

When the bar depletes, you're sent to another page. For the amount of times you've clicked, you deal a proportional amount of damage to the enemy, and this is described on the second page. Basically it's a bit more interactive for the player than turn-based combat where damage is rolled automatically.

I had some other ideas as variants for different sort of attacks, using a similar countdown function. E.g. A timer, a rune displayed, and you've got to click on the same rune from a set of eight before the timer runs out to cast, etc. It all would use the same underlying 'timer bar' mechanic that depletes in real time, then sends you to a different page once the bar runs out.

Anyone know how I should go about this?

Alternatively, I was also thinking about how one would do a similar coundown (or count UP) bar where you have to hit a button when the bar rests within a certain section, much like your 'Dance Dance Revolution' kind of thing. E.g. Hit when the bar rests between 60% and 80%. But I've been thinking this would be too hard to implement and may not even be possible.

renzokuken.jpg
Viewing all 1844 articles
Browse latest View live