(click: ?shout)[ (replace: ?shout, "Blast and damnation!") ]
When I run it and click ?shout, the only thing that happens is that the link becomes plaintext. I'm similarly unable to get (append:) working. Chrome/OSX if it's relevant.
(click: ?shout)[ (replace: ?shout, "Blast and damnation!") ]
When I run it and click ?shout, the only thing that happens is that the link becomes plaintext. I'm similarly unable to get (append:) working. Chrome/OSX if it's relevant.
If I create a new Story with a single passage containing the code listed above and then Play the story I get the following error when the passage is first displayed.
TypeError: a is undefined twine.js (line 9, col 15560)
(click: ?shout)[ (replace: ?shout, "Blast and damnation!") ]
When I run it and click ?shout, the only thing that happens is that the link becomes plaintext. I'm similarly unable to get (append:) working. Chrome/OSX if it's relevant.
I mistyped that example. It should actually read:
[Fie and fuggaboo!]<shout|
(click: ?shout)[ (replace: ?shout)[Blast and damnation!] ]
Ideally, the detached (replace: ?shout) call should have deposited at least some kind of error message into the passage prose, but I evidently still have to add that.
As for the error message in the preceding post... report it to Chris, I believe.
If you want some more code examples to work with, here's some I've been using for testing:
Hook references
[Red and (either: "*blue*", "**gold**")]<3|
*?3* (should equal the first line)
(set: $red to ?3) **$red** (should equal the first in strong)
(print: ?3 + "!") (should equal the first line in strong plus a "!" mark)
When/Whenever
(when: time > 2s)[Two seconds passed!] (whenever: time % 8s > 2s and < 4s)[Don't actually use this to make text blink.]
Append/Prepend
[Good]<1| (click: ?1)[(append: ?1)[ gravy!]]
[Good]<2| (click: ?2)[(prepend: ?2)[Perfect is the enemy of ]]
[Bad]<3| (click-append: ?3)[ sector!]
[Bad]<4| (click-prepend: ?4)[The Good serve the ]
Changer commands stored in variables
(set: $x to (transition: "shudder")) $x[Shivering and shaking!] (set: $x to it + (click: ?cool)) |cool>[Yeep!] $x[Yikes!]
10PRINT This demonstrates that the inner macro expression inside a hook attached to (replace:) is evaluated again for each replacement. If it didn't, all of the pipe symbols would turn into identical slanted lines.
Calling macros by name This demonstrates a feature I forgot to mention: you can put a variable in macroname position, and if it contains a string, then the macro of the same name will be run.
(set: $b to "print") ($b: $b) (= print) (put: "set" into $a) ($a: $a to "put") ($a: 2 into $a) $a (= 2)
As StoryInit no longer exists where do you initialize $variables in Twine 2?
If the answer is "in any passage before you use said variable", then how do you tell Harlowe to adsorb a trailing line-feed because adding a backslash to the end of a line does not work correctly in Twine 2
Twine 1:
:: Some Passage The first line of text. <<set $a to 100>>\ This should appear on the second line.
Twine 1 output: [quote] The first line of text. This should appear on the second line.
Twine 2:
The first line of text. (set: $a to 100)\ This should appear on the second line.
Twine 2 output: [quote] The first line of text. \ This should appear on the second line.
You may recall my talk about the "silent area" feature awhile back, but that fell through for version 1.0 due to issues w/r/t making it work solely for Harlowe, and not other story formats that don't support it.
I guess I'll add the line continuation syntax back (though I'd tarried in adding it because I've lately soured on its obtuseness), but until then, the (nobr:) macro can be used in a pinch:
(nobr:)[ (set: $hp to 2) (set: $yelling to (colour: red)) ]
The idea being you can click the "ding"/"dong" links on top and it'll show a bit of text below that goes "Ding!" or "Dong!". Right now if I run passage, the two links at the top are clickable once and then turn into plaintext. Is it possible to make them always clickable, so that you can go back and forth between the Ding and the Dong?
The (click:) macro, and my <<replace>>-macros that it's inspired by, aren't really designed with repeated clicking in mind. I believe there's a way to force it by doing something like this:
...but IMHO I should probably add a variant of (click:) etc. that is always active, like (whenever:) vs. (when:). Need to think of a name, though... (click-ever:) ? (click-forever:) ?
(Also, I guess I should add -inside or -in variants of (replace:), (append:), etc.)
Thinking about (replace-in:)... the fact that (replace:) removes the hook in question is an odd asymmetry with (append:) and (prepend:). I should make (replace:) only replace the interior of the hook by default and add (replace-all:) or (supplant:) or (overwrite:) or something that does remove the hook.
OSX 10.7.5, Firefox 32.0.3. On the twinery.org online version of Twine 2. With some of the new syntax, it seems pretty easy to unwittingly produce strange errors/behavior (try these):
(set: $arrowCount to 3) You have fletched $arrowCount arrows today - and earned $123.
(set: $arrowCount to 3) You have fletched $arrowCount arrows today - and earned ten dollars (ie: a respectable amount).
And the tilde (actually a "grave," not a tilde) doesn't escape a sigil/dollar sign, with disastrous results:
(set: $arrowCount to 3) You have fletched $arrowCount arrows today - and earned `$`arrowCount.
Also, apparently the heading "#"s don't work correctly on the first line of a passage, and (nobr:) doesn't work correctly with headings. In my launch passage, I had:
Some impressions after using on Opera and Firefox:
With the editor: All time I have a bad code in a passage the edit passage pop-up refuse to close (even after correcting the bad code), I need to reload the page and the problematic passage disappear. The error in javascript console is "Error: A "url" property or function must be specified"
There is no more a way to assign a variable in the link to other passage? I searched the documentation, but can't find. As a workaround, used this logic:
[text text text [I want to be a link]<want| ]<whole|
(click: ?want)[ I want to be in another passage (set: $var to 1)
[[real link to exit]] (remove: ?whole) ]
With works, but is not optimal.
I exported the story with Opera and can't import on Firefox.
While playing: Also, the expression (set: $var to $var + 1) or (set: $var to it +1) returned me a type error in execution time. $var was initialized with (set: $var to 0)
On Firefox playing is very slow, but on Opera is Ok.
All time I have a bad code in a passage the edit passage pop-up refuse to close (even after correcting the bad code), I need to reload the page and the problematic passage disappear. The error in javascript console is "Error: A "url" property or function must be specified"
This happens because the Delete key is also used to delete a passage from the Passage Map. So if you press this key while editing the text in your passage it deletes the passage you are editing on the Passage Map (you cant see this because the editor is in the way) and this results in you not being able to close the passage editor because the passage you are editing no longer exists.
This problem can also happen when using the Backspace key as well as the original Window cut/paste/remove keys (CTRL-INS, SHIFT-INS & SHIFT-DEL, which some of us old timers still use instead of those new keys borrowed from Word Perfect. eg: CTRL-C, CTRL-V & CTRL-X)
There is a patch for this problem and it should be fixed in the next version of the beta.
Restoring an archived story or importing a published one now works.
Keys no longer 'leak' out of modal dialogs. This was pretty awful as hitting the Delete key while editing a passage would delete the passage in the story map. :-\
Link arrows update correctly if a passage gets bumped out of the way by another one, or is snapped to a grid after a drag.
It's my first time using Twine at all, never used the desktop version, I jumped directly to this beta, and I'm having the most basic problem. I couldn't find any mention of it, so it's probably my fault and not a bug, but for no matter what I do I can't seem to get it.
So I create a passage, I edit the stylesheet and add CSS like this:
tw-passage {color: red}
Then I play it, and the custom CSS is not there at all. What am I missing? Thanks.
I'm on Linux. Firefox and Chromium have the same effect.
Awesome! Because not being able to increment variables was really cramping my style, to the point where I was considering starting my project over in some other choice-based engine.
I really like Twine, though.
I can't seem to get through writing any sort of IF without a complicated state-machine, and it just gets more intricate as I go along regardless of what my design document says. It's a weakness.
As the macro system currently stands, there's a consistent means of determining when a macro's arguments will be evaluated: only once, when the macro is printed. So, for
(if: (prompt:"Password?") is "Gadzookius")
, the (prompt:) is only run as soon as it prints, and never a moment after.
Similarly, clicking (click-replace: "Hero")[$name] only changes each occurrence of "Hero" to the value of $name at the point that it is printed, and doesn't change even if (set: $name to "Egon") occurs later in the prose, before the player clicks.
To defer the evaluation of $name to a string, you currently use hooks to fence off the macro's printing: (click: "Hero")[(replace: "Hero")[$name]]. This, I feel, make it explicit when evaluation occurs, and in that respect I'm satisfied with it (although I may wish to make it less verbose, esp. w/r/t the repetition of "Hero" etc).
But, the one divergence from this pattern is (when:)/(whenever:) - their arguments are evaluated at print time, but also every millisecond afterward. This means that (when: $killed is true)'s argument is affected by a (set: $killed to true) added afterward - which is desired and useful behaviour! But syntactically, it doesn't gel with the above system of explication.
Let's consider how (click:) works: it's a "live" macro in roughly the same sense as (when:), insofar as it gives a page dynamic behaviour that is active after the macro is printed. But, the argument to (click:) is still evaluated only once - (set: $specialWord to "cleats")(click: $specialWord) only applies an event to occurrences of "cleats", and is unaffected if a (set: $specialWord to "spats") occurs after. This is the model I think is preferable for the (when:) syntax.
So, I wish to replace (when:) and (whenever:) with a different macro - something like (every:) that takes a time argument, and re-runs the attached hook that often. The equivalent of (when: time > 2s)[...] would be (every:1ms)[(if: time > 2s)[...]]. This is more verbose, I admit, but it's more composable - you can omit the (if:) to make a hook which is re-printed frequently, not easily achievable with (whenever:) without using modulo ("%").
The only problem is that (every:)-(if:) nesting actually behaves like (whenever:) - there's no obvious way to disable the (every:) from within its hook, let alone within the (if:). This is the hurdle preventing me from enacting this change. Hopefully I can overcome this in the next few days.
Another thing I want to reconsider is the (colour:) macro - its name, rather. The thing is, colours are actually first-class citizens (that roughly means "can be assigned to variables") in Twine 2 - you can (set: $x to #633), and mix colours by adding them, like (set: $y to #4f8 + white) - but the (colour:) macro produces a Changer Command, not a colour value. Rather than producing a colour, it takes one and then issues a command to apply that colour to hook text.
As it turns out, (colour:) has an alias name of (text-colour:), and I'd like to change it so that it uses that name (+ Americanized spelling alias) exclusively. The (colour:) name could then refer to a macro that converts strings to colours in a more versatile fashion - it could interpret CSS3 colours like (colour: "burlywood"), and add them together, (text-colour: black + (colour:"forestgreen")).
...Of course, this is presaged on the idea that colours should be first-class at all. Maybe they shouldn't? Maybe the mixing properties of colours should be achieved by adding Changer Commands? (text-colour: red) + (text-colour: white) currently makes a changer that turns text red - the first command overriding the second. That doesn't look that too intuitive. Aggh...
A question about a recent change to the Harlowe story format, the patch states: * Changed the syntax for property access from "." to "'s" - that is, you write "$array's 1st" instead of "$array.1st".
If you have a variable containing an array of arrays and you want to access the first child element of the first outer element ([0][0]) you would write it as: $array's 1st's 1st
Comments
If I create a new Story with a single passage containing the code listed above and then Play the story I get the following error when the passage is first displayed.
As for the error message in the preceding post... report it to Chris, I believe.
Hook references When/Whenever Append/Prepend Changer commands stored in variables 10PRINT
This demonstrates that the inner macro expression inside a hook attached to (replace:) is evaluated again for each replacement. If it didn't, all of the pipe symbols would turn into identical slanted lines. Calling macros by name
This demonstrates a feature I forgot to mention: you can put a variable in macroname position, and if it contains a string, then the macro of the same name will be run.
If the answer is "in any passage before you use said variable", then how do you tell Harlowe to adsorb a trailing line-feed because adding a backslash to the end of a line does not work correctly in Twine 2
Twine 1: Twine 1 output:
[quote]
The first line of text.
This should appear on the second line.
Twine 2: Twine 2 output:
[quote]
The first line of text.
\ This should appear on the second line.
I guess I'll add the line continuation syntax back (though I'd tarried in adding it because I've lately soured on its obtuseness), but until then, the (nobr:) macro can be used in a pinch:
(Also, I guess I should add -inside or -in variants of (replace:), (append:), etc.)
Gotcha. Thanks.
(click-endlessly:) (click-eternally:) (click-until-the-end-of-time:) (never-stop-clicking:) (oh-god----:) (---------------:)
In my launch passage, I had: but that printed:
#Title
by My Name
So, I inserted a blank line above the Title, and it worked as expected, but with the blank line in the final product.
So I tried: but that gave me:
[
Title]
by My Name
With the editor:
All time I have a bad code in a passage the edit passage pop-up refuse to close (even after correcting the bad code), I need to reload the page and the problematic passage disappear.
The error in javascript console is "Error: A "url" property or function must be specified"
There is no more a way to assign a variable in the link to other passage? I searched the documentation, but can't find. As a workaround, used this logic: With works, but is not optimal.
I exported the story with Opera and can't import on Firefox.
While playing:
Also, the expression (set: $var to $var + 1) or (set: $var to it +1) returned me a type error in execution time. $var was initialized with (set: $var to 0)
On Firefox playing is very slow, but on Opera is Ok.
This happens because the Delete key is also used to delete a passage from the Passage Map.
So if you press this key while editing the text in your passage it deletes the passage you are editing on the Passage Map (you cant see this because the editor is in the way) and this results in you not being able to close the passage editor because the passage you are editing no longer exists.
This problem can also happen when using the Backspace key as well as the original Window cut/paste/remove keys (CTRL-INS, SHIFT-INS & SHIFT-DEL, which some of us old timers still use instead of those new keys borrowed from Word Perfect. eg: CTRL-C, CTRL-V & CTRL-X)
There is a patch for this problem and it should be fixed in the next version of the beta.
It's my first time using Twine at all, never used the desktop version, I jumped directly to this beta, and I'm having the most basic problem. I couldn't find any mention of it, so it's probably my fault and not a bug, but for no matter what I do I can't seem to get it.
So I create a passage, I edit the stylesheet and add CSS like this: Then I play it, and the custom CSS is not there at all. What am I missing? Thanks.
I'm on Linux. Firefox and Chromium have the same effect.
I'm using Chrome. Replicated on Safari and Firefox.
UPDATE 10/19/14: I downloaded latest source for Harlowe from https://bitbucket.org/_L_/harlowe
This seems to fix this particular problem
I'm having this problem, too.
If I do (goto: "bridge") it says: undefined.
If I do (goto: bridge) it says: bridge is not defined.
Thirding.
I really like Twine, though.
I can't seem to get through writing any sort of IF without a complicated state-machine, and it just gets more intricate as I go along regardless of what my design document says. It's a weakness.
(when: time > $t + 2s)
you can do:
(when: time - 2s > $t)
which comes down to the same thing and should work (at least, it does for me).
As the macro system currently stands, there's a consistent means of determining when a macro's arguments will be evaluated: only once, when the macro is printed. So, for , the (prompt:) is only run as soon as it prints, and never a moment after.
Similarly, clicking (click-replace: "Hero")[$name] only changes each occurrence of "Hero" to the value of $name at the point that it is printed, and doesn't change even if (set: $name to "Egon") occurs later in the prose, before the player clicks.
To defer the evaluation of $name to a string, you currently use hooks to fence off the macro's printing: (click: "Hero")[(replace: "Hero")[$name]]. This, I feel, make it explicit when evaluation occurs, and in that respect I'm satisfied with it (although I may wish to make it less verbose, esp. w/r/t the repetition of "Hero" etc).
But, the one divergence from this pattern is (when:)/(whenever:) - their arguments are evaluated at print time, but also every millisecond afterward. This means that (when: $killed is true)'s argument is affected by a (set: $killed to true) added afterward - which is desired and useful behaviour! But syntactically, it doesn't gel with the above system of explication.
Let's consider how (click:) works: it's a "live" macro in roughly the same sense as (when:), insofar as it gives a page dynamic behaviour that is active after the macro is printed. But, the argument to (click:) is still evaluated only once - (set: $specialWord to "cleats")(click: $specialWord) only applies an event to occurrences of "cleats", and is unaffected if a (set: $specialWord to "spats") occurs after. This is the model I think is preferable for the (when:) syntax.
So, I wish to replace (when:) and (whenever:) with a different macro - something like (every:) that takes a time argument, and re-runs the attached hook that often. The equivalent of (when: time > 2s)[...] would be (every:1ms)[(if: time > 2s)[...]]. This is more verbose, I admit, but it's more composable - you can omit the (if:) to make a hook which is re-printed frequently, not easily achievable with (whenever:) without using modulo ("%").
The only problem is that (every:)-(if:) nesting actually behaves like (whenever:) - there's no obvious way to disable the (every:) from within its hook, let alone within the (if:). This is the hurdle preventing me from enacting this change. Hopefully I can overcome this in the next few days.
Essentially:
(set: $alertText to (font:"Courier New") + (==><==) + (shudder:) + (colour:"#e74"))
$alertText[OMG]
To make $alertText also center or have some consistent other margin?
....
Another thing I want to reconsider is the (colour:) macro - its name, rather. The thing is, colours are actually first-class citizens (that roughly means "can be assigned to variables") in Twine 2 - you can (set: $x to #633), and mix colours by adding them, like (set: $y to #4f8 + white) - but the (colour:) macro produces a Changer Command, not a colour value. Rather than producing a colour, it takes one and then issues a command to apply that colour to hook text.
As it turns out, (colour:) has an alias name of (text-colour:), and I'd like to change it so that it uses that name (+ Americanized spelling alias) exclusively. The (colour:) name could then refer to a macro that converts strings to colours in a more versatile fashion - it could interpret CSS3 colours like (colour: "burlywood"), and add them together, (text-colour: black + (colour:"forestgreen")).
...Of course, this is presaged on the idea that colours should be first-class at all. Maybe they shouldn't? Maybe the mixing properties of colours should be achieved by adding Changer Commands? (text-colour: red) + (text-colour: white) currently makes a changer that turns text red - the first command overriding the second. That doesn't look that too intuitive. Aggh...
* Changed the syntax for property access from "." to "'s" - that is, you write "$array's 1st" instead of "$array.1st".
If you have a variable containing an array of arrays and you want to access the first child element of the first outer element ([0][0]) you would write it as:
$array's 1st's 1st