×
Меню
Индекс

MSFD Pitfalls

 
Inconsistent Commas
The scripting language is fairly forgiving in terms of comma usage or not, but the inconsistent use of commas can cause difficulties:
This will work:
Player->PositionCell, -1396, 124, 3312, 90, "Cell ID"
 
and this will work:
Player->PositionCell -1396 124 3312 90 "Cell ID"
 
but this will sometimes have problems:
Player->PositionCell -1396, 124, 3312, 90 "Cell ID"
 
Object Names
Don't start object names with an underscore. Otherwise, some script operations will fail.
This will cause runtime error.
_wr_testNPC->forceGreeting
 
This will work fine
wr_testNPC->forceGreeting ;--Okay.
 
Fractional Numbers
A constant float specified without digit before the decimal point will cause a runtime error. Floats in the range: -1 < 0 < 1 should be specified with a leading '0'. Otherwise you'll experience a runtime error.
This gives you a runtime error
if ( number == .2 )
 
This runs fine
if ( number == 0.2 )
 
34th Variable
If you have a script with 34 or more variables of the same type (short, long or float), the 34th variable of that type can cause errors when used. For that reason, most scripters call it "DoNotUse" or something like that to remember that they should not use it. The reason for this problem seems to be that the ASCII character 34 is the double quote character.
Short 32ndVar
Short 33ndVar
Short DoNotUse ;Really the 34th Var
Short 34thVar
Short 35thVar