- Feature Name: gta3sc-define
- Start Date: 11/11/2016
Means of defining string constants within GTA3script files.
String constants are most of the time important for readability, and there's no known way to define them within the compilation stage.
Suspicious commands exist (CONST_INT
/ CONST_FLOAT
/ CONSTANT_INT
), but it's not feasible to infer their semantics purely by the command name.
ID | Command Name | Command Hash | Params |
---|---|---|---|
None | DEFINE_INT | 0x4ce823af | IDENTIFIER INT |
None | DEFINE_FLOAT | 0x2786fb5a | IDENTIFIER FLOAT |
The first parameter for the commands is the string constant the value will assume, and the second is the value in question.
Those constants should behave like the constants TRUE
/FALSE
. That is, they can be used mostly anywhere and shouldn't use the CONSTANT
variants of the set and comparision operations.
Constants defined by those command are propagated between script files, as seen in the example below.
main.sc:
DEFINE_INT LOW_HEALTH 100
VAR_INT car
VAR_FLOAT f
f = FLOAT_ONE + 10.0
CREATE_CAR 0 f FLOAT_ONE 0.0 car
SET_CAR_HEALTH car LOW_HEALTH
SET_CAR_HEALTH car FULL_HEALTH
GOSUB_FILE dummysub file.sc
TERMINATE_THIS_SCRIPT
main/file.sc
DEFINE_INT FULL_HEALTH 1000
DEFINE_FLOAT FLOAT_ONE 1.0
dummysub:
RETURN
Why should we not do this?
Any other alternative?
Anything to still be discussed?