Rayan Posted December 27, 2013 Group: Members Topic Count: 34 Topics Per Day: 0.01 Content Count: 188 Reputation: 16 Joined: 06/12/12 Last Seen: September 1, 2016 Share Posted December 27, 2013 As the per the subject....can somebody please explain me where to edit for making the server read new databse file Thanks in advance... Quote Link to comment Share on other sites More sharing options...
Patskie Posted December 28, 2013 Group: Members Topic Count: 50 Topics Per Day: 0.01 Content Count: 1702 Reputation: 241 Joined: 09/05/12 Last Seen: 15 hours ago Share Posted December 28, 2013 You can create a table? and use query_sql command to access that? or query_logsql? Quote Link to comment Share on other sites More sharing options...
Rayan Posted December 28, 2013 Group: Members Topic Count: 34 Topics Per Day: 0.01 Content Count: 188 Reputation: 16 Joined: 06/12/12 Last Seen: September 1, 2016 Author Share Posted December 28, 2013 You can create a table? and use query_sql command to access that? or query_logsql? actually, i want to make whole new database , lets say rathena_db.txt , so how could i make this file readable by server ? Quote Link to comment Share on other sites More sharing options...
Emistry Posted December 28, 2013 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2370 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share Posted December 28, 2013 sv_readdb( db_path, "rathena_db.txt" .............. ) but i not sure what parameter to put after the file name ... you can get alot of example for this inside the src folder. Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted December 28, 2013 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted December 28, 2013 http://www.eathena.ws/board/index.php?showtopic=256673 wow, I searched this for 30 minutes, luckily its still alive better backup this one script_readline.patch Quote Link to comment Share on other sites More sharing options...
Jonne Posted December 28, 2013 Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 153 Reputation: 33 Joined: 12/24/11 Last Seen: September 30, 2024 Share Posted December 28, 2013 Wow that is really old code by me. Check out Ai4rei's post to it, it mentions some other way which was working much more stable as far as I remember. Maybe somebody can rewrite it? Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted December 28, 2013 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted December 28, 2013 ripped from jathena #if !defined(NO_CSVDB) && !defined(NO_CSVDB_SCRIPT) static struct dbt* script_csvdb; int script_csvinit( void ) { script_csvdb = strdb_init(0); return 0; } static int script_csvfinal_sub( void *key, void *data, va_list ap ) { aFree(key); csvdb_close( data ); return 0; } int script_csvfinal( void ) { strdb_final( script_csvdb, script_csvfinal_sub ); return 0; } static struct csvdb_data* script_csvload( const char *file ) { struct csvdb_data *csv = strdb_search( script_csvdb, file); if( csv == NULL ) { // ƒtƒ@ƒCƒ‹–¼‚ɕςȂà‚Ì‚ª“ü‚Á‚Ä‚¢‚È‚¢‚©Šm”F int i; for(i = 0; file[i]; i++) { switch(file[i]) { case '.': if(file[i+1] != '.') break; // fall through case '<': case '>': case '|': printf("script_csvload: invalid file name %s\n", file); return NULL; } } csv = csvdb_open( file, 0 ); if( csv ) { printf("script_csvload: %s load successfully\n", file); strdb_insert( script_csvdb, aStrdup(file), csv ); } } return csv; } int buildin_csvgetrows(struct script_state *st) { char *file = conv_str(st,& (st->stack->stack_data[st->start+2])); struct csvdb_data *csv = script_csvload( file ); if( csv == NULL ) { push_val(st->stack,C_INT,-1); } else { push_val(st->stack,C_INT,csvdb_get_rows(csv)); } return 0; } int buildin_csvgetcols(struct script_state *st) { char *file = conv_str(st,& (st->stack->stack_data[st->start+2])); int row = conv_num(st,& (st->stack->stack_data[st->start+3])); struct csvdb_data *csv = script_csvload( file ); if( csv == NULL) { push_val(st->stack,C_INT,-1); } else { push_val(st->stack,C_INT,csvdb_get_columns(csv, row)); } return 0; } // csvread <file>, <row>, <cow> int buildin_csvread(struct script_state *st) { char *file = conv_str(st,& (st->stack->stack_data[st->start+2])); int row = conv_num(st,& (st->stack->stack_data[st->start+3])); int col = conv_num(st,& (st->stack->stack_data[st->start+4])); const char *v; struct csvdb_data *csv = script_csvload( file ); v = (csv ? csvdb_get_str(csv, row, col) : NULL); if( v ) { push_str(st->stack,C_STR,aStrdup(v)); } else { push_str(st->stack,C_CONSTSTR,""); } return 0; } // csvreadarray <file>, <row>, <array> int buildin_csvreadarray(struct script_state *st) { int i; struct map_session_data *sd = NULL; char *file = conv_str(st,& (st->stack->stack_data[st->start+2])); int row = conv_num(st,& (st->stack->stack_data[st->start+3])); int num = st->stack->stack_data[st->start+4].u.num; char *name = str_buf+str_data[num&0x00ffffff].str; char prefix = *name; char postfix = name[strlen(name)-1]; struct csvdb_data* csv = script_csvload( file ); // clear array if( prefix!='$' && prefix!='@' && prefix!='\'' ){ printf("buildin_csvreadarray: illeagal scope !\n"); return 0; } if( prefix!='$' && prefix != '\'') { sd=script_rid2sd(st); if( sd == NULL) return 0; } for(i = getarraysize(st,num,postfix,st->stack->stack_data[st->start+4].ref) - (num >> 24) - 1;i >= 0;i--) { if( postfix=='$' ) set_reg(st,sd,num+(i<<24),name,"",st->stack->stack_data[st->start+4].ref); else set_reg(st,sd,num+(i<<24),name,0,st->stack->stack_data[st->start+4].ref); } if( csv ) { int i, max = csvdb_get_columns( csv, row ); if( max + (num >> 24) > 127 ) { max = 127 - (num>>24); } for( i = 0; i < max; i++ ) { if( postfix == '$' ) { // set_reg‚Íconst‚ª•t‚¢‚ĂȂ¢‚Ì‚ÅAˆê’[strdup‚µ‚Ä‚¢‚é char *v = aStrdup(csvdb_get_str(csv, row, i)); set_reg(st,sd,num+(i<<24),name,v,st->stack->stack_data[st->start+4].ref); aFree(v); } else { set_reg(st,sd,num+(i<<24),name,(void*)csvdb_get_num(csv, row, i),st->stack->stack_data[st->start+4].ref); } } } return 0; } // csvfind <file>, <col>, <val> int buildin_csvfind(struct script_state *st) { char *file = conv_str(st,& (st->stack->stack_data[st->start+2])); int col = conv_num(st,& (st->stack->stack_data[st->start+3])); struct csvdb_data *csv = script_csvload( file ); if( !csv ) { push_val(st->stack,C_INT,-1); } else if( isstr(&st->stack->stack_data[st->start+4])) { char *str = conv_str(st,& (st->stack->stack_data[st->start+4])); push_val(st->stack,C_INT,csvdb_find_str(csv, col, str)); } else { int val = conv_num(st,& (st->stack->stack_data[st->start+4])); push_val(st->stack,C_INT,csvdb_find_num(csv, col, val)); } return 0; } // csvwrite <file>, <row>, <col>, <val> int buildin_csvwrite(struct script_state *st) { char *file = conv_str(st,& (st->stack->stack_data[st->start+2])); int row = conv_num(st,& (st->stack->stack_data[st->start+3])); int col = conv_num(st,& (st->stack->stack_data[st->start+4])); struct csvdb_data *csv; int i; // ƒtƒ@ƒCƒ‹–¼‚ª‘Ó–‚È‚à‚Ì‚©ƒ`ƒFƒbƒN‚·‚é for(i = 0; file[i]; i++) { if( !isalnum( (unsigned char)file[i] ) ) { printf("buildin_csvwrite: invalid file name %s\n", file); return 0; } } csv = script_csvload( file ); if( isstr(&st->stack->stack_data[st->start+5]) ) { char *str = conv_str(st,& (st->stack->stack_data[st->start+5])); csvdb_set_str( csv, row, col, str); } else { int val = conv_num(st,& (st->stack->stack_data[st->start+5])); csvdb_set_num( csv, row, col, val); } return 0; } // csvwritearray <file>, <row>, <array> int buildin_csvwritearray(struct script_state *st) { int i; char *file = conv_str(st,& (st->stack->stack_data[st->start+2])); int row = conv_num(st,& (st->stack->stack_data[st->start+3])); int num = st->stack->stack_data[st->start+4].u.num; char *name = str_buf+str_data[num&0x00ffffff].str; char prefix = *name; char postfix = name[strlen(name)-1]; struct csvdb_data* csv; if( prefix!='$' && prefix!='@' && prefix!='\'' ){ printf("buildin_csvwritearray: illeagal scope !\n"); return 0; } // ƒtƒ@ƒCƒ‹–¼‚ª‘Ó–‚È‚à‚Ì‚©ƒ`ƒFƒbƒN‚·‚é for(i = 0; file[i]; i++) { if( !isalnum( (unsigned char)file[i] ) ) { printf("buildin_csvwrite: invalid file name %s\n", file); return 0; } } csv = script_csvload( file ); if( csv ) { int max = getarraysize(st, num, postfix, st->stack->stack_data[st->start+4].ref) - (num >> 24); csvdb_clear_row( csv, row ); for( i = 0; i < max; i++ ) { if( postfix == '$' ) { csvdb_set_str(csv, row, i, get_val2(st, num+(i<<24),st->stack->stack_data[st->start+4].ref)); } else { csvdb_set_num(csv, row, i, (int)get_val2(st, num+(i<<24),st->stack->stack_data[st->start+4].ref)); } } } return 0; } static int script_csvreload_sub( void *key, void *data, va_list ap ) { char *file = va_arg(ap, char*); if( strcmp(key, file) == 0 ) { char *p = key; strdb_erase( script_csvdb, key ); aFree( p ); } return 0; } // csvreload <file> int buildin_csvreload(struct script_state *st) { char *file = conv_str(st,& (st->stack->stack_data[st->start+2])); struct csvdb_data *csv = strdb_search( script_csvdb, file ); if( csv ) { //strdb_insert( script_csvdb, file, NULL ); strdb_foreach( script_csvdb, script_csvreload_sub, file ); csvdb_close( csv ); } return 0; } // csvinsert <file>, <row> int buildin_csvinsert(struct script_state *st) { int i; char *file = conv_str(st,& (st->stack->stack_data[st->start+2])); int row = conv_num(st,& (st->stack->stack_data[st->start+3])); struct csvdb_data *csv; // ƒtƒ@ƒCƒ‹–¼‚ª‘Ó–‚È‚à‚Ì‚©ƒ`ƒFƒbƒN‚·‚é for(i = 0; file[i]; i++) { if( !isalnum( (unsigned char)file[i] ) ) { printf("buildin_csvinsert: invalid file name %s\n", file); return 0; } } csv = script_csvload( file ); if( csv ) { csvdb_insert_row(csv, row); } return 0; } // csvdelete <file>, <row> int buildin_csvdelete(struct script_state *st) { int i; char *file = conv_str(st,& (st->stack->stack_data[st->start+2])); int row = conv_num(st,& (st->stack->stack_data[st->start+3])); struct csvdb_data *csv; // ƒtƒ@ƒCƒ‹–¼‚ª‘Ó–‚È‚à‚Ì‚©ƒ`ƒFƒbƒN‚·‚é for(i = 0; file[i]; i++) { if( !isalnum( (unsigned char)file[i] ) ) { printf("buildin_csvdelete: invalid file name %s\n", file); return 0; } } csv = script_csvload( file ); if( csv ) { csvdb_delete_row(csv, row); } return 0; } // csvsort <file>, <col>, <order> int buildin_csvsort(struct script_state *st) { int i; char *file = conv_str(st,& (st->stack->stack_data[st->start+2])); int col = conv_num(st,& (st->stack->stack_data[st->start+3])); int order = conv_num(st,& (st->stack->stack_data[st->start+4])); struct csvdb_data *csv; // ƒtƒ@ƒCƒ‹–¼‚ª‘Ó–‚È‚à‚Ì‚©ƒ`ƒFƒbƒN‚·‚é for(i = 0; file[i]; i++) { if( !isalnum( (unsigned char)file[i] ) ) { printf("buildin_csvsort: invalid file name %s\n", file); return 0; } } csv = script_csvload( file ); if( csv ) { csvdb_sort(csv, col, order); } return 0; } // csvflush <file> int buildin_csvflush(struct script_state *st) { char *file = conv_str(st,& (st->stack->stack_data[st->start+2])); int i; struct csvdb_data *csv; // ƒtƒ@ƒCƒ‹–¼‚ª‘Ó–‚È‚à‚Ì‚©ƒ`ƒFƒbƒN‚·‚é for(i = 0; file[i]; i++) { if( !isalnum( (unsigned char)file[i] ) ) { printf("buildin_csvflush: invalid file name %s\n", file); return 0; } } csv = strdb_search( script_csvdb, file ); if( csv ) { csvdb_flush( csv ); } return 0; } #endif #if !defined(NO_CSVDB) && !defined(NO_CSVDB_SCRIPT) {buildin_csvgetrows,"csvgetrows","s"}, {buildin_csvgetcols,"csvgetcols","si"}, {buildin_csvread,"csvread","sii"}, {buildin_csvreadarray,"csvreadarray","sii"}, {buildin_csvfind,"csvfind","sii"}, {buildin_csvwrite,"csvwrite","siis"}, {buildin_csvwritearray,"csvwritearray","sii"}, {buildin_csvreload,"csvreload","s"}, {buildin_csvinsert,"csvinsert","si"}, {buildin_csvdelete,"csvdelete","si"}, {buildin_csvsort,"csvsort","sii"}, {buildin_csvflush,"csvflush","s"}, #endif... its a little bit ... greeks to me*gave up* Quote Link to comment Share on other sites More sharing options...
Lighta Posted December 28, 2013 Group: Members Topic Count: 16 Topics Per Day: 0.00 Content Count: 737 Reputation: 216 Joined: 11/29/11 Last Seen: December 20, 2020 Share Posted December 28, 2013 Checkout the comment and the code, well your's will work fine, the only thing Ai4rei mentionned is that you didn't have to open the file at each action cause that is slower. (summerized). You could very well mimic C behaviour and specifically open(file) and close(file) and retain a reference Imagine doing .@i = 0; do { .@line$ = readline("rathena_db.txt".@i); .@i++; } while(.@line$ != ""); This is line parsing each line of your db and reading it, (idk maybe to found an ID then read the rest of the line) So in real that will open and close the file at each loop incrementation wich is quite ugly.. Now the issue about retain the pointer and expect people to close the file is that looking more and more of doing C, sure you won't have thread issues yet. (Like 2 people talking to the NPC it's still 1 execution at the time (that what he was saying)) but they could very well forget to close it and/or try to reopen it with or timer and such so it's an issue. (sorry if I may sound to look down but a good % of people scripting ain't expert of file descriptor issues). I think a ok solution would be to retain the FH in a pointer but to limit is life to a scope {}. //he will auto close the file when he's leaving it (a bit like perl). But to begin I'm sure the think you have done is fine. You may want to add a split function tought In src what Emistry started to quote is : sv_readdb( db_path, "rathena_db.txt",char_delimiter$,min_col_number, max_col_number, max_line_number, &parse_function); parse_function(char* fields[], int columns, int current){ //fields data in each field //current is the line number //colunms is the number of col in that line } 1 Quote Link to comment Share on other sites More sharing options...
Jonne Posted December 28, 2013 Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 153 Reputation: 33 Joined: 12/24/11 Last Seen: September 30, 2024 Share Posted December 28, 2013 Checkout the comment and the code, well your's will work fine, the only thing Ai4rei mentionned is that you didn't have to open the file at each action cause that is slower. (summerized). You could very well mimic C behaviour and specifically open(file) and close(file) and retain a reference Imagine doing .@i = 0; do { .@line$ = readline("rathena_db.txt".@i); .@i++; } while(.@line$ != ""); This is line parsing each line of your db and reading it, (idk maybe to found an ID then read the rest of the line) So in real that will open and close the file at each loop incrementation wich is quite ugly.. Now the issue about retain the pointer and expect people to close the file is that looking more and more of doing C, sure you won't have thread issues yet. (Like 2 people talking to the NPC it's still 1 execution at the time (that what he was saying)) but they could very well forget to close it and/or try to reopen it with or timer and such so it's an issue. (sorry if I may sound to look down but a good % of people scripting ain't expert of file descriptor issues). I think a ok solution would be to retain the FH in a pointer but to limit is life to a scope {}. //he will auto close the file when he's leaving it (a bit like perl). But to begin I'm sure the think you have done is fine. You may want to add a split function tought In src what Emistry started to quote is : sv_readdb( db_path, "rathena_db.txt",char_delimiter$,min_col_number, max_col_number, max_line_number, &parse_function); parse_function(char* fields[], int columns, int current){ //fields data in each field //current is the line number //colunms is the number of col in that line } Ye it comes back to me. I didn't read through it again. Well if it still works you can try it out. Depending on what you are trying this might not be what you want. For example if you want access to the database in the src code? But otherwise this might work. Quote Link to comment Share on other sites More sharing options...
Lighta Posted December 28, 2013 Group: Members Topic Count: 16 Topics Per Day: 0.00 Content Count: 737 Reputation: 216 Joined: 11/29/11 Last Seen: December 20, 2020 Share Posted December 28, 2013 Well there ain't much database on the src code, or you mean the running data ? like charid_db etc ? What do you think about the jathena implementation, do you guys think we should implement it ? too difficult to use ? Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted December 28, 2013 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted December 28, 2013 (edited) What do you think about the jathena implementation, do you guys think we should implement it ? too difficult to use ?since ai4rei recommended, I don't see any reason to refusethe problem is, of course, I can't understand japanese =/ the \doc\ folder is totally in alien symbols =/ *csv アクセス命令 / 関数 csv とはカンマで区切られたテキストファイルのことで、表計算ソフトなどで 編集が行えます。それをスクリプト上から読み込むことで、pet_dbの情報を スクリプトで参照するなどの新しいことが出来るようになります。 詳しい使い方や実装例は、サンプル(npc_test_csv.txt)を参照してください。 一度読み込んだcsv はキャッシュされるので、ディスク上のデータを更新しても、 古いままのデータが戻ってくることがあります。必要に応じてcsvreload 命令を 使用することで、キャッシュを最新状態に更新できます。 注意:csv関数は(0,0) から始まる座標系を用います。1行1列の内容を所得する 構文は、csvread("filename", 0, 0)となりますので注意してください。 csvgetrows関数 csvgetrows(<file>) file csv ファイル名 指定されたcsv ファイルの行数を返す。 csvgetcols関数 csvgetcols(<file>, <row>) file csv ファイル名 指定されたcsv ファイルの<row>行の列数を返す。 csvread関数 csvread(<file>, <row>, <col>) file csv ファイル名 row 行数 col 列数 指定されたcsv ファイルの中の<row>行<col>列のデータを文字列として返す。 失敗時には、空文字を返す。 csvreadarray命令 csvreadarray <file>, <row>, <array>; file csv ファイル名 row 行数 array 配列 指定されたcsv ファイル中の<row>行目のデータを配列にコピーする。 配列名に要素を指定すれば、コピー始点が指定できる。 ただし、コピー先の配列はコピー前に全て消去される。 csvwrite命令 csvwrite <file>, <row>, <col>, <val>; file ファイル名 row 行数 col 列数 val 書き込む値 指定されたcsv ファイル中の<row>行<col>列にデータを書き込む。 ただし、セキュリティの面から書き込むファイル名には、[A-Za-z0-9]のみ が使用できる(ディレクトリや拡張子が含まれていると失敗する)。 csvwritearray命令 csvwritearray <file>, <row>, <array>; file ファイル名 row 行数 array 配列 指定されたcsv ファイル中の<row>行目のデータを配列の値に設定する。 ただし、コピー先の行はコピー前に全て消去され、セキュリティの面から 書き込むファイル名には、[A-Za-z0-9]のみが使用できる(ディレクトリや 拡張子が含まれていると失敗する)。 csvfind関数 csvfind(<file>, <col>, <val>) file ファイル名 col 列番号 val 検索する値 指定されたcsv ファイル中から、<col>列目に<val>がある最初の行番号を返す。 失敗時には、-1を返す。 csvreload命令 csvreload <file> file ファイル名 指定されたcsv ファイルのキャッシュをクリアする。csv がcsvwrite, csvwritearray, csvsort, csvinsert, csvdelete 命令によって変更 されていたら、変更内容をディスクに書き込む。 csvinsert命令 csvinsert <file>, <row> file ファイル名 row 行数 指定されたcsv ファイルの<row>行目に空行を挿入し、<row>行目を以降をずらす。 ただし、セキュリティの面から書き込むファイル名には、[A-Za-z0-9]のみが 使用できる(ディレクトリや拡張子が含まれていると失敗する)。 csvdelete命令 file ファイル名 row 行数 指定されたcsv ファイルの<row>行目の内容を消去し、残りの行を詰める。 ただし、セキュリティの面から書き込むファイル名には、[A-Za-z0-9]のみが 使用できる(ディレクトリや拡張子が含まれていると失敗する)。 csvsort命令 csvsort <file>, <col>, <order> file ファイル名 col 列 order 並び順(1:昇順 -1:降順) 指定されたcsv ファイルを<col>列の数値の<order>順によって並び替える。 ただし、セキュリティの面から書き込むファイル名には、[A-Za-z0-9]のみが 使用できる(ディレクトリや拡張子が含まれていると失敗する)。 csvflush命令 csvflush <file> file ファイル名 指定されたcsv ファイルが変更されていればその内容を書き出す。csv が変更 されていなければ、何もしない。 ただし、セキュリティの面から書き込むファイル名には、[A-Za-z0-9]のみが 使用できる(ディレクトリや拡張子が含まれていると失敗する)。google translate Japanese -> English * Csv access instruction / function By text of the comma-delimited file with the csv, etc. spreadsheet software I can change data . By reading from a script on it , the information of pet_db You will be able to new , such as referenced in the script . The detailed implementation and usage , please refer to the sample (npc_test_csv.txt). Csv that is read once is cached so when you refresh the data on the disk , Can cause data of out-of-date come back . Csvreload the instruction if necessary By that you want to use, and you can update to the latest state cache . I will use a coordinate system starting from ( 0,0) csv function : Note . I will income the contents of one row and one column Please note syntax , it will be ("filename", 0, 0) and csvread. csvgetrows function csvgetrows (<file>) file csv file name I return the number of rows in the specified csv file . csvgetcols function csvgetcols (<file>, <row>) file csv file name I return the number of columns in <row> line of the specified csv file . csvread function csvread (<file>, <row>, <col>) file csv file name row number of lines col number of columns And returns the data as a string of <row> line <col> columns in the csv file specified . On failure , I return an empty . csvreadarray instruction csvreadarray <file>, <row>, <array>; file csv file name row number of lines array array I want to copy the data in arrays of <row> th row of the csv file that you specify. If you specify an element to the array name , copy the starting point can be specified. However , the destination array is erased all before copying . csvwrite instruction csvwrite <file>, <row>, <col>, <val>; file file name row number of lines col number of columns The write value val I write data to <row> line <col> column of csv file that you specify. However , the file name to be written in terms of security , only [A-Za-z0-9] But ( it fails or extension directory is included ) that can be used . csvwritearray instruction csvwritearray <file>, <row>, <array>; file file name row number of lines array array I set the value of an array of data <row> th row of the csv file that you specify. However, the line of the copy destination will be erased before copying , in terms of security The file name to be written , can be used only [A-Za-z0-9] and Ya ( directory I fail extension is included ) . csvfind function csvfind (<file>, <col>, <val>) file file name col column number The value to search val From csv file during a given , I return the row number of the first there is <val> in column <col> . On failure , I will return -1 . csvreload instruction csvreload <file> file file name I clear the cache of the specified csv file . csv is csvwrite, Change csvwritearray, csvsort, csvinsert, by csvdelete instruction If you are , to write changes to disk . csvinsert instruction csvinsert <file>, <row> file file name row number of lines Insert a blank line <row> -th row of the specified csv file , to shift the subsequent <row> row. However , the file name to be written in terms of security , it is only [A-Za-z0-9] ( Fail or extension directory is included ) that can be used . csvdelete instruction file file name row number of lines Clear the contents of the <row> row of the specified csv file , and filled the rest of the rows . However , the file name to be written in terms of security , it is only [A-Za-z0-9] ( Fail or extension directory is included ) that can be used . csvsort instruction csvsort <file>, <col>, <order> file file name col column ( descending order : ascending -1 1) order sorted The rearrange <order> by order of the number of the column <col> the specified csv file . However , the file name to be written in terms of security , it is only [A-Za-z0-9] ( Fail or extension directory is included ) that can be used . csvflush instruction csvflush <file> file file name To write out the contents of the specified csv file , if it is changed . csv changes And if it is not , it is not nothing . However , the file name to be written in terms of security , it is only [A-Za-z0-9] ( Fail or extension directory is included ) that can be used .EDIT !!!!script\sample\npc_test_csv.txt // csv 関数 テストスクリプト prontera.gat,156,178,1 script ペット図鑑 112,{ function pet_info; set @file$, "db/pet_db.txt"; mes "ペット図鑑"; next; while(1) { switch( select("ID検索", "名前検索", "順番表示", "キャンセル") ) { case 1: // ID検索 input @pet_id; pet_info csvfind(@file$, 0, @pet_id); // IDは0列目 break; case 2: // 名前検索 input @pet_name$; pet_info csvfind(@file$, 2, @pet_name$); // 名前は2列目 break; case 3: // 順番表示 set @pet_line, 0; set @pet_count, csvgetrows( @file$ ); for( set @i, 0; @i < @pet_count; set @i, @i + 1) { // csvread 関数は文字列で帰ってくるので、一端値を // 数値変数に代入して数値化している set @pet_id, csvread( @file$, @i, 0 ); if( @pet_id == 0 ) continue; pet_info @i; } break; case 4: close; } } // pet_info( line_no ) : ペットの情報を表示する function pet_info { if( getarg(0) == -1 ) { mes "お探しのペットは存在しません。"; } else { csvreadarray @file$, getarg(0), @mobinfo$; set @pet_id, @mobinfo$; if( @pet_id == 0 ) { mes "お探しのペットは存在しません。"; } else { mes "ID " + @mobinfo$[0]; mes "Name " + @mobinfo$[2]; mes "捕獲アイテム " + getitemname(@mobinfo$[3]); mes "餌 " + getitemname(@mobinfo$[6]); } } next; } } Now I understand what this command use for !it is use to modify a \db\ file by npc script ! Edited December 28, 2013 by AnnieRuru Quote Link to comment Share on other sites More sharing options...
Jonne Posted December 28, 2013 Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 153 Reputation: 33 Joined: 12/24/11 Last Seen: September 30, 2024 Share Posted December 28, 2013 (edited) Well there ain't much database on the src code, or you mean the running data ? like charid_db etc ? What do you think about the jathena implementation, do you guys think we should implement it ? too difficult to use ? It doesn't feel like it's too hard to use. There might be some people actually using that, but wouldn't encouraging SQL be better? Well, I didn't look deep into the code, but it seems fine, so why not ask other devs and start a poll on it? Edit: For reference: Check the npc_test_csv.txt file in the jAthena folder. It's in sample. Edited December 28, 2013 by Jonne Quote Link to comment Share on other sites More sharing options...
Lighta Posted December 28, 2013 Group: Members Topic Count: 16 Topics Per Day: 0.00 Content Count: 737 Reputation: 216 Joined: 11/29/11 Last Seen: December 20, 2020 Share Posted December 28, 2013 There no much dev arround atm, beside this concern more scripter then coredev, It's still slower then the src option so unless you want to interact with npc the src option will be better. (altought the big advantage of script is the reloadscript) Quote Link to comment Share on other sites More sharing options...
Rayan Posted December 29, 2013 Group: Members Topic Count: 34 Topics Per Day: 0.01 Content Count: 188 Reputation: 16 Joined: 06/12/12 Last Seen: September 1, 2016 Author Share Posted December 29, 2013 Therefore, I can say that on a newbie level, making server read a db file would not be a kid's play Quote Link to comment Share on other sites More sharing options...
Question
Rayan
As the per the subject....can somebody please explain me where to edit for making the server read new databse file
Thanks in advance...
Link to comment
Share on other sites
13 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.