Today is released version 0.4.3 with some fixes and some new features for the Dice Roll Engine, let’s see them:
version 0.4.3
- Changed the dice field parser function to allow “{…{field}}” references.
- Dice roll property not available in fields after load older projects. Fixed.
- Added Encoding property to Scripts.
- Added Additional Data property to Dice Roll structure.
- Added Allow drag & drop property to Dice Roll structure.
- Added Drag & Drop support in the Dice Roll Engine.
Scripts new Encoding property is necessary when you create script files with special characters, since FG Classic and FC Unity uses different default encondings (iso-8859-1 for Classic and UTF-8 for Unity), and the lua files don’t have a tag to tell FG client the encoding used. So you have to set the encoding corresponding to the FG version to be used.
Additional Data property in Dice roll structure allows you to include any pair of key-values to the roll, so that those values can be retrieved in the roll handling function as part of the rRoll variable. This property allows field reference {} as well. I’ll provide a video tutorial about this.
New Drag & Drop feature
The Allow drag & drop property in Dice roll structure adds a new layer of automation to the field’s roll capabilities. If it is set to true the field can be dragged to perform the dice roll. It can be used in any control that has the Dice roll property.
Handling the result of dropping the dice on an object must be done by yourself, however, in the onDrop event of the target object. I’ll provide an example of this too.
Changes from version 0.4.2
In this version Roll Type property has been deprecated, its use is now optional, and serves only to identify the roll in case we build a common handler for several types of rolls, or need to identify the type of roll for some reason.
Its main role has been transfered to the Result handler function name property. If you set it to any value, the engine will register a new dice roll handler, and it will call the indicated function when the roll processing is finished.