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

Is it possible for players to export a section of a game?

$
0
0
I'm building a game in Harlowe. Is there a way for players of a game to export (to image or pdf) while in the game? For example, if an image is displayed with some text, can one give players the option to save that image as a local file on their device?

Password input not working

$
0
0
Hi,
I am working in Harlowe at the moment and I am pretty new to programming. I am trying to have the players input the right password so that they can go on. If they don't get the password right they end up back at the passage that asks for the password.
ALSO
I am trying to have the input come up by clicking a link. Once the player has gotten the password right, i want the link to be replaced by another link so that they won't need to retype the password everytime they come to this passage.

Here is what I have so far:

(set: $eno to (goto: "HOME"))\
(set: $adams to (goto: "John Adams"))\
(link: "PLAY")[(set: $password to (prompt: "Serial #:"))\
(if: $password is "secret")$adams,(else:)$eno]\

How use "prompt" or something similar for numbers and not for strings ?

$
0
0
Hello, I'm actually using twinery 2, with Harlowe, for the first time, and I have a litle problem ^^'
I want that the user put a number on a variable, so I used the macro "prompt" for do that, but "prompt" give only strings, and not numbers... I don't know how to do for use this with a number...
So, there is an other macro for this, or something to write after or before prompt ?

Thank you for reading and your help, and sorry if I wrote some mistakes, english is not my native language...

Conversation Dialogue for Twine

$
0
0
I have previously used choicescript for writing, however, I found the lack of a node map really difficult and I had to write my own using other software to keep track of all of the important choices etc.  Then I came across Twine, and saw something that offered a node map (yay!), but didn't offer something similar to fakechoice, which is basically giving the user choices which wouldn't really result in different paths. 

I've been working on some javascript (which I have also posted about in the help forum here), and with the assistance of the kind folk here and on stackoverflow, I have managed to cobble something together which seems to do everything I want.  For example, if you would like to have a conversation with an NPC, but don't want to create multiple nodes to do this, then this is what the script is capable of.

Here's a demo of what it can do:  Dropbox

It's running in sugarcane, and all of the text for the demo with the exception of the check variables passage at the end is in one passage. 

This is NOT a custom macro for twine, as I'm certainly not at the level I need to be in understanding those to be able to make this into one, but I will probably begin to attempt to change it into a custom macro at some point.  Anyway, I thought I would share the script in case anyone was interested. 

Here's a link to the actual javascript: fakechoice1.js

For this to work, you have to use html which would look similar to this:
<div class="inlinechoice-0" id="0">
<a class="question" id="1">Question 1</a><br>
<a class="question" id="2">Question 2</a><br>
</div>
This presents the user with a list of options, which will disappear once one of the questions is clicked.  The next piece of html would look like this:
<div class="answer-1">
You asked the first question.
</div>
<div class="answer-2">
You asked the second question.
</div>
Note that <a class="question" id="1"> would return <div class="answer-1">, so the numbering here is important. 

Finally, you need this piece of html so that everything appears where it should.
<div id="dialogue_container"> </div>
<div id="append"><br>You've finished asking questions.<br>
The dialogue_container is where all of your chosen questions and answers will appear.  The append div will show once there are no more questions and I guess is optional.  In the example above I haven't nested any additional questions within the answers, but the demo link does do that.  Inlinechoices begin at 0 and increment by 1, so if you were to nest them in an answer div you would call them inlinechoice-1 with an id of 1, and inlinechoice-2 etc.  I'm not claiming that this is an elegant solution by any means, however, it's what I've managed to work out via a combination of google, stackoverflow and various Twine resources. 

Currently, there are a few issues, which I am hoping to iron out. 

Issue one is that I am having to place the javascript in an external .js to the twine .tws as I can't get it to work otherwise.  I believe that I should be able to place the contents of the javascript into a script passage and simply call it using <<display>> as advised here however, I couldn't get this to work.

Issue two is spacing and breaks.  If you check the demo, you'll find the spacing is a bit odd.  There also appears to be some slight indentations going on for reasons I don't understand, and <<nobr>> and <<silently>> don't really seem to help.

Issue three is twine variables.  The javascript currently passes all of the choices made in a passage to an array, which is updated once you leave the passage.  This is more of a work around than a desired solution though, it would be nice to update the array in passage.  In the mean time, to pick up if certain choices were made, I'll probably use the methods described on here, which should suffice my needs for the moment.  Of all of the issues, this is probably the one I can live with quite happily. 

Issue four is that I want to make this into a custom macro.  To get it to work currently, there's quite a lot of clumsy html required, and I'm sure I just need to do something like replace and custom macro tags with the required html rather than having it directly in the passage.

Anyway, I'm posting this here in case it's of any use to anyone, and I'll probably use this thread to record any updates and improvements.  I know this is useful certainly for me, and hopefully it will be for others. 

Adding new links to the sidebar within a passage

$
0
0
So I know how to add new links using StoryMenu, but is it possible to add a link from a passage, via story progress? For example, I have a party passage that allows you to have conversations with party members, but I don't want it to be available until after all of the initial party has been introduced.

Using sugarcane, by the way.

[Sugarcube] Cycling through background colors on the same passage

$
0
0
I originally had this Youtube video set to play as my background (warning, flashing colors): image

However, if possible, I'd rather just skip the video and have my background color cycle between red, green and blue at .5 second intervals. Is this possible, or can I only change it for each separate passage (i.e.: one red, one green, one blue)?

Maintain vertical scroll position after reloading page?

$
0
0
Hi!

I'm using 2.0.11 / Harlowe.

I want to make a game with one very long central passage that contains hundreds of links.

However, it will be extremely cumbersome if the user has to start from the top of that page and scroll down each time s/he returns to it -- so I'd like the game to remember / store the user's most recent vertical scroll position when returning to that main passage.

My programming ability is less-than-extremely-basic; I've been looking at possible solutions for this issue on stackoverflow, etc, but I can't figure out how to implement them in Twine, and I thought I'd ask here.

Thanks so very much!

Backgrounds for harlowe won't work in chrome

$
0
0
Salutations,
So I made a story which works when I test it, and works fine with safari, but doesn't load background images with Chrome. I tried a couple techniques and neither works.

The first I tried was

{(print: "<script>$('html').removeClass(\)</script>")
(if: (passage:)'s tags's length > 0)[
(print: "<script>$('html').addClass('" + (passage:)'s tags.join(' ') + "'\)</script>")
]}

html.door body {
background-image: url('http://scpsandbox2.wdfiles.com/local--files/rounzie/backdoor.jpg');
background-position: center;
background-size: cover;}

and then I tagged the passage I wanted the background to work on as door and added

{
(print: "<script>$('html').removeClass(\)</script>")
(if: (passage:)'s tags's length > 0)[
(print: "<script>$('html').addClass('" + (passage:)'s tags.join(' ') + "'\)</script>")
]
}

to the specific passage.


I also tried using

.castle {
background-image:url("http://ohiofi.com/img/The Castle 2.png");
background-size:cover;
}

in the stylesheet, and then in the castle passage I

put <script>$('body').removeClass().addClass('castle')</script>

Neither seems to work for me in chrome. I googled around a bit but couldn't find anyone else having this problem or any solutions. Anyone have any ideas?

Using a passage name as an if statement

$
0
0
I found some code that will allow you to check a passage's tags and then if the statement is true, to set the current passage name as a variable.
But the code is obviously for a different version of twine. Maybe Harlowe? And I'm using sugarcane.

What I want is a code snippet that says

If passage tags do not contain blah blah
set variable to passage name.

I cannot find an example for sugarcane and my fumbling is not working.
Please help!

Start Stop Audio in Harlow

$
0
0
Hi all,

I'm searching for a way to start an audiofile, when clicking a link without reloading the passage.

I tried to do this with link-reveal, but with no success.
Audioplay (link-reveal "Audioplay")[<audio src="Directory" autoplay>]

Can anybody help?

Retro - My Ludum Dare 36 Twine Game

$
0
0
Retro is my entry for Ludum Dare 36. I will end up adding music and some extra polish, but for the most part it's complete.

Would love your thoughts and feedback. Thank you.

MdPyOE0.gif

4WxZaGj.gif

starvingindie.com/games/Retro.html

DOS like interface

$
0
0
Hello all. I have been working on a game for a while and it just didn't seem to sit right in terms of aesthetics. So in an attempt to tell the story in the way I wanted I made a faux DOS like interface.

7prG84z.png

h0YTwRY.png

bOKcJwU.png

I even incorporated some basic command error stuff and capture loops for in the "apps" so that if a player enters the incorrect command it keeps it in the correct passage.
EIQBJqK.png

Still loads to do. But I think the overall feel works well for what I want.

Elemental Justice - Feedback is welcome; this is my first Twine short story so far!

$
0
0
Preface

My story takes place in a world where almost everyone can use magic to manipulate the elements. The environment was inspired by two Nickelodeon shows, Avatar: The Last Bender and The Legend of Korra. Unlike the main characters of those two shows, however, you are one of the 1% of people who are born unable to use any magic at all. They call such people "the powerless," and in this dysfunctional society, those who can manipulate many elements are treated like gods and those who can't at all are treated like scum. You play the role of a powerless individual destined to initiate a revolution against the unequivocal inequality running rampant across human society. Will you succeed? Find out by clicking on the link below!

http://philome.la/Gamer91112/elemental-justice

create inventory using sugarcane format?

$
0
0
Please help. I need to make an inventory for my game.

[twine 2 & sugarcube 2] Is it possible to pass an array of objects to a widget?

$
0
0
Hello there forum, I've been searching a while for an answer to the question: can I pass an array of objects to a widget?
To be clear, I mean passing an array variable to a widget, as in
/* define an array of people (objects) with names */
<<set $arr to [{name:'alice'}, {name:'bob'}, {name:'casey'}]>>
$arr[0].name
/* Outputs "alice" */

/* do something to the array */
<<arraywidget $arr>>

/* let's say the widget looks like */
<<widget "arraywidget">>
  <<for _i = 0; _i < $args.length; _i++>>
    <<print $args[_i].name>>
  <</for>>
<</widget>>

The above widget definition prints nothing. I tried to fix it by reading to a temporary variable first:
<<widget "wordywidget">>
  <<for _i = 0; _i < $args.length; _i++>>
    <<set _person to $args[_i]>>
    <<print _person.name>>
  <</for>>
<</widget>>

Which still prints nothing. During testing I accidentally left out the ".name" in the first widget and got
<<widget "borkedwidget">>
  <<for _i = 0; _i < $args.length; _i++>>
    <<print $args[_i]>>
  <</for>>
<</widget>>
which outputs "[object Object], [object Object], [object Object]", i.e. the entire array as one element of $args. (Since I didn't explicitly print the commas, I'm pretty sure this is the string representation of the outer array $arr.)

Is there any way to make this work? Currently I only know of one workaround: saving the array to a global variable used by the widget. I would much prefer passing the array as an argument though, passing through globals gives me nightmares of assembly coding.

Any tips or fixes would be greatly appreciated!

Changing the color of save slot buttons (Twine2/Sugarcube1)

$
0
0
Hoping this will be a fairly easy question...as the title says, I'm trying to change the color of save slot buttons in Twine2/Sugarcube1. Specifically, I want to change the Save/Save to Disk.../Load from Disk.../Purge Slots/X buttons all to the same different color.

Thank you! :-)

Old Javascript conversation dialogue question

$
0
0
I found a script written by the user bawpie like two and a half years ago for making branching dialogue in sugar cane, so I loaded into my story and I can't get it to work. First I was getting an unterminated string error, which I researched and discovered might be due to line breaks. So I went in and got rid of those, and now I'm getting a missing ) after condition error. I have looked through this code, but it's pretty complex and not being super well-versed in Javascript, I can't seem to find the error. Please help.
(function () { version.extensions['dialoguemacro'] = {major: 1, minor: 0, revision: 0};
macros['append'] = macros['answer'] = macros['question'] = macros['choiceblock'] ={handler: function(place, macroName, params, parser) { var openTag = macroName, closeTag = "end" + macroName, start  = parser.source.indexOf(">>", parser.matchStart) + 2, end = -1, tagBegin = start, tagEnd = start, opened = 1;
		while ((tagBegin = parser.source.indexOf("<<", tagEnd)) !== -1 &amp;&amp; (tagEnd = parser.source.indexOf(">>", tagBegin)) !== -1) { var tagName = parser.source.slice(tagBegin + 2, tagEnd), tagDelim = tagName.search(/\s/);
			if (tagDelim !== -1) {
tagName = tagName.slice(0, tagDelim);
			}
			tagEnd += 2; switch (tagName)
{ case closeTag: opened--; break; case openTag: opened++; break; } if (opened === 0) { end = tagBegin; break; } } if (end !== -1)
		{ parser.nextMatch = tagEnd;
		id = params[0];
		contents = parser.source.slice(start, end);
		switch (macroName) { case "choiceblock": switch(id){ case "1": new Wikifier(place, '<<loadJS fakechoice1.js>> <div class="inlinechoice-' + id + '" id= "' + id + '"><br>' + contents + '</div>' + '<div id="dialogue_container"> </div>');
break; default: new Wikifier(place, '<div class="inlinechoice-' + id + '" id="' + id + '"><br>' + contents + '</div>' + '<div id="dialogue_container"> </div>');
			} break; case "question": if (params.length - 1 % 2 == 1) {throwError(place, "<<" + macroName + ">>: odd number of parameters given"); return; } el = document.createElement('a'); el.className = 'internalLink';
el.href = "javascript:void(0)"; el.innerHTML = ('<a class="question" id="' + id + '">' + contents + '</a>');
el.onclick = function(){
for (var index = 0;index < params.length; index += 2) {var s;
if (isNaN(params[index+2])) {
s = "state.history[0].variables." + params[index+1] + " = '" + params[index+2] + "'";} else {s = "state.history[0].variables." + params[index+1] + " = " + params[index+2];
			} eval(s);}};place.appendChild(el); 
			break; case "answer": new Wikifier(place, '<div class="answer-' + id + '">' + contents + '</div>');
			break; case "append": new Wikifier(place, '<div id="' + macroName + '">' + contents + '</div>'); break; }}
		else
		{throwError(place, "<<" + macroName + ">>: cannot find a matching close tag");
		}
	},
};
macros["endchoiceblock"] = { handler: function () {} };
macros["endquestion"] = { handler: function () {} };
macros["endanswer"] = { handler: function () {} };
macros["endappend"] = { handler: function () {} };
}());

[Harlowe]Have I Not Placed The (stop:) Macro In The Correct Places?

$
0
0
Hi. I have made this for the start of my game. It uses (live:) macros, and I thought I places the (stop:) macros in the right place. Basically, I just want the text to show, then go on to the next bit of text. I don't know why this isn't working. Here's my code. If anyone was kind enough to look through it and give me a version with the (stop:) macros in the right place then that would be awesome!
{
(print: "<script>$('html').removeClass(\)</script>")
(if: (passage:)'s tags's length > 0)[
(print: "<script>$('html').addClass('" + (passage:)'s tags.join(' ') + "'\)</script>")
]
}|newGame>[I was born at sea.]
(live: 2s)[(replace: ?newGame)[I was born at sea for a reason.
(live: 2s)[(replace: ?newGame)[I was born at sea, to live at sea.
(live: 2s)[(replace: ?newGame)[To fight at sea.
(live: 2s)[(replace: ?newGame)[To rule the sea...
(live: 3s)[(replace: ?newGame)['Oh, he's a lovely young boy, isn't he!' exclaimed your mother.(live: 2s)[
'Yes, he most certainly is.' agreed your father, looking down at you as a baby and smiling, just as your mother did. (link: "'But what to call him is the question.'")[(replace: ?newGame)[(color: "red")[
{(link: "(either: 'Daniel','Francis','Charles')")[(set: $name to (prompt: "Please Enter A First Name:"))]}

{(link: "(either: 'East','Kenway','Drake')")[(set: $sname to (prompt: "Please Enter A Surname:"))]}

{(link: "(either: 'Ruler of Seas','Killer of Kings','The Champion','Death','Ruler of Seas','Killer of Kings','The Champion','Death','Ruler of Seas','Killer of Kings','The Champion','Death','Ruler of Seas','Killer of Kings','The Champion','Death','Ruler of Seas','Killer of Kings','The Champion','Death','Ruler of Seas','Killer of Kings','The Champion','Death','The Black Pearl')")[(set: $ship to (prompt: "Please Name Your Ship:"))]}]
(if: $name is 0)[](else:)[(if: $sname is 0)[](else:)[(if: $ship is 0)[](else:)[
[[Accept ->Story]]]]]]]](stop:)]](stop:)]](stop:)]](stop:)]](stop:)]](stop:)

is it possible to co-write a game?

$
0
0
me and a friend came up with a cool concept for a twine game and we both want to write it. is there any way to share it with the friend like google docs?

Accessing variables within browser javascript

$
0
0
Well I'm testing and balancing my "game" and trying to access variables using the console directly in my browser. I saw a lot of places saying to use state.active or history[0].variables... but I can't get to it... the variable "state" doesn't exist.. :/
Viewing all 3830 articles
Browse latest View live


Latest Images