42434F4E | |
---|---|
Short name: | BCON |
Long name: | Behavior constant |
Constants are always useful when programming. SimAntics is no different. Rather than hard-coding numbers in your BHAVs when you are not exactly sure what the number needs to be yet, instead use a constant, then you only need to change the constant later, rather than finding all the places where the number is hard-coded. For example, if we look at the coffee cup object, it has a BCON file which details the amounts by which various motives change when you drink coffee.
Editing these constants is very easy, you simply select the line in the list and edit the number in the Hex or Dec entry boxes on the left. When using BCONs in a BHAV, it is refered to by the line number, e.g. Const 0x1003:0x02 in the example below. This is refering to a BCON with Instance value of 0x1003 and the line numbered 0x02 within it. Bear this in mind if you decide to reorder a pre-existing BCON resource - since all the BHAVs using it will then be refering to the wrong thing!! If you try to refer to a BCON resource that doesn't exist you will get the "Invalid constant" error.
The labels help hugely when looking at the use of constants in your BHAV code. See TRCN for how to create labels.