diff --git a/examples/items.gamebook b/examples/items.gamebook index c21d9c2..1ff8b18 100644 --- a/examples/items.gamebook +++ b/examples/items.gamebook @@ -5,7 +5,8 @@ Turn to [[tjunction]]. * tjunction You have reached a t-junction. -Here you find a [found]key[/found]. You can go west to [[door]], or +Here you find a [found]key[/found] and a [found]stick[/found]. +You can go west to [[door]], or east to [[curse]]. * door @@ -26,7 +27,14 @@ Turn to [[inside]]. * curse There is a [found]cursed bracelet[/found] here. You can go on to -[[portal]] or go back to [[tjunction]]. +[[portal]] or go back to [[tjunction]]. You can also drop the +stick for no particular reason, see [[drop_stick]]. + +* drop_stick +OK [drop]stick[/drop] dropped. Turn back to [[tjunction]] to confirm +stick can not be picked up again even if the text says it is there +(books work that way, although ideally this dynamic version should +provide some hints that it is no longer there). * portal A magic portal ahead will only allow you to pass if you did not pick up the diff --git a/templates/html/begin.html b/templates/html/begin.html index 3351b16..624fc15 100644 --- a/templates/html/begin.html +++ b/templates/html/begin.html @@ -13,7 +13,8 @@ 'codewords' : {}, 'take' : function(item) { - if (this.inventory.indexOf(item) === -1) { + if (this.inventory.indexOf(item) === -1 + && !(item in gamebook.droppedItems)) { this.inventory.push(item); this.inventory.sort(); gamebook.updateInventory(); @@ -24,6 +25,7 @@ var i = this.inventory.indexOf(item); if (i >= 0) { this.inventory.splice(i, 1); + gamebook.droppedItems[item] = true; gamebook.updateInventory(); } }, @@ -48,6 +50,8 @@ 'autoRun' : {}, + 'droppedItems' : {}, + 'addAutoRun' : function(nr, f) { if (nr in this.autoRun) { this.autoRun[nr].push(f); diff --git a/templates/html/hasnot.html b/templates/html/hasnot.html new file mode 100644 index 0000000..a110bf5 --- /dev/null +++ b/templates/html/hasnot.html @@ -0,0 +1 @@ +%(inner)s \ No newline at end of file diff --git a/templates/html/notcarries.html b/templates/html/notcarries.html new file mode 100644 index 0000000..3b12cb2 --- /dev/null +++ b/templates/html/notcarries.html @@ -0,0 +1 @@ +%(inner)s \ No newline at end of file diff --git a/todo.org b/todo.org index 4ad8af6..e1b8c0b 100644 --- a/todo.org +++ b/todo.org @@ -1,4 +1,4 @@ -* TODO [20/47] [42%] +* TODO [21/47] [44%] - [X] Debug output - [X] DOT output - [X] LaTeX output @@ -21,7 +21,7 @@ - [X] Remove item from inventory (forced by instructions) - [X] Enable link if not having an item - [X] Enable link if not having a codeword -- [ ] Make sure dropped items can not be picked up again +- [X] Make sure dropped items can not be picked up again - [ ] Make inventory and codewords generic They are the same, sort of, and it might be good to be able to add other similar entities as well, like skills or spells or whatever.