Behavior field bug in 1.5?
by Justin Wright · in iTorque 2D · 07/29/2012 (7:01 pm) · 6 replies
I've been trying to add a behavior field with a default type. It won't work. I can add one with an int type, color type, or any other, but with default it makes the whole behavior crash. It won't even show up in the editor drop-down list.
%template.addBehaviorField(fieldName, "description of field", int); - works fine
%template.addBehaviorField(fieldName, "description of field", default); - doesn't work. crashes behavior
Is there a bug?
%template.addBehaviorField(fieldName, "description of field", int); - works fine
%template.addBehaviorField(fieldName, "description of field", default); - doesn't work. crashes behavior
Is there a bug?
#2
07/30/2012 (6:45 am)
Here is an example of how we are using it the default will be 5..%template.addBehaviorField( AmmoAmount, "Amount added to current Ammo", INT, 5 );
#3
Each behavior has a set of properties, or Fields, that can be utilized to give the developer a powerful way to make each use of the behavior slightly different.
default - Standard string field
int - A whole value number, such as 0, 1, 2, etc.
float - A floating point value, such as 2.5.
bool - A on/off toggle, in the form of a checkbox.
Point2F - Two text edits validated to a number with 3 digits of precision.
Enum - An enumeration drop-down list
Keybind - A drop-down list containing keyboard, mouse and joystick events (Windows and OS X only)
Motion - A drop-down list containing gyroscope and accelerometer events (iOS only)
Color - Text field validated to a whole number, representing 0 - 255 of a color scale
Polygon - A field containing values from the Polygon Editor
object - A drop-down list of objects in the scene, allowing the developer to choose a datablock or object that the code for this Behavior will make use of.
Above is from the official documentation for iTorque. I'm basically asking how to make a string value behavior field, instead of an integer.
07/31/2012 (7:53 pm)
Behavior FieldsEach behavior has a set of properties, or Fields, that can be utilized to give the developer a powerful way to make each use of the behavior slightly different.
default - Standard string field
int - A whole value number, such as 0, 1, 2, etc.
float - A floating point value, such as 2.5.
bool - A on/off toggle, in the form of a checkbox.
Point2F - Two text edits validated to a number with 3 digits of precision.
Enum - An enumeration drop-down list
Keybind - A drop-down list containing keyboard, mouse and joystick events (Windows and OS X only)
Motion - A drop-down list containing gyroscope and accelerometer events (iOS only)
Color - Text field validated to a whole number, representing 0 - 255 of a color scale
Polygon - A field containing values from the Polygon Editor
object - A drop-down list of objects in the scene, allowing the developer to choose a datablock or object that the code for this Behavior will make use of.
Above is from the official documentation for iTorque. I'm basically asking how to make a string value behavior field, instead of an integer.
#4
So technically it could be "default" instead of "STRING". The crucial part I guess is specifying an empty string as the 4th argument too.
08/01/2012 (4:27 am)
This works for me:%template.addBehaviorField(TargetLevel, "Name of teleport to link to", STRING, "");
So technically it could be "default" instead of "STRING". The crucial part I guess is specifying an empty string as the 4th argument too.
#5
ok the default string here if nothing is picked is Unlocked
Here is another example
The default if nothing is selected is Red
08/01/2012 (9:10 am)
%template.addBehaviorField(Lock, "Name of keygroup that unlocks this door, or unlocked if no key required.", ENUM, "Unlocked", "Unlocked" NL "Red" NL "Blue" NL "Yellow" NL "Green");
ok the default string here if nothing is picked is Unlocked
Here is another example
%template.addBehaviorField(KeyGroup, "Key group", ENUM, "Red", "Red" NL "Blue" NL "Yellow" NL "Green");
The default if nothing is selected is Red
#6
08/01/2012 (6:12 pm)
Thanks guys. Perfect.
Associate Andy Hawkins
DrewFX