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

Nemesis bulletin boards: LPC bulletin board, note 13

Re: Use of this_player()->more(...) (Kiri, May 22 2016, 62)
The problem is which object tries to read (or write) a file:

An object of your domain (or your players/<wizname>/) has full access
(read & write) to all files in your domain (or your /players/<wizname>).
The controlling system for file access assumes that you know where your
objects read or write files. In this case the standard access controls
are used and it gives the requested access. The corresponding master
object (d/<domain>/master or players/<wizname>/master) is NOT asked!

Important exception to this behaviour: monsters and other (semi) living
objects especially when they are acting (= this_player())! "Monsters have
no valid_read() or valid_write()", is what I always say ;-) But it is not
that easy! It's a security issue: (semi) livings could be coded to fake a
player/wizard to get more access than the creating wizard. For this reason
it is blocked!

And now, Teddy, concerning your question:
Via "this_player()->more(filename)" the player is the object that wants  
access! It's no longer the object you coded! Now the obj/player#xyz wants 
read access! And this object does not reside in your /d/<domain>/ or your
/players/<wizname>/ ;-) Now the access is controlled via the corresponding
master object. Your job to give access there :-)

And finally: living objects vs. semi living objects:
- A monster is a fully living object: it is enabled to use commands (see
  'man efun/enable_commands') and it has got a living name (see
  'man efun/set_living_name'). Both is done by obj/monster! No need to do
  it yourself!
- If no living name is set but it has enable_commands(), I call this object
  semi living. This is needed to use catch_tell (see 'man living/catch_tell').

You can distinguish these semi livings from real livings via the efun living
(see 'man efun/living'): real livings return their living name (a string)
but semi livings return int 1. With stringp (see 'man efun/stringp') you
get the difference :-) This is interesting to avoid players attacking mirrors
and other non-monsters ;-)

*wave*
  Kiri

PS: Perhaps we have another solution for the "more" problem soon ...

Here you can discuss LPC issues like how to code this and that,
who has coded something like this or how that works etc.
As there are no real "secrets" on this board it is now
available via https://nemesis.de/lpc/board/10/ , too.
The board contains 23 notes:
  1. forcing and removing files (Shadowfax, Jul 29 1993, 29)
  2. Re: Has someone coded chairs already? (Ping, Oct 23 1993, 30)
  3. How does under_water work? (Jhudsui, Oct 28 1993, 28)
  4. Request for "query_action()" in living.c (Kilroy, Oct 29 1993, 25)
  5. /obj/chest.c (Quicksilver, Nov 11 1993, 24)
  6. Amulet of Blinding ? (Mambres, Nov 11 1993, 22)
  7. Re: Amulet of Blinding ? (Poe, Nov 20 1993, 48)
  8. P_DESTRUCT_WHEN_SOLD (Mambres, Dec 4 1993, 22)
  9. set_items(({ "sky"... (Mambres, Jan 12 1994, 24)
  10. Howto add default items to a standard shop? (Berny, Dec 23 2001, 30)
  11. Use of this_player()->more(...) (Teddy, May 11 2002, 29)
  12. Re: Howto add default items to a standard shop? (Teddy, May 13 2002, 29)
  13. Re: Use of this_player()->more(...) (Kiri, May 22 2016, 62)
  14. Re: missing string efuns... (Kiri, Aug 15 2016, 62)
  15. Re: Request for "query_action()" in living.c (Kiri, Aug 15 2016, 62)
  16. Re: How does under_water work? (Kiri, Aug 15 2016, 62)
  17. Re: /obj/chest.c (Kiri, Aug 15 2016, 62)
  18. Re: Has someone coded chairs already? (Kiri, Aug 15 2016, 62)
  19. Re: P_DESTRUCT_WHEN_SOLD (Kiri, Aug 16 2016, 62)
  20. Re: forcing and removing files (Kiri, Aug 17 2016, 62)
  21. New support for feelings with monsters (Teddy, Jan 28 2017, 50)
  22. Re: set_items(({ "sky"... (Kiri, Nov 17 2017, 62)
  23. P_AREA property (Teddy, Nov 26 2017, 50)

This page was generated in LPC

Imprint / Impressum