User Tools

Site Tools


twine_1.3.5_bugs

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

twine_1.3.5_bugs [2013/11/13 10:13]
l
twine_1.3.5_bugs [2017/10/09 20:39]
Line 1: Line 1:
-All of the following **bugs** or otherwise deprecated behaviour apply only to **Twine 1.3.5**. They have been fixed in version 1.4. 
- 
-==== Start passage problems ==== 
- 
-The Start passage is subject to a few arbitrary restrictions in Twine 1.3.5. 
- 
-* Custom macros loaded through scripts are not usable in the Start passage, because they are loaded after it is initially rendered. 
- 
-==== Inline style syntax ==== 
- 
-The inline-style syntax ( @@background-color:​ghostwhite;​like this@@ ) cannot be used at all. A script to fix this bug is available [[http://​www.glorioustrainwrecks.com/​node/​5063|here]]. 
- 
-==== The back button, <<​back>>,​ and non-deterministic macros ==== 
- 
-Sugarcane, as a consequence of using [[https://​developer.mozilla.org/​en-US/​docs/​Web/​Reference/​Events/​hashchange|hashchanges]] whenever a new passage is visited, causes each passage visit to be registered in the browser'​s history. As a result, it is possible to use the "​back"​ button to undo the previous move, rewinding the game state. The <<​back>>​ macro in 1.3.5 functions by triggering ''​window.back()'',​ which performs the same action. 
- 
-But, what actually happens when this happens is that the entire game page is reloaded, and all the macros in every passage prior to this one are re-run, to re-compute the game state. As a result, a number of unsightly problems can occur. 
- 
- * Random or non-deterministic macros (that invoke ''​Math.random()''​) will return different results, thus changing the game state. 
- 
- * Player input macros (that call ''​prompt()''​) will all trigger again, showing their prompts and forgetting the old provided answers. 
- 
- * Sound macros will trigger again, playing all their sounds simultaneously. 
- 
-As a result, this behaviour is unsuited to rich Twine games. 
- 
-Two scripts exist that can fix this behaviour. [[http://​www.glorioustrainwrecks.com/​node/​5425|This one]] causes Sugarcane to use HTML5 History instead of hashchanges,​ thus permitting the browser Back button to continue its function as an '​undo'​ button. [[http://​www.glorioustrainwrecks.com/​node/​5094|This one]], however, eliminates the Back button functionality entirely, which many may find useful (and, in fact, was formerly replicated by the "​single-screen Jonah" format). 
- 
-==== <<​print 0>> ==== 
- 
-The <<​print>>​ macro cannot print variables whose value is 0. For instance, "You have <<​print $cash>>​ dollars."​ will render as "You have  dollars"​ if $cash is 0. 
- 
-To compensate, you should write <<​print>>​ macros like this: 
- 
-  <<​print $var + "">>​ 
- 
-==== '​and'​ and '​or'​ in macros ==== 
- 
-Code parameters passed to <<​if>>,​ <<​set>>,​ <<​print>>​ and <<​remember>>​ have their operators ("​and",​ "​or",​ "​$",​ "​not",​ etc.) converted to Javascript equivalents ("&&",​ "​||",​ etc.) when they'​re executed. ​ 
- 
-But, due to a bug, this conversion is **also** applied to "​operators"​ that are inside strings passed to these macros. So, <<​print "Vast and large">>​ will print "Vast && large",​ and <<​print "You find $10">>​ will print "You find state.history[0].variables.10"​. 
- 
-A script to fix this bug is available [[http://​www.glorioustrainwrecks.com/​node/​5321|here]]. 
- 
-==== <<​if>>​ and whitespace ==== 
- 
-In this version, the <<​if>>​ macro removes all whitespace contained between the <<​if>>,​ <<​endif>>​ or <<​else>>​ tags and any non-whitespace contained text. 
- 
-Consider this code sample, in which the line breaks are marked: 
- 
-{{http://​i.imgur.com/​E7N7EVz.png}} 
- 
-The magenta line breaks (those contained between the <<​if>>​ and <<​endif>>​ and the actual text) will be removed by the macro. Thus, this will render as follows: 
- 
-  A slice of marmalade toast on a plate, 
-  a bit of quiet, 
-  and a spot of tea. 
- 
-  A slice of marmalade toast  
-  on a plate, 
-  a bit of quiet, 
-  and a spot of tea. 
-  ​ 
-This is technically *not a bug*, but is an unusual behaviour. Its main design purpose was to allow you to indent your code like so: 
- 
-  You're unarmed. 
-  <<if $blood = 1>> 
-    You're covered in blood. 
-  <<​else>>​ 
-    You're fit as a fiddle. 
-  <<​endif>>​ 
- 
-However, this approach has a number of limitations:​ first, the line break before the opening <<​if>>​ and after the concluding <<​endif>>​ are not accounted for - indenting in this style will not eliminate them. More importantly,​ it's impossible to use <<​if>>​ for inserting sentences within paragraphs: 
- 
-  You have a shield.<<​if $sword = 1>> You have a sword.<<​endif>>​ You have a hat. 
-  ​ 
-In this example, the space before "You have a sword."​ is needlessly eliminated. 
- 
-A script that removes this behaviour is available [[http://​www.glorioustrainwrecks.com/​node/​6281|here]]. 
- 
-=== \ in passages and scripts === 
- 
-The \ symbol cannot be used in passage text - it is incorrectly changed to '​\s'​. In order to use '​\'​ in scripts, you must use ''​String.fromCharCode(92)''​. 
  
twine_1.3.5_bugs.txt ยท Last modified: 2017/10/09 20:39 (external edit)