Q: What is the entry point of a ZScript? How do I pass parameters in?

All scripts must implement a method called "run" which return void. This is the script's entry point, and is called automatically when a script it to be executed.

The run method can have any type signature. When assigning a script to an item or FFC in ZQuest, you have the option of specifying starting values for D0, D1, etc; these starting values are passed into any parameters of run(), in order. For instance, in the snippet
Code:
ffc script foo {
   void run(int a) {}
}
a will be set to the intial value specified for D0 when run is called. If you have more parameters, as in, say
Code:
ffc script foo {
   void run(int a, int b, int c) {}
}
then a, b, c will be set to the initial values of D0, D1, and D2, respectively.

The type signature of run() can be ANYTHING, so it is possible to pass in non-integer types like bool or even item and ffc. However, declaring a run() with non-simple parameter types is highly unsafe and discouraged.