A
          / \      _              Play Now                         Nemesis on 
          | |     | |  _______   _        _   _______    _______   _    _______
          | |\    | | |   ____| |  \    /  | |   ____|  /   ____| | |  /   ____|
 /-------/-------------------------------------------------------------------,
O= Home <=XX|  About  News  Pics  Adventurers  Wizards  Download  Connect     >
 \-------\-------------------------------------------------------------------'
          | |   \   | |  |____  | |      | | |  |____   ___ \  \  | |  ___ \  \
          | |     \_| |_______| |_|      |_| |_______| |_______/  |_| |_______/
          \ /
           V  

Documentation Area

Document Path: /doc/room2/page11


<
                                  CHAPTER 1                                     
Properties:

   Properties are an essential part of the game. They are values stored in
   a room (and many other objects) that can be set and queried by a single
   interface. In Nemesis this interface are the two functions set_prop and
   query_prop. Each property has a name and a value. A property with value
   0 means that the property is not set.

   Let's take the property 'no fight' for example. You find a list of valid
   properties for rooms in /include/room_defines.h. There we see that the
   name of our property is P_NO_FIGHT. So the following settings are possible:

	set_prop(P_NO_FIGHT, 1);  // sets the property to the value 1 (on).
	set_prop(P_NO_FIGHT, 0);  // removes the property.
	set_prop(P_NO_FIGHT, "No fights here!\n"); // sets a message unlike
	                          // to the standard message to be displayed
	set_prop( ({              // sets the two properties.
	  P_NO_FIGHT, 1,
          P_NO_MAGIC, 1
	}) );
	query_prop();             // returns all properties.
	query_prop(P_NO_FIGHT);   // returns the value of 'no fight' property.

   You can change a property by setting it again. For example, weather and
   climate are realized using properties. An important use for properties,
   maps, is described on the next page.

   A list of properties can be found via 'man room/set_prop' or on page 29
   of this tutorial: https://nemesis.de/lpc/doc/room2/page29 .

   ALWAYS use the '#defines' like P_NO_FIGHT and P_NO_MAGIC.
   NEVER use the numeric values hidden in those '#defines' but '#include'
   the correct header files like <room_defines.h> or <properties.h> (in
   /include/properties.h) or others. By including <room2.h> the relevant
   header files are included automatically and all these #defines for
   properties are available.

   FYI: The set_weather call also stores its data in properties (see page
   6 or https://nemesis.de/lpc/doc/room2/page6 ).

   Changed/modified/modernised in August 2016.

See also:
>

This page was generated in LPC

Imprint / Impressum