[an error occurred while processing this directive]
[<a href="index.shtml">Package Index</a></code> | <a href="index_std.shtml">Mudlib Index</a></code> | <a href="index_eff.shtml">Effect Index</a></code>]<br><h2>File /std/book.c</h2>
A nice book object.  A book will be a collection of pages.
You can tear pages out of a book, you can add pages (though adding
a page isnt overly useful, unless you bind it in of course).
<p>
Each page is an object.  Pages that are torn out are handled
as empty spots in the array.
<p><p>Written by Pinkfish
<h2>Inherits</h2>
This class inherits the following classes <a href="std.object.c.shtml">/std/object.c</a><h2>Includes</h2>
This class includes the following files <a href="include.playtesters.h.shtml">/include/playtesters.h</a>, <a href="include.move_failures.h.shtml">/include/move_failures.h</a> and <a href="include.player.h.shtml">/include/player.h</a><h2>Method index</h2>
<dl><ul>
<li><a href="#add_page_after">add_page_after</a>(object, int)<br/>
This method adds a new page in after the selected page.
<li><a href="#create_default_page_object">create_default_page_object</a>()<br/>
This method creates a new default page object for this book.
<li><a href="#is_current_page_torn_out">is_current_page_torn_out</a>()<br/>
This method checks to see if the current page is torn out.
<li><a href="#is_default_page">is_default_page</a>(int)<br/>
This method checks to see if the page is still the default page object
or if it is something else altogether.
<li><a href="#is_page_torn_out">is_page_torn_out</a>(int)<br/>
This method checks to see if the specified page is torn out.
<li><a href="#make_page_blank">make_page_blank</a>(int)<br/>
This method makes the selected page blank.
<li><a href="#query_book">query_book</a>()<br/>
Tells us if this is a book object.
<li><a href="#query_book_num">query_book_num</a>()<br/>
This method returns the current number of the book.
<li><a href="#query_current_page">query_current_page</a>()<br/>
Returns the object associated with the current open page.
<li><a href="#query_current_page_clone">query_current_page_clone</a>()<br/>
This function makes sure the page actually
exists.
<li><a href="#query_default_page_object">query_default_page_object</a>()<br/>
This method returns the default page object.
<li><a href="#query_ignore_saved_pages">query_ignore_saved_pages</a>()<br/>
This method returns the current setting of the ignore saved
pages variable.
<li><a href="#query_num_pages">query_num_pages</a>()<br/>
Queries the number of pages in the book.
<li><a href="#query_open_page">query_open_page</a>()<br/>
What is the current open page.
<li><a href="#query_pages">query_pages</a>()<br/>
Returns the pages array.
<li><a href="#query_player">query_player</a>()<br/>
This method will return  the player associated with the auto loading
process.
<li><a href="#query_selected_page">query_selected_page</a>(int)<br/>
This method returns the contents of the selected page.
<li><a href="#query_selected_page_clone">query_selected_page_clone</a>(int)<br/>
This method returns the contents of the selected page, if a default
object is returned a real clone for the page is created instead.
<li><a href="#replace_page_with">replace_page_with</a>(object, int)<br/>
This method replaces the selected page with a new page.
<li><a href="#set_book_num">set_book_num</a>(int)<br/>
This method sets the current number of the book.
<li><a href="#set_default_page_object">set_default_page_object</a>(string)<br/>
Sets the object to use as the default page.
<li><a href="#set_ignore_saved_pages">set_ignore_saved_pages</a>(int)<br/>
This method sets the current setting of the ignore saved
pages variable.
<li><a href="#set_no_pages">set_no_pages</a>(int)<br/>
Set the number of pages in the book.
<li><a href="#set_open_page">set_open_page</a>(int)<br/>
Sets the currently open page.
<li><a href="#set_player">set_player</a>(object)<br/>
This method is called by the auto loading process to set the current
player on this object.
<li><a href="#tear_current_page_out">tear_current_page_out</a>(object)<br/>
This method tears the current page out of the book and returns it
to us.
</ul><h2>Public Functions</h2>
These are functions that everyone can access.<p>
.<ul><a name="add_page_after">
add_page_after</a><pre>
int add_page_after(object page,
                   int after)
</pre></br>
This method adds a new page in after the selected page.  The pages
are numbered from 1, so adding a page after page 0 will place a
page on the start and after the last page onto the end.
<br/><ul>
<li><b>Parameters:</b>
<br/>page - the page to add
<br/>after - the page to add it after
<li><b>Returns:</b>
<br/>1 on success, 0 on failure
<li><b>See also:</b>
<br/><a href="#query_current_page">query_current_page()</a> and <a href="#query_num_pages">query_num_pages()
</a></dl>

<ul><a name="create_default_page_object">
create_default_page_object</a><pre>
object create_default_page_object()
</pre></br>
This method creates a new default page object for this book.  THis
can be used for whatever nefarious purposes you want.
<br/><ul>
<li><b>Returns:</b>
<br/>a new default page object

</dl>

<ul><a name="is_current_page_torn_out">
is_current_page_torn_out</a><pre>
int is_current_page_torn_out()
</pre></br>
This method checks to see if the current page is torn out.
<br/><ul>
<li><b>Returns:</b>
<br/>1 if torn out, 0 if not
<li><b>See also:</b>
<br/><a href="#query_current_page">query_current_page()</a>, <a href="#query_open_page">query_open_page()</a> and <a href="#is_page_torn_out">is_page_torn_out()
</a></dl>

<ul><a name="is_default_page">
is_default_page</a><pre>
int is_default_page(int num)
</pre></br>
This method checks to see if the page is still the default page object
or if it is something else altogether.
<br/><ul>
<li><b>Returns:</b>
<br/>1 if it is the default page object, 0 if not

</dl>

<ul><a name="is_page_torn_out">
is_page_torn_out</a><pre>
int is_page_torn_out(int page)
</pre></br>
This method checks to see if the specified page is torn out.
<br/><ul>
<li><b>Parameters:</b>
<br/>page - the page number to check
<li><b>Returns:</b>
<br/>1 if it is torn out, - if not
<li><b>See also:</b>
<br/><a href="#is_current_page_torn_out">is_current_page_torn_out()
</a></dl>

<ul><a name="make_page_blank">
make_page_blank</a><pre>
int make_page_blank(int num)
</pre></br>
This method makes the selected page blank.  It defaults it back to a
default page object as if the book had just been created.
<br/><ul>
<li><b>Parameters:</b>
<br/>num - the page to make blank
<li><b>See also:</b>
<br/><a href="#replace_page_with">replace_page_with()</a>, <a href="#add_page_after">add_page_after()</a> and <a href="#add_blank_page_after">add_blank_page_after()
</a></dl>

<ul><a name="query_book">
query_book</a><pre>
int query_book()
</pre></br>
Tells us if this is a book object.
<br/><ul>
<li><b>Returns:</b>
<br/>always returns 1

</dl>

<ul><a name="query_book_num">
query_book_num</a><pre>
int query_book_num()
</pre></br>
This method returns the current number of the book.  This is assigned
and used in conjunction with the book handler.
<br/><ul>
<li><b>Returns:</b>
<br/>the current book number

<li><b>See also:</b>
<br/><a href="obj.handlers.book_handler.c.shtml">/obj/handlers/book_handler.c</a> and /std/print_shop.c</dl>

<ul><a name="query_current_page">
query_current_page</a><pre>
object query_current_page()
</pre></br>
Returns the object associated with the current open page.  If the
page does not actualy exist yet then the default base object
is returned.  This object should be handled carefully...  If the
page is torn out then the next readable page is returned or
0 is returned.
<br/><ul>
<li><b>Returns:</b>
<br/>the current page object
<li><b>See also:</b>
<br/><a href="#query_current_page_clone">query_current_page_clone()</a>, <a href="#set_open_page">set_open_page()</a>, <a href="#query_open_page">query_open_page()</a> and <a href="#query_current_page_clone">query_current_page_clone()
</a></dl>

<ul><a name="query_current_page_clone">
query_current_page_clone</a><pre>
object query_current_page_clone()
</pre></br>
This function makes sure the page actually
exists.  If it does not exist, then it will clone one
up for us.  This one should be used as you will not end up with the
base object in this case.  If you are planning to modify the page,
then use this call.
<br/><ul>
<li><b>Returns:</b>
<br/>the object of the current page

<li><b>See also:</b>
<br/><a href="#query_current_page">query_current_page()</a></dl>

<ul><a name="query_default_page_object">
query_default_page_object</a><pre>
string query_default_page_object()
</pre></br>
This method returns the default page object.
<br/><ul>
<li><b>Returns:</b>
<br/>the default page object (as a string)

</dl>

<ul><a name="query_ignore_saved_pages">
query_ignore_saved_pages</a><pre>
int query_ignore_saved_pages()
</pre></br>
This method returns the current setting of the ignore saved
pages variable.  If this is true then
the pages form the players auto_load stuff will be ignored totaly
and only the page creates in setup would be
used.
<br/><ul>
<li><b>Returns:</b>
<br/>the current ignore saved page attribute

<li><b>See also:</b>
<br/><a href="#set_ignore_saved_pages">set_ignore_saved_pages()</a></dl>

<ul><a name="query_num_pages">
query_num_pages</a><pre>
int query_num_pages()
</pre></br>
Queries the number of pages in the book.
<br/><ul>
<li><b>Returns:</b>
<br/>the number of pages in the book
<li><b>See also:</b>
<br/><a href="#set_no_pages">set_no_pages()
</a></dl>

<ul><a name="query_open_page">
query_open_page</a><pre>
int query_open_page()
</pre></br>
What is the current open page.  Returns 0 if the book is not
open.
<br/><ul>
<li><b>Returns:</b>
<br/>the current open page
<li><b>See also:</b>
<br/><a href="#set_open_page">set_open_page()</a> and <a href="#query_current_page">query_current_page()
</a></dl>

<ul><a name="query_pages">
query_pages</a><pre>
mixed * query_pages()
</pre></br>
Returns the pages array.
<br/><ul>
<li><b>Returns:</b>
<br/>the array containing the pages information

</dl>

<ul><a name="query_player">
query_player</a><pre>
object query_player()
</pre></br>
This method will return  the player associated with the auto loading
process.
<br/><ul>
<li><b>Returns:</b>
<br/>the player in use by the autoloading
<li><b>See also:</b>
<br/><a href="#set_player">set_player()
</a></dl>

<ul><a name="query_selected_page">
query_selected_page</a><pre>
object query_selected_page(int num)
</pre></br>
This method returns the contents of the selected page.  The number
must be greator than 0.  This will return the exact value of the
page, it will not search for non-torn out pages.  Becare with
the return value of this as the default page object might be
returned if the page does not actually exist.  If you need a
real object remember to use the clone version.
<br/><ul>
<li><b>Parameters:</b>
<br/>num - the page to return
<li><b>Returns:</b>
<br/>0 on failure or if the page is torn out, the object on success

</dl>

<ul><a name="query_selected_page_clone">
query_selected_page_clone</a><pre>
object query_selected_page_clone(int num)
</pre></br>
This method returns the contents of the selected page, if a default
object is returned a real clone for the page is created instead.
<br/><ul>
<li><b>Parameters:</b>
<br/>num - the page to return
<li><b>Returns:</b>
<br/>0 on failure or if the page is torn out, the object on success

</dl>

<ul><a name="replace_page_with">
replace_page_with</a><pre>
int replace_page_with(object page,
                      int num)
</pre></br>
This method replaces the selected page with a new page.  The old page
is dested if it can be and replaced with a nice shiny new page object.
<br/><ul>
<li><b>Parameters:</b>
<br/>page - the page to replace with
<br/>num - the page number to replace
<li><b>Returns:</b>
<br/>1 on success, 0 on failure
<li><b>See also:</b>
<br/><a href="#add_page_after">add_page_after()
</a></dl>

<ul><a name="set_book_num">
set_book_num</a><pre>
void set_book_num(int num)
</pre></br>
This method sets the current number of the book.  This is assigned
and used in conjunction with the book handler.
<br/><ul>
<li><b>Parameters:</b>
<br/>num - the new book number

<li><b>See also:</b>
<br/><a href="obj.handlers.book_handler.c.shtml">/obj/handlers/book_handler.c</a> and /std/print_shop.c</dl>

<ul><a name="set_default_page_object">
set_default_page_object</a><pre>
void set_default_page_object(string obj)
</pre></br>
Sets the object to use as the default page.  If this is not set the
the object /obj/misc/paper.c will be used.
<br/><ul>
<li><b>Parameters:</b>
<br/>ob - the object to use as the default page

</dl>

<ul><a name="set_no_pages">
set_no_pages</a><pre>
void set_no_pages(int no)
</pre></br>
Set the number of pages in the book.  If there are too many pages
in the book, then pages are removed from the top to create the
correct size and if there are too few pages then pages are
added onto the end of the pages array.
<br/><ul>
<li><b>Parameters:</b>
<br/>no - the number of pages
<li><b>See also:</b>
<br/><a href="#query_pages">query_pages()</a> and <a href="#query_num_pages">query_num_pages()
</a></dl>

<ul><a name="set_open_page">
set_open_page</a><pre>
void set_open_page(int i)
</pre></br>
Sets the currently open page.  This does all the magic needed to make
the book appear as if it is the currently opened page.  If the open
page is 0 then the book is closed.  If it is out of the upper
bound then the book is opened to the last page.
<br/><ul>
<li><b>Parameters:</b>
<br/>i - the page to open to
<li><b>See also:</b>
<br/><a href="#query_open_page">query_open_page()</a> and <a href="#query_current_page">query_current_page()
</a></dl>

<ul><a name="set_player">
set_player</a><pre>
void set_player(object player)
</pre></br>
This method is called by the auto loading process to set the current
player on this object.
<br/><ul>
<li><b>Parameters:</b>
<br/>player - the player to set
<li><b>See also:</b>
<br/><a href="#query_player">query_player()
</a></dl>

<ul><a name="tear_current_page_out">
tear_current_page_out</a><pre>
object tear_current_page_out(object dest)
</pre></br>
This method tears the current page out of the book and returns it
to us.  This object will be moved into the destination so that it is
no longer inside us.  If it cannot be moved of the page has already
been remove then the function will return 0.
<br/><ul>
<li><b>Parameters:</b>
<br/>dest - the destination to move the page to
<li><b>Returns:</b>
<br/>the torn out page, or 0 on failure

</dl>


<h2>Protected Functions</h2>
These are functions that only objects inheriting the class can access.<p>
<ul><a name="set_ignore_saved_pages">
set_ignore_saved_pages</a><pre>
void set_ignore_saved_pages(int saved)
</pre></br>
This method sets the current setting of the ignore saved
pages variable.  If this is true then
the pages form the players auto_load stuff will be ignored totaly
and only the page creates in setup would be
used.  This can only be called from an object
which inherits this one (hence the protected method).
<br/><ul>
<li><b>Parameters:</b>
<br/>saved - the new value of the saved attribute
<li><b>See also:</b>
<br/><a href="#query_ignore_saved_pages">query_ignore_saved_pages()
</a></dl>


[an error occurred while processing this directive]

