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

Harlowe click-append macro and variables

$
0
0
Hi,

I'm using Twine as part of a project I'm working on for university but I'm fairly new to Twine 2.0 so I don't know if this is possible in Harlowe or not.

In one of my passages I've got a sentence with the 'click-append' macro linked to one of the words to provide some extra information. Is there a way for Twine to remember that the extra information has been displayed and I can use it as a variable later? i.e if click-append macro is activated $somevariable is set to 'true' and then in a later passage I can call $somevariable to do something.

Any help greatly appreciated. Thanks

[Harlowe] Changing background images during play.

$
0
0
Sorry for the newbie question. I did search for and find a similar question somewhere but the answer given assumed a bit more css understanding than I've got. I'm gonna need an idiot's guide.

Basically I want to be able to change the background at certain intervals in the game. I have:

body {
background-image: url("image.jpg");
}

in the stylesheet, but how do I change that dynamically during play?

Thanks in advance.

Stu

It doesn't work on tumblr?!

$
0
0
I dunno how to ask this as a question. I'm trying to post to tumblr. No I'm not trying to put it as a blog post, I'm creating an entire page and using only the HTML generated by Twine to power it.. except, nothing shows up. Look:
http://adventuresofalvy.tumblr.com/s01 on this if you look at the page source you'll see that the HTML is all there.

I also tried to do it using the page creator's HTML entry options so the site's custom css goes around it but that breaks things just as much. I've put that here http://adventuresofalvy.tumblr.com/s02 for demonstration

So. How do I go about making this work?

edit: figured it out! I was able to make iframes work in the page. Hosting the static html on neocities and iframing it works perfectly via tumblr's page creator and wraps things up nicely within the css so there's no need for me to put the css through twine either.

Maintaining that status of an item that has been picked up

$
0
0
In this video: image

He creates the option to pick up a Lantern and a Teapot. When going back to that same page (where you can pick either of them up), the option to pick up the Lantern or the Teapot is still there, even if you had already picked them up.

Is there a way to remove the option to pick them up again within the same story?

Thank you

I NEED A Step-By-Step Guide for the Coding Illiterate on how to Make & Add things to an Inventory

$
0
0
Twine2/Sugarcube. I have previously asked a question like this and got 3 lines of instructions:

<<set $backpack to true>> when picked up in the passage. Then in the inventory:

<<if $backpack is true>>[[inventory passage]]<</if>>

Remember to <<set $backpack to false>> in the StoryInit passage first.


Well I have been staring at it & wrestling w/ Twine2 for 7 hours (I have been reduced to tears I feel stupid; attempting to learn code feels like such a stupid idea now & all I want to do it set my computer on fire&cry b/c I can't even decipher/enact WTF 3 lines of instructions mean) and still know next to shit. So just assume I have nothing, am coding illiterate, have no idea what anyone means when they start mentioning statements, macros or any what-have-yous, assume the singular thing my worthless grey matter has retained is that [[SOMETHINGSOMETHINGLINK]] makes a link that goes to another passage titled that link, in other words assume that I'm that moron who's read the tutorials and watched that How-To video that the Twine guy posted on Youtube and still can't figure it out & am wondering if I'm just too stupid to code.

All I want is to have an 'Inventory' link on my sidebar, so that when I click it it takes me to a list of whatever things got picked up. How do I code to pick things up? Please include the most obvious-obviousness instructions like, "click on +Passage to make a new Passage & name that new Passage 'LABEL' because you need it for X," make sure this Passage doesn't have arrows connecting this to anything other than 'X,' also including exactly the 'Pick Up [[THING]]' passage is supposed to look like(what is StoryInit? Is it the Passage w/ the Rocket activated where the story/game starts? Is it a different passage altogether? What am supposed to type?). Can someone please specify what part of the code is supposed to be non-changeable and what isn't?

I have deleted everything, so project is BLANK, I want to make a working Inventory, WTH do I do now?

Pictures would be helpful as well (not required, I'll take anything).

How do I make a gender option that works @ How do I allow the user to input a name in

$
0
0
I'm new to this... twine thing. I have little to no experience with anything.
The format i'm using is snowman.

1) Gender option

Male

Female

When you click on one of them it works, for example every time you input something in it, it's either a he or a she.

2) For example a user wants his/her name to be billy, how do you allow the user to type it in and how do you allow it to display through the rest of the game.

Eg: [Type Name Here] <--- gives an option to type name

Eg: Hi [Whatever Name]

I would appreciate any help you can give me on the topic, thank you.

Converting Choicescript to Twine

$
0
0
Hello everybody.

I got this problem... for years I have been working on Choicescript, and I wanted to convert a choicescript game into twine.

First, is it possible?
Second, is there any tool capable of doing it?
Third, any features I will miss?

Thank you in advance for your help.

Best Regards,

Checking for multiple strings at one time within a dataset?

$
0
0
Hello,

Twine newbie here -- so please excuse the noobiness of the question --

I want to be able to check to see if a certain combination of strings exist within a dataset, and output something specific based on a variety of combinations. The following obviously doesn't work:

(if:$quest contains "stringA", "stringB")[You have both strings.]

Can anyone point me toward the proper function to make this happen?

Thanks so much!

Adding to a Variable (Harlowe)

$
0
0
I’m trying to add to variable inside a passage by using a click macro. (Part of a character creation system I’m working on.) This is what I have so far;

(set: $Health to 8)
Health = $Health [Health +1]<Health1|

(click: ?Health1)[
(set: $Health to $Health +1)
]

So when Health + 1 is clicked the following function happens and is supposed to add + 1 to $Health. However when Health +1 is clicked the value of $Health does not change. Does anyone know what I might be missing?

Thanks!

How to make a link display one thing (text that players click on)but go 2 another labelSUGARCUBE

$
0
0
So i figured out the <<return>> saves the changes and stuff made to making things visible in other menus whereas <<back>> doesn't & is basically time travel so I'm not using it. But when I click on say, [[Backpack]] and check that and decide to go check [[Phone]] or any other menu-designated inventory-ish thing, I'm done looking & I click <<return>> wanting to go back to the story & it just sends me back to the last place I was [[Backpack]], then I click <<return>> again&again, I end up in a never-ending cycle stuck b/w 2 menus instead of going back to the last Story passages I was at. How do I fix this?

And while I'm at it, also, how to I make [[Links]] that display text for player/s to read/click but in code-reality it's labeled something else instead of labeled 'link that so happens to be story text'?

Calling variables from other passages. (Snowman)

$
0
0
Hi! I'm using the JavaScript in my game and I used it to record information like the players name and age. I'm trying to call back to the variables in other passages to make my story more interactive. Below is my code with some string changes as to not reveal my writing.
<%
var start = prompt("Type 'start' to continue...")
alert("Let's gather some information about yourself.")
var PLAYER = prompt("What's your name?")
var AGE = prompt("How old are you? (This will determine whether profanity is used or not ONLY.)")
var SEX = prompt("Are you a boy? or a girl?")
var CITY = prompt("What city are you from?")

if (start === "start") {
print(" You are " + PLAYER + ". You live in "+CITY+". You are a "+SEX+". You are "+AGE+" years old.");
}
else {
close();
}

%>
[[Chapter 1]]
The calls to variables like PLAYER and CITY work fine in this passage, but when addressing them in other passages like the below:
You decide to go to the bank. While Frances is on her phone, your friends start walking off. <% print("Wait up " + PLAYER + " !") %> You and your friends wait for her to catch up. You head towards the bank. As you are walking, Josh suddenly stops. "Yo, whats up Josh? You alright?" asks Trevor. Josh pukes on the ground. "Holy <% if (AGE < 13) {
print("shit josh!");
}
else {
print("cow josh!");
}
%>
I get an error message that reads:
⚠ Uncaught ReferenceError: PLAYER is not defined (file:///C:/Users/Alec/AppData/Local/Temp/nw5500_29090/index.html#stories/fff4c9b3-e354-dd95-3290-56d6e1dd92d9/test: 4)

It seems to me that vars cannot be called upon in other passages. Is there a way that I can achieve my goal?

(Sugar Cube 2) Print variable in Link?

$
0
0
In a previous passage $father is set to "Brian" or "Laurence." Now I would like to have "Brian" or "Laurence" appear in a link.
[[<<print $father>> left your mother.->Passage5]]
Just shows up as
$father left your mother.

Putting everything inside click macro doesn't work either.
<<click  [[<<print $father>> left your mother.->Passage5]]>><</click>>

I've tried replacing the print macro with some other stuff but none of them seem to work with Sugar Cube 2. Naked variables work in regular text but not in links.

What am I doing wrong?

Some of my (replace: ) commands aren't working and I don't understand why

$
0
0
Hello!
Sorry if this has already been answered, but neither Google nor the forum search feature showed me any relevant posts.

I'm currently experimenting with different conversation systems. My only experience so far has been with a multi-node approach, where there was a node for each meaningful action, but I'm trying to figure out how a single-node system could work since it would be much more compact and convenient.

I'd prefer to have each new set of text and choices replace the last, so I was experimenting with (replace: ). It works perfectly for the first set of choices, but not for the second, and I can't figure out why that is.
For example, choosing to dance with the NPC replaces the talk/ignore/dance options with the new text and choices - tango/slowdance/breakdance. However, choosing to tango does not replace the tango/slowdance/breakdance options, it only adds the tango-related text below it.

I've included the current state of my little experiment below. Does anyone see what I did wrong?
(I'm using Harlowe 2.0.11, if that makes any difference)

I'd really appreciate any help!
[The [single-node NPC]<sNPC| is looking at you expectantly.

(click: ?sNPC)[The NPC seems to be waiting for you to [talk]<sNtalk| to it. You could, however, decide to [ignore]<sNignore| it instead. You could also attempt to [teach it how to dance]<sNdance|.]]<passage1|

{ [(click: ?sNtalk)[(replace: ?passage1)[You start making small talk with the NPC.]]

(click: ?sNignore)[(replace: ?passage1)[You turn away and pretend not to notice the NPC, though you can still see its dejected expression out of the corner of your eye.]]

(click: ?sNdance)[(replace: ?passage1)[You offer to teach the NPC how to dance - it enthusiastically agrees. Do you want to [tango]<tango|, [slow dance]<slowdance| or [breakdance]<breakdance|?]]]<passage2| }

{ (click: ?tango)[(replace: ?passage2)[You dance a passionate tango with the NPC. (set: $mood to "romantic") The NPC is growing fatigued from all this energetic dancing. Will you allow it to [take a break]<break|, or force it to [continue]<continue|? ]]

(click: ?slowdance)[(replace: ?passage2)[You gingerly wrap your arms around the NPC and start swaying around in a soft rythm.]]

(click: ?breakdance)[(replace: ?passage2)[You bust out some moves with the NPC.]] }

Help! How do you call functions in Snowman!

$
0
0
Hi!
I'm using JavaScript to manage many variables in my game. Now, I want to add a simple number that can be held and added to throughout the game. So, for example, When you click a link or button, it will add or subtract 1 from the value. Here is my work.
<%
function rStatus(rank) {
      return rank + 1; //Adds 1 to the initial value//
}
rStatus(0) //This is the inital value//
%>
Then later, in my story I want to call back to this number and say something along the lines of "Your rank is rank". Here is my code for that.
<%
print("Your rank is "+rank);
%>
Now for some reason no matter how I run it, it will usually bring up and error that says "sStatus or rank is undefined"

Maybe I'm missing something? Is my code wrong? Please help!

Error with onclick function (Snowman)

$
0
0
Hi!
In my game I'm trying to make it so when you press a button, it will print "Your relationship with Frances has improved!" and then add 1 to this value. Below is my javaScript:
<%
s.FRANCES = function(rstatusup) {
	print("Your relationship with Frances has improved!");
	s.FRANCES = rstatusup + 1;
}
s.FRANCES(0);
%>
<button onclick="rstatusup">Flirt with Frances</button>

What this should be doing is, when you click the "Flirt with Frances" button, it should print "Your relationship with Frances has improved!" and also add 1 to the s.FRANCES value. Instead, when I click the button, I get this error:
⚠ Uncaught ReferenceError: rstatusup is not defined (file:///C:/Users/Alec/AppData/Local/Temp/nw5148_20689/index.html#stories/26d38271-fd3c-5baa-24b7-e9da21c5a0fc/test: 1)

Am I doing something wrong or missing some code that is exclusive to Twine? Maybe someone fluent in JavaScript can help?

How to make 'add inventory' macros support multiple inventories?&Other questions(SugarcubeTwine2)

$
0
0
Here is my story javascript(it's the tutorial script):

window.getInv = function() {
return state.active.variables.inventory;
}
macros.initInv = {
handler: function(place, macroName, params, parser) {
state.active.variables.inventory = [];
}
};
macros.addToInv = {
handler: function(place, macroName, params, parser) {
if (params.length == 0) {
throwError(place, "<<" + macroName + ">>: no parameters given");
return;
}
if (state.active.variables.inventory.indexOf(params[0]) == -1) {
state.active.variables.inventory.push(params[0]);
}
}
};
macros.removeFromInv = {
handler: function(place, macroName, params, parser) {
if (params.length == 0) {
throwError(place, "<<" + macroName + ">>: no parameters given");
return;
}
var index = state.active.variables.inventory.indexOf(params[0]);
if (index != -1) {
state.active.variables.inventory.splice(index, 1);
}
}
};
macros.inv = {
handler: function(place, macroName, params, parser) {
if (state.active.variables.inventory.length == 0) {
new Wikifier(place, 'nothing');
} else {
new Wikifier(place, state.active.variables.inventory.join(','));
}
}
};
macros.invWithLinks = {
handler: function(place, macroName, params, parser) {
if (state.active.variables.inventory.length == 0) {
new Wikifier(place, 'nothing');
} else {
new Wikifier(place, '[]<br>[]');
}
}
};
macros.emptyInv = {
handler: function(place, macroName, params, parser) {
state.active.variables.inventory = []
}
};

StoryInit: <<initinv>>

[[Backpack]]: <<if $inventory.length == 0>>You are have nothing.<<else>>You are carrying:
<<inv>> <<endif>>

What do I do if I want to have <<usagethings>> that drop things into certain inventories? For example, on the Sidebar is a [[Journal]] link, that goes to a passage w/: [[Entries]], [[Photos]], [[Evidence]] & [[Objectives]] on it, I want to be able to have the note player found go into the [[Evidence]] inv instead of the [[Backpack]] when picked up &can I label them like: <<addToInv1>> or <<addToInv2>>? Is it possible to get this without re-writing/pasting the macros for each individual inventory?

Another inventory-related question: I have gotten the "add an inventory" tutorial script to work, but how do I make the listing drop down another line for every item? Instead of eventually developing into a long block of text? I've tried adding bullet pts. to the <<addToInv "a thing">> but after the first object added, it starts showing up as an actual asterisk, regardless of whether between "" when I want mult. words or single word additions or not.
I keep ending up w/ this:
(e.g. Backpack:
-spork, spoon)

When I want it to look like this:
(e.g. Backpack:
-spork
-spoon
-etcetera)

(Sugar Cube 2) Print variable in Link?

$
0
0
In a previous passage $father is set to "Brian" or "Laurence." Now I would like to have "Brian" or "Laurence" appear in a link.
[[<<print $father>> left your mother.->Passage5]]
Just shows up as
$father left your mother.

Putting everything inside click macro doesn't work either.
<<click  [[<<print $father>> left your mother.->Passage5]]>><</click>>

I've tried replacing the print macro with some other stuff but none of them seem to work with Sugar Cube 2. Naked variables work in regular text but not in links.

What am I doing wrong?

[Harlowe] Implementing Background YouTube or Vimeo Video

$
0
0
Hi all,

I'd like to put some background videos in some specific passages.
How can I embbed YouTube or Vimeo Video and sur them as background videos ?

All my best,
David

Setting a MAX width and MAX font size - CSS Harlowe

$
0
0
Dear all,

Stuck with my game looking great on mobile, but it is unendingly responsive, so on laptop or larger screens, the font size and the body column width is HUGE!

How do I set a max width and max font size after which the game should stop responding in the browser? I believe it has something to do with editing tw-story in CSS but I don't know what. I want a max width of 700px please :( And Georgia that doesn't grow to 150%.

Pushing 2d array into array and editing problem

$
0
0
I am pushing an 2d array into an array and trying to edit the starting array between the 2 pushes and also the ending array after the pushes. both give the same results, the effects happen to both of the arrays here is a simple code to show the problem clearly. I am trying to make a large array of characters with lots of data by having a so called template 2d array, randomizing it a bit then adding it to a large array of characters and repeating the processes.
<<set $x=[[1,2,3],[4,5,6]]>>
<<set $y=[]>>

<<set $y.push($x)>>
<<set $x[1][1]=70>>
<<set $y.push($x)>>
<<set $y[0][0][0]=9>>

<<print $y>>


prints out 9, 2, 3, 4, 70, 6, 9, 2, 3, 4, 70, 6

I am taking that this is pass by reference, but how do you pass by value then?
Not sure if this is the best way to do this, any ideas, comments are appreciated.

Thanks
Viewing all 1844 articles
Browse latest View live