Difference between revisions of "BCON"

From SimsWiki
Jump to: navigation, search
m (We don't need two articles on the same topic)
Line 1: Line 1:
#REDIRECT [[42434F4E]]
+
{{Resource tgi
 +
|hex code = [[42434F4E]]
 +
|short = BCON
 +
|long = Behavior constant
 +
}}
 +
 
 +
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]]
 +
<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!!
 +
 
 +
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]]
 +
 
 +
<!-- previously .... #REDIRECT [[42434F4E]]-->
  
 
[[Category:Modding]]
 
[[Category:Modding]]
 
[[Category:InternalFormats]]
 
[[Category:InternalFormats]]
 
[[Category:FormatsByName]]
 
[[Category:FormatsByName]]

Revision as of 19:45, 8 July 2009

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.

Constants used to help in tuning behaviours


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!!

The labels help hugely when looking at the use of constants in your BHAV code. See TRCN for how to create labels.

Labels on constants aid readability
Personal tools
Namespaces

Variants
Actions
Navigation
game select
Toolbox