vsTASKER 7 User Manual
×
Menu
Index

Code

 
Each entity can hold its own code that will be called after the Class code (it inherits). This allows specialization.
For example, the Class code can setup general parameters in built-in components and the entity code will tune them according to specific user code.
Two entities from the same Class will then share some same code but hold their own Initialization, Runtime and Display parts.
 
Code
1

Initialization

1. Initialization
This part of the code is called after the Class initialization code.
Put here what is specific to the instance entity.
Refer to the Developer Guide for more details on system phases/events.
2

Runtime

2. Runtime
The Runtime part is called at every cycle. The code inside must be thought as from inside the simulation engine.
Put here whatever code you like, although it might be wiser to use either a Component or a Logic.
Do not put here any drawing function; use the Display part for this.
This part is called at the RTC frequency specified in Database (Runtime) but is not called in Freeze mode.
The entity implementation code is a function that must return a value:
 
  • AGAIN: the entity is called again at next cycle.
  • DONE: the entity finishes normally. All Logics and Knowledge are terminated. Entity is dormant.
  • EXIT: the entity finishes normally and is removed from the scenario.      
The user can put whatever C/C++ code he wants there. This code can access all vsTASKER API, all included third party APIs and all user designed scenario and model data of the current database. The Runtime code comes from the first product versions and is mostly kept for compatibility.
3

Display

3. Display
The Display part is called at every cycle (except for the Console viewer).
It is called from inside the drawing loop (OpenGL, OSG, VegaPrime, Delta3D...) so, direct call to the third party graphic engine is allowed.
 
4

Code

4. Code
Write here your own code.