This AI is still in early stages of development.
Process()
- Aubergine
Syntax
Note the capital "P" in the function name!
// Create an instance: Process(processName, priority, interval, autoActivate, autoDeactivate); // Retrieve existing instance: Process(processName);
Properties
The properties are as follows:
Property | Type | Mandatory | Notes | Pulse Version |
---|---|---|---|---|
processName | String | The name of a Process Instance to create or retrieve. If an instance with the name already exists, it will be returned. Otherwise, a new instance will be created. When creating new instances, a global function of the same name is created – if there's already something in the global scope with that name, an error will be thrown and the instance won't be created. | 0.1 | |
priority | Number | The priority of the process. Higher priority processes will get the most processing time. The bigger the number, the higher the priority. Defaults to Process.PRIORITY_DEFAULT. | ||
interval | Number | If a new instance is being created, this parameter defines the timer interval to use should its timer be activated. Defaults to Process.INTERVAL_DEFAULT if no value specified. Set to Process.INTERVAL_MIN if the stated interval is too small. The interval time will have a random offset between 1 and Process.INTERVAL_RAND added to it – this helps reduce collisions when processes are running in multiple player scripts. You can change the interval of existing instances using instance.setInterval(). | 0.1 | |
autoActivate | Boolean | If Defaults to | 0.1 | |
autoDeactivate | Boolean | If Defaults to It's recommended you use the default setting so that your script basically goes in to "sleep mode" if the player it's associated with is killed. This frees up processing time for other players, which is particularly important as the game progresses as increase droid and structure counts will require more time to process. | 0.1 |
Return Values
Value | Type | Notes | Pulse Version |
---|---|---|---|
<instance> | Process Instance | An instance was created or retrieved. | 0.1 |
<error> | Error | If you try creating an instance with a name that's already used by something (other than an existing process) on the global scope, an error will be thrown. This is because process triggers (functions of the name specified by "name" parameter listed earlier) are stored on the global scope so processes can be triggered by events, timers, etc. | 0.1 |
Examples
Process("myProcess");
Process("myProcess", 500, 1000, true, true);
// if we already made a process called "existingProcess"... Process("existingProcess") // returns the "existingProcess" instance Process("existingProcess").addTask(someTask).activate(); // add a task, then activate it Process("existingProcess").run(); // run "existingProcess" // A process can be run via it's global trigger function... existingProcess(); // run "existingProcess"
See also
Process macro-management:
- Process.destroy() — Deactivates and destroys (deletes) either a specific process or all processes.
- Process.deactivateAll() — Deactivates all active process instances.