作者laechan (小太保)
看板mud_sanc
标题Re: [问题] 程式发生问题。
时间Wed Dec 5 10:47:46 2007
※ 引述《doall (狂人)》之铭言:
: 很久以前编写过一个判断自己的档名而创造出口的小code,但是到了sanc却不能使用
: 可以请小宝帮我看看问题出在哪里吗?
: #include <path.h>
: inherit ROOM;
: inherit __DIR__"auto_exits";
没记错的话,你要 inherit 的档案必须是 .c 档。
上面是 __DIR__"auto_exits", 建议改成 __DIR__+"auto_exits.c"
(当然前提是你同个目录内必须有那个档)
另外,这里要先宣告函数..
mapping set_exit(int x,int y,int x,string enter,string out);
: void create()
: {
: ::create();
: seteuid(getuid());
: mapping exit;
: exit = ([]);
: int *coor;
: string *other;
: other = ({"",""});//""内分别输入enter and out的档案位置,若无,请保持空白
: set("light",1);
: set("short",WHT+"西大道"+NOR);
: //------05--------10--------15--------20--------25----28--30 <--字数量
: 尺
: set("long",@LONG
: 银白雪花依然飘落,似乎终年不停。道旁顶了层白的银杏,随着
: 冷冽的风艰难的晃着头。在南北两方好似各有着一条青砖小道,因着
: 两旁高大的建筑显得相当狭小。
: LONG);
: //------------------------------------------------------------------------------
: coor = getcoordination();
getcoordination() 函数必须在 auto_exits.c 档里面有定义。
: exit = set_exit(coor[0],coor[1],coor[2]other[0],other[1]) + exit;
^^^^^^^^^^^^^^^
你上面怪怪的。
: set("exits",exit["exits"]);
: set("coordinate","("+coor[0]+","+coor[1]+","+coor[2]+")");
: reset();
: }
: int *getcoordination(){
: string name;
: int x,y,z;
: name = file_name();
: sscanf(name,"%d_%d_%d",x,y,z);
: return ({x,y,z});
: }
: string *mean_sit(int x,int y,int z){
: string n,s,e,w,u,d;
: n = x+"_"+(y+1)+"_"+z;
: s = x+"_"+(y-1)+"_"+z;
: e = (x+1)+"_"+y+"_"+z;
: w = (x-1)+"_"+y+"_"+z;
: u = x+"_"+y+"_"+(z+1);
: d = x+"_"+y+"_"+(z-1);
: return ({n,s,e,w,u,d});
: }
: mapping set_exit(int x,int y,int x,string enter,string out){
: mapping map = ([
: "exits":([ ]),
: ]);
: int i;
: string *temp;
: string *exit = ({"north","south","east","west","up","down"});
: temp = mean_sit(x,y,z);
mean_sit() 函数必须在 auto_exits.c 档里面有定义。
: for(i=0;i<6;i++){
: if(file_size(__DIR__+("%s",temp[i])+".c") >= 0){
: map["exits"] = ([ exit[i] :
: __DIR__+("%s",temp[i]), ]) + map["exits"];
: }
: }
: if(enter != "") map["exits"] = (["enter" : ("%s",enter),]) +
: map["exits"];
: if(out != "") map["exits"] = (["out" : ("%s",out),]) + map["exits"];
: return map;
: }
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 125.231.126.184
1F:推 doall:如果函数在前面就定义,不是不需要先宣告?? 12/05 12:27