Script problem help

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2005
Posts: 34
Reputation: Mike182 is an unknown quantity at this point 
Solved Threads: 0
Mike182's Avatar
Mike182 Mike182 is offline Offline
Light Poster

Script problem help

 
0
  #1
Feb 27th, 2006
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:

  1. // --------------------- Database Management Library ---------------------------------
  2. // Do not modify this.
  3.  
  4. function script func_searchdb {
  5. set $@array_size, getarraysize(getarg(0));
  6. for(set $@db_count, 0; $@db_count < $@array_size; set $@db_count, $@db_count + 1){
  7. if(getelementofarray(getarg(0), $@db_count) == getarg(1))
  8. return $@db_count;
  9. }
  10. return -1;
  11. }
  12.  
  13. function script func_addentry {
  14. if(getarraysize(getarg(0)) < 127) {
  15. if(getarg(0) != 0)
  16. set getelementofarray(getarg(0), getarraysize(getarg(0))), getarg(1);
  17. else
  18. set getarg(0), getarg(1);
  19. return 0;
  20. }
  21. return 1;
  22. }
  23.  
  24. function script func_removeentry {
  25. set $@re_entry, callfunc("func_searchdb", getarg(0), getarg(1));
  26. if($@re_entry != -1)
  27. deletearray getelementofarray(getarg(0),$@re_entry),1;
  28. return;
  29. }
  30.  
  31. // --------------------------- Core Function -----------------------------------------
  32. // Do not modify this.
  33.  
  34. function script func_soundall {
  35. set $@rid_backup, playerattached();
  36. for(set $@dbe_cnt2, 0; $@dbe_cnt2 < $@rid_dbe_num; set $@dbe_cnt2, $@dbe_cnt2+1) {
  37. set $@database_name$, getarg(0) + $@dbe_cnt2;
  38. set $@array_size, getarraysize(getd($@database_name$));
  39. for(set $@sa_count, 0; $@sa_count < $@array_size; set $@sa_count, $@sa_count + 1){
  40. if(attachrid(getelementofarray(getd($@database_name$), $@sa_count)) != 0)
  41. soundeffect getarg(1), 0;
  42. }
  43. }
  44. attachrid $@rid_backup;
  45. return;
  46. }
  47.  
  48. // --------------------------- Database Handler --------------------------------------
  49. // Modify according to your needs.
  50. - script database_handler -1,{
  51. end;
  52.  
  53. OnInit:
  54. // The base database name
  55. set $@rid_database_name$, "$@rid_database_";
  56. // The maximum number of database to allocate
  57. // Adjust this to your needs, each database is capable of holding 127 players.
  58. set $@rid_dbe_num,;
  59. end;
  60.  
  61. }
  62.  
  63. // ------------------------ Login/Logout Events --------------------------------------
  64. // Modify this depending on your server's configurations.
  65. // If event_type is set to label mode, be sure to modify the code below.
  66.  
  67. - script PCLoginEvent -1,{
  68. set $@dbe_cnt,;
  69. while(callfunc("func_addentry", getd($@rid_database_name$ + $@dbe_cnt), playerattached()) != 0)
  70. set $@dbe_cnt, $@dbe_cnt + 1;
  71. set soundall_database, $@dbe_cnt;
  72. end;
  73. }
  74.  
  75. - script PCLogoutEvent -1,{
  76. callfunc "func_removeentry", getd($@rid_database_name$ + soundall_database), playerattached();
  77. end;
  78. }
  79.  
  80. // -------------------------- Sample Script -----------------------------------------
  81. // To use this library, call the function func_soundall
  82. // Syntax:
  83. // callfunc "func_soundall", <rid-array-variable>, <wav-file>;
  84.  
  85. prontera.gat,180,200,4 Sampler 111,{
  86. callfunc "func_soundall", $@rid_database_name$, "se_organ02";
  87. end;
  88. }
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,412
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1469
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Script problem help

 
0
  #2
Feb 27th, 2006
there is no such thing (keywords) as function script in either c or c++. maybe in managed c++ (I don't know managed c++), but VC++ 6.0 compiler doesn't know how to compile managed code.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 34
Reputation: Mike182 is an unknown quantity at this point 
Solved Threads: 0
Mike182's Avatar
Mike182 Mike182 is offline Offline
Light Poster

Re: Script problem help

 
0
  #3
Feb 27th, 2006
'Script' is an external function being called.
Its just general errors it contains, thats what I need help identifying..
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,412
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1469
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Script problem help

 
0
  #4
Feb 27th, 2006
Originally Posted by Mike182
'Script' is an external function being called.
Its just general errors it contains, thats what I need help identifying..
not according to the code you posted -- its just so much garbage.

[edit]A closer look shows that the code you posted is neither C or C++, maybe pascal or some other language.
  1. $@db_count

The above is not a C or C++ variable construction.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 34
Reputation: Mike182 is an unknown quantity at this point 
Solved Threads: 0
Mike182's Avatar
Mike182 Mike182 is offline Offline
Light Poster

Re: Script problem help

 
0
  #5
Feb 27th, 2006
It is for a group of source files which is why some things dont make sense.
The errors I'm getting are:

  1. F:\Mike\eAAC Test Part I.cpp(4) : error C2146: syntax error : missing ';' before identifier 'script'
  2. F:\Mike\eAAC Test Part I.cpp(4) : error C2501: 'function' : missing storage-class or type specifiers
  3. F:\Mike\eAAC Test Part I.cpp(4) : fatal error C1004: unexpected end of file found

Just general errors it's found.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,412
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1469
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Script problem help

 
0
  #6
Feb 27th, 2006
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:

  1. F:\Mike\eAAC Test Part I.cpp(4) : error C2146: syntax error : missing ';' before identifier 'script'
  2. F:\Mike\eAAC Test Part I.cpp(4) : error C2501: 'function' : missing storage-class or type specifiers
  3. F:\Mike\eAAC Test Part I.cpp(4) : fatal error C1004: unexpected end of file found

Just general errors it's found.
Yup ! just as I already told you, the compiler has no clude what function keyword is. It ain't c or c++.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 34
Reputation: Mike182 is an unknown quantity at this point 
Solved Threads: 0
Mike182's Avatar
Mike182 Mike182 is offline Offline
Light Poster

Re: Script problem help

 
0
  #7
Feb 27th, 2006
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 :
  1. #define function
  2. #define script
  3. #ifndef function
  4. #ifndef script

Removed 2 of the 3 errors, last error is:

  1. Part I.cpp(95) : fatal error C1004: unexpected end of file found

How can I fix this?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,412
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1469
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Script problem help

 
0
  #8
Feb 27th, 2006
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
  1. #include "stdafx.h"
  2. .. // rest of code here

or remove precompiled header requireents.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 34
Reputation: Mike182 is an unknown quantity at this point 
Solved Threads: 0
Mike182's Avatar
Mike182 Mike182 is offline Offline
Light Poster

Re: Script problem help

 
0
  #9
Feb 27th, 2006
Including that stdafix.h didnt fix it.. How do I remove the precompiled header requirements?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,412
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1469
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Script problem help

 
0
  #10
Feb 27th, 2006
menu Project --> Settings, select the c++ tab, select Category of Precompiled Headers then select the radio button Not using precompiled headers
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC