| | |
Script problem help
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
Id like someone to take a look at this piece of code and tell me any errors to correct, ms-vc++ 6.0 says there are 3, but when I correct them it creates more errors (example being: going from 3 errors to 18 with one ';' going in)
Help appreciated.
Here is the code:
Help appreciated.
Here is the code:
C++ Syntax (Toggle Plain Text)
// --------------------- Database Management Library --------------------------------- // Do not modify this. function script func_searchdb { set $@array_size, getarraysize(getarg(0)); for(set $@db_count, 0; $@db_count < $@array_size; set $@db_count, $@db_count + 1){ if(getelementofarray(getarg(0), $@db_count) == getarg(1)) return $@db_count; } return -1; } function script func_addentry { if(getarraysize(getarg(0)) < 127) { if(getarg(0) != 0) set getelementofarray(getarg(0), getarraysize(getarg(0))), getarg(1); else set getarg(0), getarg(1); return 0; } return 1; } function script func_removeentry { set $@re_entry, callfunc("func_searchdb", getarg(0), getarg(1)); if($@re_entry != -1) deletearray getelementofarray(getarg(0),$@re_entry),1; return; } // --------------------------- Core Function ----------------------------------------- // Do not modify this. function script func_soundall { set $@rid_backup, playerattached(); for(set $@dbe_cnt2, 0; $@dbe_cnt2 < $@rid_dbe_num; set $@dbe_cnt2, $@dbe_cnt2+1) { set $@database_name$, getarg(0) + $@dbe_cnt2; set $@array_size, getarraysize(getd($@database_name$)); for(set $@sa_count, 0; $@sa_count < $@array_size; set $@sa_count, $@sa_count + 1){ if(attachrid(getelementofarray(getd($@database_name$), $@sa_count)) != 0) soundeffect getarg(1), 0; } } attachrid $@rid_backup; return; } // --------------------------- Database Handler -------------------------------------- // Modify according to your needs. - script database_handler -1,{ end; OnInit: // The base database name set $@rid_database_name$, "$@rid_database_"; // The maximum number of database to allocate // Adjust this to your needs, each database is capable of holding 127 players. set $@rid_dbe_num,; end; } // ------------------------ Login/Logout Events -------------------------------------- // Modify this depending on your server's configurations. // If event_type is set to label mode, be sure to modify the code below. - script PCLoginEvent -1,{ set $@dbe_cnt,; while(callfunc("func_addentry", getd($@rid_database_name$ + $@dbe_cnt), playerattached()) != 0) set $@dbe_cnt, $@dbe_cnt + 1; set soundall_database, $@dbe_cnt; end; } - script PCLogoutEvent -1,{ callfunc "func_removeentry", getd($@rid_database_name$ + soundall_database), playerattached(); end; } // -------------------------- Sample Script ----------------------------------------- // To use this library, call the function func_soundall // Syntax: // callfunc "func_soundall", <rid-array-variable>, <wav-file>; prontera.gat,180,200,4 Sampler 111,{ callfunc "func_soundall", $@rid_database_name$, "se_organ02"; end; }
•
•
•
•
Originally Posted by Mike182
'Script' is an external function being called.
Its just general errors it contains, thats what I need help identifying..
[edit]A closer look shows that the code you posted is neither C or C++, maybe pascal or some other language.
C++ Syntax (Toggle Plain Text)
$@db_count
The above is not a C or C++ variable construction.
It is for a group of source files which is why some things dont make sense.
The errors I'm getting are:
Just general errors it's found.
The errors I'm getting are:
C++ Syntax (Toggle Plain Text)
F:\Mike\eAAC Test Part I.cpp(4) : error C2146: syntax error : missing ';' before identifier 'script' F:\Mike\eAAC Test Part I.cpp(4) : error C2501: 'function' : missing storage-class or type specifiers F:\Mike\eAAC Test Part I.cpp(4) : fatal error C1004: unexpected end of file found
Just general errors it's found.
•
•
•
•
Originally Posted by Mike182
It is for a group of source files which is why some things dont make sense.
The errors I'm getting are:
C++ Syntax (Toggle Plain Text)
F:\Mike\eAAC Test Part I.cpp(4) : error C2146: syntax error : missing ';' before identifier 'script' F:\Mike\eAAC Test Part I.cpp(4) : error C2501: 'function' : missing storage-class or type specifiers F:\Mike\eAAC Test Part I.cpp(4) : fatal error C1004: unexpected end of file found
Just general errors it's found.
The file is a game script from RagnarokOnline, its a database management library.
Things like OnInit are commands from the games source, would it recognise it if I defined it?
EDIT:
Adding :
Removed 2 of the 3 errors, last error is:
How can I fix this?
Things like OnInit are commands from the games source, would it recognise it if I defined it?
EDIT:
Adding :
C++ Syntax (Toggle Plain Text)
#define function #define script #ifndef function #ifndef script
Removed 2 of the 3 errors, last error is:
C++ Syntax (Toggle Plain Text)
Part I.cpp(95) : fatal error C1004: unexpected end of file found
How can I fix this?
the source was not written in either c or c++, maybe in basic of java. you will have to do a complete rewrite (port) if you want to use a c or c++ compiler. And the answer to your question is No -- simply declaring the function will not fix the errors.
[edit]
>>How can I fix this?
put at the very top of the program
or remove precompiled header requireents.
[edit]
>>How can I fix this?
put at the very top of the program
C++ Syntax (Toggle Plain Text)
#include "stdafx.h" .. // rest of code here
or remove precompiled header requireents.
![]() |
Similar Threads
- embedding java script in php (PHP)
- simple ajax script problem (JavaScript / DHTML / AJAX)
- Hi, I need soem help on a guestbook script (Community Introductions)
Other Threads in the C++ Forum
- Previous Thread: Print Max Prime Number???
- Next Thread: assignment operator for a 3d array
| Thread Tools | Search this Thread |
api array arrays based binary c++ c/c++ calculator char char* class classes code coding compile console conversion convert count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






