Re: [問題] 程式發生問題。
看板mud_sanc (Sanctuary - 聖殿)作者laechan (小太保)時間18年前 (2007/12/05 10:47)推噓1(1推 0噓 0→)留言1則, 1人參與討論串2/4 (看更多)
※ 引述《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
推
12/05 12:27, , 1F
12/05 12:27, 1F
討論串 (同標題文章)
mud_sanc 近期熱門文章
PTT遊戲區 即時熱門文章
15
26