  :  ES ʦ



 ES ʦ[1] 

    ƪ˵Ϊεʦд, Ҽƪ˵ļ
ʦѾ help new_wiz е, ʦרеָ clone,
update, cd, ls, cp... ؼʹ, οʼдԼ
еãȻ, ֪½ʦ

[ڿʼ֮ǰ]
    ǴԿһ LP MUD , Ĺɷʽ
һ (object) , ÿһӦĳʽ
ԡǿԽдһγʽһȫµ, 
 update ĳʽ,  clone  ʵһ
õ
    , иʽ, ǿԽ֮Ϊ: 
 (ROOM), Ʒ (OBJECT),  (LIVING) Ĺ
, ϰ߽ĵֱӰĿ¼, Ʒ
Ϊ monster  obj (Ҳϲ object  item
Ϊ, ϰߡ) Ŀ¼С
    ҽֱ˵ʵ򡡵֮
ǰһҸ: ÿ #include һԶ .h
, Ȼ .h һЩ #define 嵵ľĿ¼


#define EGA="/u/e/ega/"
#define MOB="/u/e/ega/monster/"

һҪõǹﵵʱ,  EGA"chat_room"
 MOB"troll" ʽʾ˿ٴ, 
ҪҰᵽĳĿ¼ʱ൱ı

[]

    һض̳ ROOM (inherit ROOM), 
<mudlib.h>б #define õһ, ʾһرĵ, 
еķ䶼̳. ӵ춷һԡ

    һǳҪĺʽ: create(), init(),  refresh()
ĳЩضʱϵͳ, ҿид
, Դǧ򻯵Ч

[create ]

 create() ǷһʱضҪеһ, ͨ
Ƕһ趨ֵĶһ, ǿ
 create() һѵ set("something", somevalue);
Щ set ڴ˲, Լ,  Ҳʽ
ʦ
    ʱķ䲢ֱӼ̳ ROOMǼ̳һм̳ ROOM 
ر𷿼, ̵ǹ᷿ʲġʱд create()
Ḳǵԭȼ̳ķе create() , ²
Ķʱ create() м ::create();  
ָ, ʾҪȥִԭȼ̳Ǹ ROOM е create() 

    д refresh() ,  create()  
һ refresh(); Ǹ⡡

[init ]

    init() еʱ (Ｐ)  
ʱʱиõĺ this_player()  ᴫ߽
, ǹthis_player() ĸ̸, ֻҪס
ÿ߽ʱᱻһξͿˡ

     init() ĵĺĪ add_action("function", "action");
ˡڽһָ (ע, ϵͳָֻ
ĵһ), ´ָʱȥ "function"  
Ƶĺ, д init():

init() {
        add_action("do_climb", "climb");
}

߽ʱ, ϵͳ climb ָ´
 climb tree ָʱ, ϵͳȥѰ do_climb() , 
ִСͬʱ, ϵͳὫ "climb"  ָ
ִͱ do_climb() Խ do_climb 
Ϊ int do_climb(string s) һ, ´ climb
tree,  climb the red wall ָʱ, "tree"  "the red
wall" ͻᱻִ s ֮й㴦
     add_action() ĺضҪһͱĺ, ?
ΪϵͳĴֵȡͬĶ㴫ص 0,
ϵͳ϶޹, Ҳ climb
ĺһһȥִ, ֱе climb  0
ʱ, ϵͳᵱָϷ, һѶϢ(what?) ҡ
    ĺֵΪ 1, ʾָѾдĺ
, ϵͳٳѰ climb ָ
    ĺʽ⵽ʱ (Ҫ climb
 tree, ȴһЩָ climb three ֮) 
һЩرĴѶϢʱ,  notify_fail(string errormsg)
дѶϢ,  notify_fail("climb what?\n");   notify_fail()
Ҳ int ͱ, ̶ᴫ 0, õд:

if ()
    return notify_fail(ѶϢ);
if (һ)
    return notify_fail(һѶϢ);
.............................

<пܵ´붼˹>
ʼɻĲ....
return 1;

[ Ʒ]

    ҪƷ, ȱ inherit OBJECT;ʱ
inherit ROOM һOBJECT Ʒ, ҪĶ
ߡͼ,  inherit WEAPON, ARMOR, MAP ȵȲܻ
Ʒӵеԡעһ, еϵͳ
ЩС,  inherit WEAPON ʱ,  inherit
OBJECT , ɴͬʱ, 㲻ͬʱ̳ WEAPON,
ּ̳ ARMOR, Ҳɴ, ɸĴͬ
    ƷҪֻ create()  init(),  ROOM  еͬ
ͬ

[create() ]

    Ҫд create() , õķֳɵͬƷ޸ġ
ΪͬƷ set ͬ, Լ, 
۸񡡹()()ʹ()ȵȡѼ
, Ȱһ޸ġ

[init() ]
     ROOM е init , Ǳеʱ, 
еļ:
1. Ʒڷ, һ߽
2. һƷͻȻĳڵķС
3. һƷͻȻĳҵƷС
Ʒ init ໹д add_action , Щ action 
ЧĳϹܼ, :

     l  i ָõƷʱ?
ͬһ˻ϵĶʱ, װڴӵĶ㡡
Ҫעһ¡

[]

    򵥵Ĺܺ,  init д, ֻҪд create(),  Ψ
һ̫, Ҫһһû൱ʱС

    ӶĹҪ൱ļ, ˽Щ
дáһĳ̶ʱ, Ҹοο
á
   Ҫ inherit MONSTER; Ҳû refresh() 

[ʽĸ]

    ˽,  LPC Ҫһ(object) 
κζʱ, Ҫǵһ object , Ȼ
׵´LPC ﷨Ͻ, ЩΪʡ¿Խ
ĸʡԵ,  create() 
set(), ʵϽдӦΪ this_object()->set()write() 
Ϊ this_player()->write()
    ˵ֻΪǿһ: ץһƷ object 
һ¡

[this_object()  this_player()]
    ϵͳṩĺ, Ҳõ
дһ (䡡Ʒ...etc.)ʱ, this_object() ʾԼ

    this_player() Ƚϸ, ᴫһͱ
 init оǴ init Ǹҡthis_player() 
һֱݸб init еĺ,  add_action 
ĺ, Щ, this_player() Ǳʾ
Ǹˡ

[present() ]

    , ֻ֪һ, ȴø object ͱı
ָ object present(string "id",object env) ڴʱ
ó, Ҫҵ, ڵ (ĳ
ĳ), ͻᴫҵ
    򵥵, present ʵһҳĳֵ
ƷĺͬƷĺõһ, ĺ
find_player(), find_living() ȵȡ

[environment(), first_inventory(), next_inventory(), all_inventory()]

    һ麯ڵλйء environment(object ob)
 ob ڵĵص,  ob Ǹһ, 
ᴫ ob ڵķ;  ob ǸƷ, ᴫصľЯ
 ob ,  ob ڵķ (ûκ˴)
    first_inventory(object ob)  ص ob еĵһ,
 ob Ƿ, 򴫻صһƷ,  ob , 
ĵһƷ
    next_inventory(object ob) ͨ first_inventory()  һ
ʹáĹǴ ob һƷ, ͬһ environment С
    all_inventory(object ob)  first_inventory(),  
صǰƷһС
