Advertisement
ZoriaRPG

New ZScript Language Docs

Dec 26th, 2016
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. //////////////////////////
  2. /// ZScript Language ///
  3. //////////////////////////
  4.  
  5. ZScript now supports function pointers, using the following syntax:
  6.  
  7. @ptr
  8.  
  9. /************************************************************************************************************/
  10.  
  11. ZScript now supports comment blocks, using the following syntax
  12.  
  13. /*
  14. COMMENT BLOCK
  15.  
  16. */
  17.  
  18. /************************************************************************************************************/
  19.  
  20. Arrays now support being declared with a formula:
  21.  
  22. int arr[10*4];
  23.  
  24. This is now the same as int arr[40];
  25.  
  26. /************************************************************************************************************/
  27.  
  28. Nesting array calls should now work properly. (e.g. arrA[ arrB[ arrC[ arrd[4] ] ] ] )
  29.  
  30. /************************************************************************************************************/
  31.  
  32. /////////////////
  33. /// Example ///
  34. ///////////////////////////////////////////////////////////////////////////////////////
  35.  
  36.  
  37. void test() {
  38. Trace(-99);
  39. }
  40.  
  41. void test(int x) {
  42. Trace(x);
  43. }
  44.  
  45.  
  46. ffc script test{
  47. void run(){
  48. int arr[8*2]; //Declares an array with a size of 16.
  49. /*
  50. You can now place declarations on a single line, by type.
  51. The following are all ints:
  52. */
  53. int a = 6, b = 40, c = @test;
  54.  
  55. /*
  56. @test uses the new function pointers.
  57. */
  58.  
  59. c(); //Because c was pointed at test(), it traces '-99'.
  60.  
  61. c = @test(int); //Now reassigned.
  62.  
  63. c( a+b ); //Traces '46'.
  64. arr[1] = c( a*b ); //Places the value '240' into index [1] of the array.
  65. }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement