ACE Script Reference

ACE stands for Asynchronous Command Execution. It is a mini script system that provides a way to automate the execution of a series of actions on an object without having to handle timing and synchronization by yourself.
Commands can be executed in parallel or sequential mode, ACE works both on items and UI elements.

[toc]

Language Overview


Although reserved for very simple tasks such as UI elements transition or global UI fading the ACE language supports a few advanced constructions.

  • Loop: Mark the loop start of the code by using the "loop" command, use the "next" command to loop to it. Note: ACE does not support nested loops or loop counter.
  • Parrallel execution: Commands separated by a semicolon (;) will be executed in sequence. Commands separated by a plus (+) will be parallelized.
  • Nop: Execution can be delayed with the Nop command.

                          
  1. // Moves my_item back and forth, endlessly.
  2. ItemSetCommandList(my_item, "loop; toposition 2.0,0,0,5; toposition 2.0,0,0,-5; next;")
  3.  
  4. // Set position and transparency of my_item to an initial value,
  5. // then move my_item and simultaneously change its transparency.
  6. ItemSetCommandList(my_item, "toalpha 0.0,0.0+toposition 0,0,0,0; toalpha 1.0,1.0+toposition 1.0,0,1,0;")
  7.  
  8. // Moves my_item, wait for 1 second, then move it again.
  9. ItemSetCommandList(my_item, "toposition 0.5,5,0,0; nop 1.0; toposition 0.5,5,5,0;")

                        


Controlling the execution state of a command list.

At any moment, the execution state of a command list can be queried and modified.


                          
  1. if (ItemIsCommandListDone(my_item))
  2. print("No command list running for item 'my_item'")
  3.  
  4. // Resets any running command list for my_item.
  5. ItemResetCommandList(my_item)

                        


Item Command Reference


  • toposition(duration, x, y, z): Translates the item to a given position, in a given time. The translation is absolute.
  • offsetposition(duration, x, y, z): Offsets the item relatively to its previous position, in a given time.
  • tooffset(duration, x, y, z): Changes offset position of the item to a given position, in a given time. The translation is absolute.
  • toscale(duration, x, y, z): Scales the item to a given factor, in a given time. The scale is absolute.
  • torotation(duration, x, y, z): Rotates the item to a given angle, in a given time. Angles are expressed in degrees. The rotation is absolute.
  • toalpha(duration, opacity): Changes the global transparency to a given value, in a given time. Transparency range is [0.0, 1.0]. The transparency modification is absolute.

Scene 2D Command Reference


  • globalfade(duration, opacity): Set the global fade effect opacity.