Copyright VirtualSim 2004-2020 - All rights reserved
Routine Properties
Routines are named functions that can be given quickly and easily to entities during design or runtime. They are used in Plans.
A routine is normally geolocalized (associated with a position on the map), like MoveTo.
Then, selecting an entity and giving the routine MoveTo with a position on the map will immediately triggers the MoveTo code and make the entity moves towards the position.
Routines are mostly user-defined although vsTASKER comes with built-in routines (refer to the Developer Guide for the list). There is no limitation in the number or complexity of a routine as long as the designer follows basic runtime coding rules, meaning that the routine does not capture too much processing time at each call to not slow down the simulation frame rate.
A routine can be replaced with a logic or a component model but offers a more convenient way to associate sequence of actions and terrain coordinates.
Refer to the Developer Guide and the Tutorial Manual to learn the built-in routines and how to create your own.
Routines are piece of C++ code and are saved into the database. If you write some general purpose routines, try to export them into Data/Shared/Routines directory for later use or add them into you favorite database template to always have them listed.
Import Export
Routines can be Imported or Exported one by one.
To import, just select one from the Data/Shared directory (or anywhere else).
To export, select one from the list, use the Export button, then give the routine a name.
Enter here the C++ code that will be called repetitively at the specified frequency, as soon as the Routine will be triggered.
Returning AGAIN insure that the piece of code will be called again at the next cycle (if cycle at selected)
Returning DONE will stop the Routine to run.
Have in mind that loops or complex computations at every cycle might impact the overall CPU performance. If you must parse a long list of data, think about cutting it into chunks (10 or 100) at each cycle to distribute the load on several cycle and not on time (to avoid CPU peak like regular beat with visible impact on visual for example).
Parameters
Define here variables used by the Routine.
If you want the user to change the value using the automatic interface generator, use//&&after the definition: