From d20db213bb679b3daded777259144e48af0b23a4 Mon Sep 17 00:00:00 2001 From: gumi Date: Sun, 15 Jan 2017 12:11:40 -0500 Subject: make openbook inherit book name from calling npc --- npc/001-2-5/books.txt | 8 +++----- npc/001-2-6/books.txt | 24 +++++++++--------------- npc/functions/game-rules.txt | 4 ++-- npc/functions/openbook.txt | 12 ++++++++---- 4 files changed, 22 insertions(+), 26 deletions(-) diff --git a/npc/001-2-5/books.txt b/npc/001-2-5/books.txt index 16f67100..d8f3654b 100644 --- a/npc/001-2-5/books.txt +++ b/npc/001-2-5/books.txt @@ -17,19 +17,17 @@ } OnShelfUse: - @book_name$ = .bookname$; - if (openbookshelf ()) + if (openbookshelf()) read_book; close; OnUse: - @book_name$ = .bookname$; - if (openbook ()) + if (openbook()) read_book; close; OnInit: - .bookname$ = "Communication Theory"; + .book_name$ = "Communication Theory"; .sex = G_OTHER; .distance = 1; end; diff --git a/npc/001-2-6/books.txt b/npc/001-2-6/books.txt index 231785d6..23d26b8b 100644 --- a/npc/001-2-6/books.txt +++ b/npc/001-2-6/books.txt @@ -37,19 +37,17 @@ } OnShelfUse: - @book_name$ = .bookname$; - if (openbookshelf ()) + if (openbookshelf()) read_book; close; OnUse: - @book_name$ = .bookname$; - if (openbook ()) + if (openbook()) read_book; close; OnInit: - .bookname$ = "The Piou and The Fluffy"; + .book_name$ = "The Piou and The Fluffy"; .sex = G_OTHER; .distance = 1; end; @@ -92,19 +90,17 @@ OnInit: } OnShelfUse: - @book_name$ = .bookname$; - if (openbookshelf ()) + if (openbookshelf()) read_book; close; OnUse: - @book_name$ = .bookname$; - if (openbook ()) + if (openbook()) read_book; close; OnInit: - .bookname$ = "Poem about Poems"; + .book_name$ = "Poem about Poems"; .sex = G_OTHER; .distance = 1; end; @@ -125,19 +121,17 @@ OnInit: } OnShelfUse: - @book_name$ = .bookname$; - if (openbookshelf ()) + if (openbookshelf()) read_book; close; OnUse: - @book_name$ = .bookname$; - if (openbook ()) + if (openbook()) read_book; close; OnInit: - .bookname$ = "Chorus of the Woods"; + .book_name$ = "Chorus of the Woods"; .sex = G_OTHER; .distance = 1; end; diff --git a/npc/functions/game-rules.txt b/npc/functions/game-rules.txt index afefd530..bb1cd3da 100644 --- a/npc/functions/game-rules.txt +++ b/npc/functions/game-rules.txt @@ -44,12 +44,12 @@ OnCall: close; OnUseBook: - if (openbook(.book_name$)) + if (openbook()) read_book; bye; OnShelfUse: - if (openbookshelf(.book_name$)) + if (openbookshelf()) read_book; bye; diff --git a/npc/functions/openbook.txt b/npc/functions/openbook.txt index 8e7be072..9153900e 100644 --- a/npc/functions/openbook.txt +++ b/npc/functions/openbook.txt @@ -7,21 +7,25 @@ // @book_name$ = The name of the book to read. function script openbook { - .@book_name$ = "\"" + l(getarg(0, @book_name$)) + "\""; + .@book_name$ = "\"" + l(getarg(0, getvariableofnpc(.book_name$, strnpcinfo(0)))) + "\""; narrator 4, - l("You open a book named @@.", .@book_name$), + l("You open a book named @@.", .@book_name$); + + narrator 8, l("Do you want to read it?"); return (select ("Yes.", "No.") == 1); } function script openbookshelf { - .@book_name$ = "\"" + l(getarg(0, @book_name$)) + "\""; + .@book_name$ = "\"" + l(getarg(0, getvariableofnpc(.book_name$, strnpcinfo(0)))) + "\""; narrator 4, l("You see a dust covered book on the shelf..."), - l("The name of the book is @@.", .@book_name$), + l("The name of the book is @@.", .@book_name$); + + narrator 8, l("Do you want to read it?"); return (select ("Yes.", "No.") == 1); -- cgit v1.2.3-70-g09d2