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

Twine 2.1 stuck loading when adding a new story format

$
0
0
I'm trying to add the latest version of sugarcube to twine, I copy and paste the file url but for some reason it doesn't do anything but display "loading..." indefinitely. I've tried several different address formats for the file, such as:
file:\\\C:\Twine\SugarCube-2\format.js

file:///C:/Twine/SugarCube-2/format.js

C:\Twine\SugarCube-2\format.js

C:/Twine/SugarCube-2/format.js

But none of them seem to work. I've ran the program as admin and in compatibility mode and that didn't work either. Any help would be greatly appreciated.

New to twine - have a simple question that I can't seem to find the answer to.

$
0
0
Okay so it's been a long time since I've written any type of code and I'm having a small issue with passages.

So currently I have this:

<<set $friendName = "">>
The girl across the street is your best friend, maybe you could waste the morning with her what was her name again?
<<textbox "$friendName" $friendName>>

So all of that works fine but I want to set her name to print inside of a passage but when I do

[[Leave <<print $friendName>>'s house|Oak Street]]

That doesn't work, so I got rid of the ''s'. No dice. Tried just using $friendName as if it were in a body of text. Nope. Is it possible to to place anything besides | inside?

Audio - Turn off/on option in [Sugarcube 2]? Where to upload?

$
0
0
Right now I'm using the audio macro. Can I give the reader/player an option to mute all audio? If there is not, can I make an option in the UI bar (below saves and restart) that basically turns a variable off (and also stops all audio) or on so that I can check before playing audio if sound is turned on? I've tried some #ui-bar and Setting.addToggle stuff but I don't know how to make it work.

I have tried the Youtube Background Music thing then I found out it's for Twine 1. I guess I'll have to put the audio somewhere else. Most free webhosters seem to have something against hosting music. Obviously some Twine stories do have audio. So where can I upload music for free so that my story can play it?

Change CSS on mouseover macros

$
0
0
Genuinely going insane. I'm using Harlowe 2.0 and I can't find a way to change the mouseover CSS. All I want is for mouseover enchanted hooks to appear green, so a player knows they are interactive. I've tried so many methods and I can't find anything that affects their appearance. This was simple to do in Sugarcube, and it's easy enough to edit link CSS so I can't work out why every CSS selector I've tried doesn't work.

another health bar for sugarcube 2

$
0
0
i have problem about my kind of health bar feature for my game, here we go:

first we set this variable
::StoryInit
<<set $energyTotal to 100>>
<<set $energy to $energyTotal>>
<<set $energyLoss to 0>>


then in story caption, i have button which can fast forward time clock about 1 hour for one click and decrease player energy
::StoryCaption
<<button "">>
<<set $gameDate.setHours($gameDate.getHours() + 1)>>
<<set $energyLoss to 6>>
<<display "Sleepy">>
<</button>>


and here's the formula i get from greyelf and customize a little for my need
::Sleepy
<<script>>
var hBar = $('.energy-bar .stats-bar'),
	bar = hBar.find('.bar'),
	hit = hBar.find('.hit');
var total = State.variables.energyTotal,
	value = State.variables.energy,
	damage = State.variables.energyLoss,
	hitWidth = 0,
	barWidth = (value / total) * 100,
	delayReset = false;

if (damage != 0) {
	hitWidth = (damage / value) * 100;
	value -= damage;
	barWidth = (value / total) * 100;
	State.variables.energy = value;
	State.variables.energyLoss = 0;
	delayReset = true;
}

hBar.data('total', total);
hBar.data('value', value);
/*hit.css('width', hitWidth + "%");*/
bar.css('width', barWidth + "%");

if (delayReset) {
  setTimeout(function(){
	/*hit.css({'width': '0'});*/
	bar.css('width', (State.variables.energy / State.variables.energyTotal) * 100 + "%");
  }, 500);
}
<</script>>


and here's the energy bar will be display in each passage, im using passageHeader because it will show up in top of each passage or maybe its wrong, yes?
::PassageHeader
<div class="stats-wrapper energy-bar">
		<span>Energi</span>
		<div class="stats-bar">
	  		<div class="bar">
		  		<div class="hit"></div>
	  		</div>
		</div>
	</div>


this thing is works well, the energy bar is decreasing whenever i press the fast forward button..... but the problem is when i go to another passage, the enery bar is back to full (you know what i mean?) when it should be not.

what im missing here? any help will be appreciated, sorry for my bad english. thx before

Click Anywhere to Continue

$
0
0
So, this question's probably been asked before, but Google is doing me no favors today.

In Sugarcube 2.0, is there a means to click anywhere on a passage to continue to the next passage? In my specific case, I'd need it to only trigger after all the text is displayed in my passage, as I use TheMadExile's delayed text code.

Delayed Text Javascript
/*
	Define up a setting to control the rate of inter-passage
	text fade-in.
*/
Setting.addList('textDelay', {
	label   : 'Choose how long it takes for text to appear.',
	list    : ['No delay', '1s', '2s', '3s'],
	default : '3s'
});

/*
	Set up a postrender task to handle fading in each text
	section based upon a player selected delay.
*/
postrender['delayed-text'] = function (content) {
	// Find all elements containing the `delayed` class.
	var $elems = $(content).find('.delayed');

	// Text appearance delay (in milliseconds).
	var delay;
	switch (settings.textDelay) {
	case '1s':
		delay = 1000;
		break;
	case '2s':
		delay = 2000;
		break;
	case '3s':
		delay = 3000;
		break;
	default:
		delay = 0;
		break;
	}
	
	if (delay > 0) {
		$elems.each(function (i, el) {
			$(this)
				.delay(delay * (i + 1))
				.fadeIn(1000); // 1 second fade-in
		});
	}
	else {
		$elems.removeClass('delayed');
	}
};

CSS
/*
	Set sections containing the `delayed` class to be hidden
	initially.
*/
.delayed {
	display: none;
}



In passage:
Initial text (Not delayed)
@@.delayed; 
First para (delayed)
@@
@@.delayed;
Second Para (Delayed)

[[Next|SomePassage]]
@@


The idea would be to replace the 'next' with being able to click anywhere. The reason I'm seeking this solution is because it's a 400k game, and there's a loooot of passages with [[Next]] or [[Continue]] or [[End]].

I'd like to just slap an animated arrow at the end of the delayed text, and have it so you could click the screen to continue. This would be more visually appealing and immersive, replicating the feel of many VNs I've played.

Event trigger after a set amount of time? (SugerCube)

$
0
0
Heya, so I'm trying to create an event that appears after a certain amount of time in-game has been reached (using the Javascript shown here).

For example: I would like that after 1 week in-game has happened, it will take the reader to a certain passage/event automatically. But... I'm not entirely sure how I can do that.

I've been looking through the forum and miscellaneous sites for some help but I can't really find anything that works so far.

Does anybody have any tips on how I can do this? Thank you !

Help with losing story file and Twine now not working.

$
0
0
So we created a story, and accidentally closed Twine's application before saving. Upon reopening we just have a grey twine window with no options to do anything. We have accessed the HTML version of the story but it isn't showing up if I try to click and drag it and it doesn't even come up when I try to open in chrome.

It just seems broken. And now the entire Twine application doesn't even work to start a new story. I've deleted it and re-downloaded it, and I compressed the HTML file. Nothing is helping. Any suggestions?

TLDR; Closed without saving, can't open HTML file and now Twine doesn't work.

Twine win64 no longer functions: An error occurred during startup while initially synchronizing

$
0
0
I've been using Twine 2.1.1 just fine for a week, and then my PC happened to crash. Now, Twine will no longer function. When the program opens, it shows the following errors:

Message: Cannot set property 'id' of undefined
File: unknown
Line: unknown
Column: unknown
Stack:
TypeError: Cannot set property 'id' of undefined at IMPORT_STORY (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:40:12189) at i.(anonymous function) (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:84:5845) at r.value (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:84:4841) at dispatch (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:84:4102) at importStory (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:9:14310) at chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:41:15776 at chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:41:15665 at Object.loadAll (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:41:15822) at chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:52:31866 at Object.init (chrome-extension://jbeclgngiacjdjjokiegbkjcpibcdcic/twine.js:53:101)

Twine will not show the Home screen, so I can't do any editing. I've tried to uninstall Twine and reinstall repeatedly, but I just always get this error.

Any help? Thanks,
--Tom

[Twine2.1.1][Sugarcube 2.14] Is there a way to call a macro from JavaScript?

$
0
0
Hey there,

I'm getting tired of duplicating my JS code to define a macro and then define a normal JS function to do exactly the same thing.
Is there a way for me to invoke a macro that I previously defined in JS inside a JS function?

Simple place holder code:
Macro.add('MySugarCubeMacro',
{
    handler: function()
    {
       console.log ("MySugarcubeMacro() invoked!");
    }
});

window.macro_invoker = function()
{
    // i have no clue how you do this...
    Macro.Invoke("MySugarCubeMacro");
}

Thank you for your answer!

[Sugarcube] Split StoryInit across multiple files

$
0
0
As I build up my inventory system and other "reference" data my StoryInit file is getting unwieldly large, is there a way to have it source from multiple files so I can split things up for better organization (and it'd be really nice if it also helped with narrowing down errors, but I accept that might be a pipe dream).

There's also the possibility I am doing things very wrong and there's some other preferred way to include data that will be used throughout the story other than the StoryInit file.

On a similar note - can I split up the Javascript file? It, too is beginning to get excessively large.

Inventory System (Sugarcube 2.0 / Twine 2)

$
0
0
Hi all,

Right now, I've got a very makeshift inventory system going. Basically, I've created a variable for the player's weapon and armor ($player.weapon and $player.armor respectively), and I'm changing the value depending on what they've got in the slot.

However, it occurs to me that this isn't the most flexible approach I could be using, and doesn't leave a lot of growth room for different items or scenarios. E.g. Having multiple weapons in your inventory, dropping weapons, selling weapons, using one-use items, etc. Ideally, the inventory would be accessible from the side-menu - I already know how to create links in it and have already added a few.

I'm sure I could probably come up with some sort of system to do this. But I'm pretty sure given the prevalence of SugarCube games, I'd probably be reinventing the wheel.

In short, does anyone have any inventory system code that I could take and throw into my game? I've used Google to scour the site, but I haven't run across any inventory system code that seems explicitly safe to use for Sugarcube 2.0.

A link to an existing explanation is fine if I'm just doubling up on a common request, which I'm fairly sure I am. :)

[sugarcube] Disable footer passage in certain passages.

$
0
0
Is there a way that I can disable the footer render for just a couple of passages? The footer will house player stats but there is the intro passages like the intro where this is not needed.

How to invoke a Javascript function with a button in Sugarcube?

$
0
0
What I'm trying to do is to invoke a Javascript function that (I think) I defined in the global story javascript. Here's what I did:

1. Wrote my "test" passage:
<div id="progressbar-container"><div id="progressbar"></div></div>

2. Set up the CSS in the Story CSS:
#progressbar-container {
	width: 12em;
        background-color: transparent;
	border: 1px solid white;
	border-radius: 4px;	
}

#progressbar {
	  width: 0%;
          height: 2em;
          background-color: green;
          border-radius: 4px;
}

3. Chucked the following code into the Story Javascript:
function move() {
    var elem = document.getElementById("progressbar"); 
    var width = 1;
    var id = setInterval(frame, 100);
    function frame() {
        if (width >= 100) { clearInterval(id); } 
        else {
            width++; 
            elem.style.width = width + '%'; 
        }
    }
}

4. And finally, I referred to this thread: https://twinery.org/forum/discussion/6524/calling-js-functions-in-twine-2-sugarcube-without-macros-is-it-possible and I put a button that attempts to invoke the "move()" function into the passage:
<<button "Test">><<script>>move();<</script>><</button>>
But when I click the button, get an error message that says bad evaluation: move is not defined.

Please forgive my rather elementary understanding of how Javascript works XD

Using symbolic link to store stories at various location on disk on windows 10

$
0
0
Hi all,

After struggling for a while on how to save stories to another location and found no way, I devised a small work around.

The original goal was to store all stories in a github repo along with my unity3d game.

Here are the steps:
1. Copy your story to the new location. Example c:\github\MyStory.html
2. Open a command windows with administrator privilege in c:\Users\<user>\Documents\Twine\Stories\
3. del MyStory.html (make sure you initial copy worked well!) or back up your story at another location.
3. Run the following command mklink /H MyStory.html c:\github\MyStory.html
4. Repeat for as many stories as you wish to relocate

There you go. You can now work in Twine and the resulting story will be stored in c:\github

Cheers!

[CSS] Text shadow not showing up. (maybe it's a vampire?)

$
0
0
Just a quick question. I have a segment of my story that is supposed to be a glance back in time. I wanted to give it kind of a redshift effect with a drop shadow.
.echo {
color: #ffb366;
text-shadow: 1px 1px 2px black, 0 0 16 red. -1px -1px 32 blue;
}

The text color works fine, but the text shadow is doing absolutely nothing. I have tried multiple variations, but even the most simple black shadow does not show up on anything within the Span.

How to refresh passage

$
0
0
Just like the title said, how i can refresh current passage without go to another passage ? here's my scenario:

i have button to fast forward time by 1 hour and its show current time in here
::StoryCaption
<<button "">>
<<set $gameDate.setHours($gameDate.getHours() + 1)>>
<<display "Clock">>
<</button>>

and here's in passage home, the WORK menu will be visible if current time is between 06:00 AM and 08:30 AM
::Home
<<set $today = GameDays[$gameDate.getDay()]>>
<<if $today neq "Sunday" and $today neq "Saturday">>
	<<if $gameDate.getHours() gte 6>>
		<<if$gameDate.getHours() lte 8 and $gameDate.getMinutes() lte 30>>
			<span class="block-menu">
				[[Work|Office]]
			</span>
		<<endif>>
	<<endif>>
<<endif>>

this thing is really works but i must go to another passage and back to home when time is match, how i can show the WORK menu whenever i press the fast forward button and the time is match without leaving current passage?

thx before, and sorry for my bad english.

[Twine 2.1.1] [SugarCube 2.14] Passages and interactable objects.

$
0
0
Hi there,

I'm looking for best practices and solutions to the following problem:

Let's say I have a passage, in which I want a treasure chest and a person. When the player enters the room, I want to have options poping up that enable me to interact with these two objects. These objects are defined in JavaScript, where I declare the type, count, name and possible actions that can be carried out by the player on a given object.

Now, of course you could put in IFs into each passage, but thats too tedious of a work.
What I want is some way to identify objects in the room and print the actions that can be taken on them by default.

The printing part has already been figured out, now I'm trying to come up with an idea that allows me to track these objects when traversing.

Here's the idea that I have and going to try out:

Add the object names as Tags to the passage in question and when always when entering the passage (by defining a task in JavaScript, once a room has been created) compare the Tags that are assigned to the current room and match them with an array of interactable objects. If the object is on the list then the passage will show the actions that can be taken.

Now, this solution requires me to specify the objects that I want to interact with on a list (or separate lists) and do the comparison against the tags each time I enter a passage.

My question is: is there a better way of doing this? Can the Tags that are assigned to the passage can be used to implement something like this? Would the names of the objects and the tags collide with other names that SugarCube uses and if so which ones?

I know that 'widget' is already taken, but i guess 'treasure chest' and 'pirate' aren't :)

I can't seem to replace a piece of text

$
0
0
I haven't used twine for a good 3-4 months and I loaded it up to complete an almost finished project I've been working on a while back, but something really funny keeps happening to me, I can't seem to use replace, I press it nothing happens, I want to change my link: to link-repeat: and I can't, it's kinda irritating

P.s: I'm using the online version of twine 2.0 with story format harlowe 1.23

Edit:Ya replace would be pretty useful as I'm considering a complete revamp with over 100 replacements doing it manually is ridiculous

"MouseButtonDown" detection, and basic rhythm mechanics (reliable timing)

$
0
0
I'm a beginner in coding and game development.

I would ask these questions discreetly to help discussion be more thorough, but as a new member of the forum I'm worried I might have trouble getting multiple posts approved quickly.

Here's a descriptive example of what I'm looking for:

- element appears, animates for a few moments, becomes primed
- element is held, animates, secondary priming
- narrow window of time the player has to release element
- narrow window of time the player has to engage another element, etc.

Timing does not need to be as precise as a conventional music/rhythm game would require.

Compatibility with touch-screens is greatly prefered but not critical.
Viewing all 1844 articles
Browse latest View live