Difference between revisions of "BCON"
MogHughson (Talk | contribs) |
|||
(2 intermediate revisions by one user not shown) | |||
Line 7: | Line 7: | ||
Constants are always useful when programming. [[SimAntics]] is no different. Rather than hard-coding numbers in your [[BHAV]]s 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. | Constants are always useful when programming. [[SimAntics]] is no different. Rather than hard-coding numbers in your [[BHAV]]s 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. | ||
− | [[Image:BCONinSimPE.JPG|frame|Constants used to help in tuning behaviours]] | + | [[Image:BCONinSimPE.JPG|frame|left|Constants used to help in tuning behaviours]] |
<br clear="all"/> | <br clear="all"/> | ||
− | 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 [[SimPE_Resource_Editing#Instance|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!! | + | 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 [[SimPE_Resource_Editing#Instance|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 "[[Object Errors#102. Invalid constant|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. | The labels help hugely when looking at the use of constants in your BHAV code. See [[TRCN]] for how to create labels. | ||
− | [[Image:BCONinBHAVinSimPE.JPG|frame|Labels on constants aid readability]] | + | [[Image:BCONinBHAVinSimPE.JPG|frame|left|Labels on constants aid readability]] |
<!-- previously .... #REDIRECT [[42434F4E]]--> | <!-- previously .... #REDIRECT [[42434F4E]]--> | ||
− | [[Category:Modding]] | + | [[Category:Sims 2 Modding]] |
[[Category:InternalFormats]] | [[Category:InternalFormats]] | ||
[[Category:FormatsByName]] | [[Category:FormatsByName]] |
Latest revision as of 18:09, 17 September 2012
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.