Difference between revisions of "Talk:SCM language"

From GTAMods Wiki
Jump to navigation Jump to search
m (Rework ETA?)
m (More leaked scripts)
 
(15 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 +
== More leaked scripts ==
 +
 +
So this time we got the entire GTA III, GTA VC and GTA SA script sources!
 +
 +
So we ('sup Wesser) guessed lots of things wrong (streamed scripts, some text label stuff, ''CONSTANT_*''), but we were right about ''CONST_*''. I'm really glad we are able to finally see what these scripts were really like. [[User:Link2012|Link2012]] ([[User talk:Link2012|talk]]) 02:33, 12 November 2021 (UTC)
 +
 +
:Cool but... lots of things? This is an unfair overstatement for us at a first glance:
 +
:* The filename of streamed scripts seemingly becomes a string constant on registration (we had no more talk since ages and I did change my view like that in the meantime :p);
 +
:* '''MISSION_START''' and '''MISSION_END''' indeed are also used as directives of streamed scripts, or better yet streamed sub-scripts (something we could have thought ourselves, dammit);
 +
:* Text label literals oftenly come with an unpredictable ampersand;
 +
:* '''CONSTANT_INT''' is nowhere found.
 +
:Actually, I feel so much proud of what's been discovered, imagined and reconstructed without a single piece of evidence about certain stuff. – [[User:Wesser|Wesser]] ([[User talk:Wesser|talk]]) 02:14, 14 November 2021 (UTC)
 +
::They also leaked the San Andreas Script Compiler so we now have enough information to specify the language with precision up to San Andreas :-). [[User:Link2012|Link2012]] ([[User talk:Link2012|talk]]) 14:12, 14 November 2021 (UTC)
 +
 
== Rework ETA? ==
 
== Rework ETA? ==
 
It seems pointless to edit the page on the wiki while the rework is going on, since the reworked page will presumably completely replace the current one entirely (correct me if I am wrong on that). Is there any ETA for the rework? Additionally, would it be possible for the rework to be done entirely on the wiki – section by section maybe – so that people can actively contribute to the page during the rework? – [[User:Squ1dd13|Squ1dd13]] ([[User talk:Squ1dd13|talk]]) 11:39, 3 September 2020 (UTC)
 
It seems pointless to edit the page on the wiki while the rework is going on, since the reworked page will presumably completely replace the current one entirely (correct me if I am wrong on that). Is there any ETA for the rework? Additionally, would it be possible for the rework to be done entirely on the wiki – section by section maybe – so that people can actively contribute to the page during the rework? – [[User:Squ1dd13|Squ1dd13]] ([[User talk:Squ1dd13|talk]]) 11:39, 3 September 2020 (UTC)
 
:If you are willing to help, send me a modified version of the work-in-progress article privately on GTAF. I will then pick up myself what's worth and discard the rest. – [[User:Wesser|Wesser]] ([[User talk:Wesser|talk]]) 19:37, 3 September 2020 (UTC)
 
:If you are willing to help, send me a modified version of the work-in-progress article privately on GTAF. I will then pick up myself what's worth and discard the rest. – [[User:Wesser|Wesser]] ([[User talk:Wesser|talk]]) 19:37, 3 September 2020 (UTC)
 +
::Ok, I'm a bit busy at the moment but I'll probably do that at some point. Cheers. – [[User:Squ1dd13|Squ1dd13]] ([[User talk:Squ1dd13|talk]]) 18:08, 4 September 2020 (UTC)
 +
:Hey. Nice to see another member of the community interested in the language after so long. Thanks for the updates. Let me express some disagreements: Command is an element of the language, opcode an element of the runtime environment (i.e. CRunningScript). The name of a operation should be command, since that is what Rockstar's miss2.exe strings call them (never mentioning something as an opcode). The language and the runtime should be treated as separate entities (e.g. Python can target CPython, PyPy, JVM, CLR and even native code) due to the separation of programming languages and compiler fields in computer science. b) Alternators shouldn't be called overloads IMO, because that's probably not how Rockstar called them. This language is quite exotic, and that's something to get used to. The leaked compiler always refer to it as an "alternative". Plus, when one describes it formally, it's not as easy to parallel it with function overloading (can talk further if necessary). Anyway, since you are here, you might be interested in something I've been working for the past few years. It's still unfinished therefore I have not yet acquired feedback from other community members, but it may provide insights onto the design of the language: https://gtamodding.github.io/gta3script-specs. It's pretty formal, but that's what it is supposed to be. Best regards. [[User:Link2012|Link2012]] ([[User talk:Link2012|talk]]) 19:57, 28 September 2020 (UTC)
 +
::I never really liked the "alternator" term, I opt for "multicommand" which is consistent with the native lexicon. – [[User:Wesser|Wesser]] ([[User talk:Wesser|talk]]) 16:29, 29 September 2020 (UTC)
 +
:::I recall your disagreement on the term, as we additionally opted for "command set" or "command selector". "Multicommand" seems fine to me since it's not to be confused with another PL term. [[User:Link2012|Link2012]] ([[User talk:Link2012|talk]]) 17:23, 29 September 2020 (UTC)
 +
::::I disagree with your point that the idea of alternators is different to function overloading (in this case, [[wikipedia:Operator overloading|operator overloading]]), but given that I'm new here and have less experience with both this wiki and the SCM language, I'll change the section back to 'alternators'. Regarding the point about "command" vs. "opcode", I'm not really sure what you're picking up on there? I don't see any obvious instances where I've used one where the other would be more suitable (I try to use "opcode" when referring to the number, and "command" when referring to the operation that has that number), but I'll look out for any mistakes I've made with that. Thanks for the advice! – [[User:Squ1dd13|Squ1dd13]] ([[User talk:Squ1dd13|talk]]) 11:28, 3 October 2020 (UTC)
 +
:::::My mistake on the point about opcodes, I thought you renamed the Commands section to Opcodes when I saw the diffs. Sorry for that. Regarding overloading, my disagreement comes from a) The commands themselves are not overloaded. There's not multiple commands named SET, but a name that maps to other commands that are independent from said name. b) The semantics for the arguments of a command and an alternator are different. For example, let's say we have the alternator <code>AAA = {BBB INPUT_INT}</code>. Since <code>BBB INPUT_INT</code> accepts integers and variables, I'd assume <code>AAA 1</code> or <code>AAA somevar</code> would work, but neither does, breaking my expectations about "overloading". And you are more than welcome! You did good on expressing your disagreement about my disagreement, such that I can share and question my own knowledge about the subject. Language design is something to be toughly discussed, or otherwise we risk breaking compilers or languages themselves forever. [[User:Link2012|Link2012]] ([[User talk:Link2012|talk]]) 16:14, 3 October 2020 (UTC)
 +
::::::I see your point about the alternators now, and it makes sense. Thanks for the explanation, it worked well! – [[User:Squ1dd13|Squ1dd13]] ([[User talk:Squ1dd13|talk]]) 15:51, 5 October 2020 (UTC)
 +
:Let me also take this opportunity to share something I've seen recently. The following is an interview that Rockstar North developers gave to GameSpot back in 2006: https://www.gamespot.com/articles/grand-theft-auto-san-andreas-qanda-under-the-hood/1100-6126774/. This interview confirms that arrays were only introduced in GTA SA, confirms the terms "main script", "mission script" and others, and introduces a new term, "ambient script", which are the non-main and non-mission scripts. [[User:Link2012|Link2012]] ([[User talk:Link2012|talk]]) 21:40, 28 September 2020 (UTC)
 +
::Thanks for sharing. A hidden gem, even though it unveils little unknown details, it's still pleasant to get something from a trusted source. [[User:Seemann|Seemann]] ([[User talk:Seemann|talk]]) 02:40, 29 September 2020 (UTC)
  
== Notes ==
+
== Miss2 ==
 
I'm not going to update the article by myself because I'm not good with words, my english is not so good...
 
I'm not going to update the article by myself because I'm not good with words, my english is not so good...
 
I'm going to left informations here to fix the article...
 
I'm going to left informations here to fix the article...
 
All information here is based on the reverse engineering of the SCM compiler left on Vice City 10th Anniversary, I will refer to this compiler here only by miss2 (Yeah, the name is the same as GTA 2 Script Compiler)
 
All information here is based on the reverse engineering of the SCM compiler left on Vice City 10th Anniversary, I will refer to this compiler here only by miss2 (Yeah, the name is the same as GTA 2 Script Compiler)
  
== About the 'SCM' meaning ==
+
=== About the 'SCM' meaning ===
 
SCM may stand for "Script Multifile", since the button to compile a scm is named "Run MultiFile parser", we have also the button "Run Parser" that produces a .scc file, it's unknown about the usage of that .scc
 
SCM may stand for "Script Multifile", since the button to compile a scm is named "Run MultiFile parser", we have also the button "Run Parser" that produces a .scc file, it's unknown about the usage of that .scc
 
Somewhere in the compiler code we have something like
 
Somewhere in the compiler code we have something like
Line 17: Line 40:
  
  
== Comments ==
+
=== Comments ===
 
One mistake on the article about comments, the article say:
 
One mistake on the article about comments, the article say:
 
  Limit
 
  Limit
Line 24: Line 47:
 
But actually multiline comments CAN BE nested.
 
But actually multiline comments CAN BE nested.
  
== Round brackets ==
+
=== Round brackets ===
 
They are replaced by ' ' in the first compilation step, so probably they are really for reading or highlighting purposes.
 
They are replaced by ' ' in the first compilation step, so probably they are really for reading or highlighting purposes.
 
',' is also replaced with ' '
 
',' is also replaced with ' '
  
== Types ==
+
=== Types ===
  
=== About VAR_CONST ===
+
==== About VAR_CONST ====
 
There is not VAR_CONST, but actually 04AE (and others) are used to assign a constant value into a VAR_INT, example:
 
There is not VAR_CONST, but actually 04AE (and others) are used to assign a constant value into a VAR_INT, example:
 
  VAR_INT a
 
  VAR_INT a
Line 39: Line 62:
 
  004E: end_thread
 
  004E: end_thread
  
=== About SHORT STRINGS VARIABLE ===
+
==== About SHORT STRINGS VARIABLE ====
 
The 8 byte string variable is called VAR_TEXT_LABEL
 
The 8 byte string variable is called VAR_TEXT_LABEL
  
=== About LONG STRINGS VARIABLE ===
+
==== About LONG STRINGS VARIABLE ====
 
No trace about that variable type in miss2, but I can guess it was called VAR_STRING
 
No trace about that variable type in miss2, but I can guess it was called VAR_STRING
  
=== Arrays ===
+
==== Arrays ====
 
The article is right about how arrays are declared (VAR_INT array[size]), but we have a strange behaviour around arrays...
 
The article is right about how arrays are declared (VAR_INT array[size]), but we have a strange behaviour around arrays...
 
The index seem to start from 1 instead of 0, very strange, let's see a example
 
The index seem to start from 1 instead of 0, very strange, let's see a example
Line 66: Line 89:
 
The array support on miss2 is not good since Vice City don't have arrays, using array[var] would output a messed file, so we can't say much about it.
 
The array support on miss2 is not good since Vice City don't have arrays, using array[var] would output a messed file, so we can't say much about it.
  
== Operators ==
+
=== Operators ===
  
=== Time Step operator ===
+
==== Time Step operator ====
 
The time step operator is not =- or =+, but +=@ or -=@, example:
 
The time step operator is not =- or =+, but +=@ or -=@, example:
 
  VAR_FLOAT a
 
  VAR_FLOAT a
Line 84: Line 107:
 
  004E: end_thread  
 
  004E: end_thread  
  
=== Compare String ===
+
==== Compare String ====
 
No COMPARE_STRING, string comparision is done with the comparision operator (at least for VAR_TEXT_LABEL)
 
No COMPARE_STRING, string comparision is done with the comparision operator (at least for VAR_TEXT_LABEL)
  
== Constants ==
+
=== Constants ===
 
Constants are hardcoded (as everything in the compiler). Maybe they changed this on the SA Compiler or maybe AudioEvents.txt is a constant dump file.
 
Constants are hardcoded (as everything in the compiler). Maybe they changed this on the SA Compiler or maybe AudioEvents.txt is a constant dump file.
  
  
== The script files ==
+
=== The script files ===
=== File gosubs ===
+
==== File gosubs ====
 
They are called "main extension files" and "foreign gosubs" and are called using GOSUB_FILE
 
They are called "main extension files" and "foreign gosubs" and are called using GOSUB_FILE
 
Example:
 
Example:
 
  GOSUB_FILE sub_label sub_file.sc
 
  GOSUB_FILE sub_label sub_file.sc
  
=== START_NEW_SCRIPT, LAUNCH_MISSION & LOAD_AND_LAUNCH_MISSION ===
+
==== START_NEW_SCRIPT, LAUNCH_MISSION & LOAD_AND_LAUNCH_MISSION ====
 
START_NEW_SCRIPT is 004F, LAUNCH_MISSION is 00D7 and LOAD_AND_LAUNCH_MISSION is 0417
 
START_NEW_SCRIPT is 004F, LAUNCH_MISSION is 00D7 and LOAD_AND_LAUNCH_MISSION is 0417
 
Okay, you may say: "Somewhere in GTA III Script files we have a commented block where LAUNCH_MISSION is launching a mission (0417)...", Yes, but this has probably been changed during the time, look again at that commented part and look the final code in sanny, the code is different.
 
Okay, you may say: "Somewhere in GTA III Script files we have a commented block where LAUNCH_MISSION is launching a mission (0417)...", Yes, but this has probably been changed during the time, look again at that commented part and look the final code in sanny, the code is different.
Line 134: Line 157:
 
  }
 
  }
  
== Statements ==
+
=== Statements ===
 
There's no DO..WHILE_TRUE and probably there's no FOR..ENDFOR too
 
There's no DO..WHILE_TRUE and probably there's no FOR..ENDFOR too
 
But we have a new statement over here, REPEAT..ENDREPEAT
 
But we have a new statement over here, REPEAT..ENDREPEAT
Line 161: Line 184:
  
  
== 128 Byte Strings ==
+
=== 128 Byte Strings ===
 
128 bytes strings are enclosed in quotation marks, example:
 
128 bytes strings are enclosed in quotation marks, example:
 
  "128B STRING"
 
  "128B STRING"
  
  
== Models constant ==
+
=== Models constant ===
 
They are read from the IDE files in maps folder... Actually miss2 read default.ide and gta_vc.dat, after parsing gta_vc.dat, miss2 will read all listed IDE files.
 
They are read from the IDE files in maps folder... Actually miss2 read default.ide and gta_vc.dat, after parsing gta_vc.dat, miss2 will read all listed IDE files.
  
== Entity Variables ==
+
=== Entity Variables ===
 
miss2 doesn't permit you to assign more than one entity to a specific variable, for example:
 
miss2 doesn't permit you to assign more than one entity to a specific variable, for example:
 
  VAR_INT var
 
  VAR_INT var
Line 175: Line 198:
 
  CREATE_CHAR 4 1 0.0 0.0 0.0 var  // error: Variable has already been used to create a entity of a different type
 
  CREATE_CHAR 4 1 0.0 0.0 0.0 var  // error: Variable has already been used to create a entity of a different type
 
  TERMINATE_THIS_SCRIPT
 
  TERMINATE_THIS_SCRIPT
 +
 +
– [[User:Link2012|Link2012]] ([[User talk:Link2012|talk]]) 12 December 2012 (UTC)

Latest revision as of 16:01, 15 November 2021

More leaked scripts

So this time we got the entire GTA III, GTA VC and GTA SA script sources!

So we ('sup Wesser) guessed lots of things wrong (streamed scripts, some text label stuff, CONSTANT_*), but we were right about CONST_*. I'm really glad we are able to finally see what these scripts were really like. Link2012 (talk) 02:33, 12 November 2021 (UTC)

Cool but... lots of things? This is an unfair overstatement for us at a first glance:
  • The filename of streamed scripts seemingly becomes a string constant on registration (we had no more talk since ages and I did change my view like that in the meantime :p);
  • MISSION_START and MISSION_END indeed are also used as directives of streamed scripts, or better yet streamed sub-scripts (something we could have thought ourselves, dammit);
  • Text label literals oftenly come with an unpredictable ampersand;
  • CONSTANT_INT is nowhere found.
Actually, I feel so much proud of what's been discovered, imagined and reconstructed without a single piece of evidence about certain stuff. – Wesser (talk) 02:14, 14 November 2021 (UTC)
They also leaked the San Andreas Script Compiler so we now have enough information to specify the language with precision up to San Andreas :-). Link2012 (talk) 14:12, 14 November 2021 (UTC)

Rework ETA?

It seems pointless to edit the page on the wiki while the rework is going on, since the reworked page will presumably completely replace the current one entirely (correct me if I am wrong on that). Is there any ETA for the rework? Additionally, would it be possible for the rework to be done entirely on the wiki – section by section maybe – so that people can actively contribute to the page during the rework? – Squ1dd13 (talk) 11:39, 3 September 2020 (UTC)

If you are willing to help, send me a modified version of the work-in-progress article privately on GTAF. I will then pick up myself what's worth and discard the rest. – Wesser (talk) 19:37, 3 September 2020 (UTC)
Ok, I'm a bit busy at the moment but I'll probably do that at some point. Cheers. – Squ1dd13 (talk) 18:08, 4 September 2020 (UTC)
Hey. Nice to see another member of the community interested in the language after so long. Thanks for the updates. Let me express some disagreements: Command is an element of the language, opcode an element of the runtime environment (i.e. CRunningScript). The name of a operation should be command, since that is what Rockstar's miss2.exe strings call them (never mentioning something as an opcode). The language and the runtime should be treated as separate entities (e.g. Python can target CPython, PyPy, JVM, CLR and even native code) due to the separation of programming languages and compiler fields in computer science. b) Alternators shouldn't be called overloads IMO, because that's probably not how Rockstar called them. This language is quite exotic, and that's something to get used to. The leaked compiler always refer to it as an "alternative". Plus, when one describes it formally, it's not as easy to parallel it with function overloading (can talk further if necessary). Anyway, since you are here, you might be interested in something I've been working for the past few years. It's still unfinished therefore I have not yet acquired feedback from other community members, but it may provide insights onto the design of the language: https://gtamodding.github.io/gta3script-specs. It's pretty formal, but that's what it is supposed to be. Best regards. Link2012 (talk) 19:57, 28 September 2020 (UTC)
I never really liked the "alternator" term, I opt for "multicommand" which is consistent with the native lexicon. – Wesser (talk) 16:29, 29 September 2020 (UTC)
I recall your disagreement on the term, as we additionally opted for "command set" or "command selector". "Multicommand" seems fine to me since it's not to be confused with another PL term. Link2012 (talk) 17:23, 29 September 2020 (UTC)
I disagree with your point that the idea of alternators is different to function overloading (in this case, operator overloading), but given that I'm new here and have less experience with both this wiki and the SCM language, I'll change the section back to 'alternators'. Regarding the point about "command" vs. "opcode", I'm not really sure what you're picking up on there? I don't see any obvious instances where I've used one where the other would be more suitable (I try to use "opcode" when referring to the number, and "command" when referring to the operation that has that number), but I'll look out for any mistakes I've made with that. Thanks for the advice! – Squ1dd13 (talk) 11:28, 3 October 2020 (UTC)
My mistake on the point about opcodes, I thought you renamed the Commands section to Opcodes when I saw the diffs. Sorry for that. Regarding overloading, my disagreement comes from a) The commands themselves are not overloaded. There's not multiple commands named SET, but a name that maps to other commands that are independent from said name. b) The semantics for the arguments of a command and an alternator are different. For example, let's say we have the alternator AAA = {BBB INPUT_INT}. Since BBB INPUT_INT accepts integers and variables, I'd assume AAA 1 or AAA somevar would work, but neither does, breaking my expectations about "overloading". And you are more than welcome! You did good on expressing your disagreement about my disagreement, such that I can share and question my own knowledge about the subject. Language design is something to be toughly discussed, or otherwise we risk breaking compilers or languages themselves forever. Link2012 (talk) 16:14, 3 October 2020 (UTC)
I see your point about the alternators now, and it makes sense. Thanks for the explanation, it worked well! – Squ1dd13 (talk) 15:51, 5 October 2020 (UTC)
Let me also take this opportunity to share something I've seen recently. The following is an interview that Rockstar North developers gave to GameSpot back in 2006: https://www.gamespot.com/articles/grand-theft-auto-san-andreas-qanda-under-the-hood/1100-6126774/. This interview confirms that arrays were only introduced in GTA SA, confirms the terms "main script", "mission script" and others, and introduces a new term, "ambient script", which are the non-main and non-mission scripts. Link2012 (talk) 21:40, 28 September 2020 (UTC)
Thanks for sharing. A hidden gem, even though it unveils little unknown details, it's still pleasant to get something from a trusted source. Seemann (talk) 02:40, 29 September 2020 (UTC)

Miss2

I'm not going to update the article by myself because I'm not good with words, my english is not so good... I'm going to left informations here to fix the article... All information here is based on the reverse engineering of the SCM compiler left on Vice City 10th Anniversary, I will refer to this compiler here only by miss2 (Yeah, the name is the same as GTA 2 Script Compiler)

About the 'SCM' meaning

SCM may stand for "Script Multifile", since the button to compile a scm is named "Run MultiFile parser", we have also the button "Run Parser" that produces a .scc file, it's unknown about the usage of that .scc Somewhere in the compiler code we have something like

if(IsMultifile)
    strcat(OutputFilename, "m")
else
    strcat(OutputFilename, "c")


Comments

One mistake on the article about comments, the article say:

Limit
   Multiline comments cannot be nested. 

But actually multiline comments CAN BE nested.

Round brackets

They are replaced by ' ' in the first compilation step, so probably they are really for reading or highlighting purposes. ',' is also replaced with ' '

Types

About VAR_CONST

There is not VAR_CONST, but actually 04AE (and others) are used to assign a constant value into a VAR_INT, example:

VAR_INT a
a = PAD2
TERMINATE_THIS_SCRIPT

>>

04AE: $303 = 1
004E: end_thread

About SHORT STRINGS VARIABLE

The 8 byte string variable is called VAR_TEXT_LABEL

About LONG STRINGS VARIABLE

No trace about that variable type in miss2, but I can guess it was called VAR_STRING

Arrays

The article is right about how arrays are declared (VAR_INT array[size]), but we have a strange behaviour around arrays... The index seem to start from 1 instead of 0, very strange, let's see a example

VAR_INT a[4]
a[0] = 0
a[1] = 1
a[2] = 2
a[3] = 3
a[4] = 4
//a[5] = 0 -- WOULD OUTPUT A ERROR ABOUT ARRAY OUT OF RANGE
TERMINATE_THIS_SCRIPT

>>

0004: $303 = 0
0004: $303 = 1
0004: $304 = 2
0004: $305 = 3
0004: $306 = 4
004E: end_thread 

The array support on miss2 is not good since Vice City don't have arrays, using array[var] would output a messed file, so we can't say much about it.

Operators

Time Step operator

The time step operator is not =- or =+, but +=@ or -=@, example:

VAR_FLOAT a
a +=@ 1.0
a -=@ 1.0
a = 1.0 +@ 2.0
a = a -@ 3.0
TERMINATE_THIS_SCRIPT

>>

0078: $303 += time_step * 1.0
007E: $303 -= time_step * 1.0
0005: $303 = 1.0
0078: $303 += time_step * 2.0
007E: $303 -= time_step * 3.0
004E: end_thread 

Compare String

No COMPARE_STRING, string comparision is done with the comparision operator (at least for VAR_TEXT_LABEL)

Constants

Constants are hardcoded (as everything in the compiler). Maybe they changed this on the SA Compiler or maybe AudioEvents.txt is a constant dump file.


The script files

File gosubs

They are called "main extension files" and "foreign gosubs" and are called using GOSUB_FILE Example:

GOSUB_FILE sub_label sub_file.sc

START_NEW_SCRIPT, LAUNCH_MISSION & LOAD_AND_LAUNCH_MISSION

START_NEW_SCRIPT is 004F, LAUNCH_MISSION is 00D7 and LOAD_AND_LAUNCH_MISSION is 0417 Okay, you may say: "Somewhere in GTA III Script files we have a commented block where LAUNCH_MISSION is launching a mission (0417)...", Yes, but this has probably been changed during the time, look again at that commented part and look the final code in sanny, the code is different.

There's also LOAD_AND_LAUNCH_MISSION_EXCLUSIVE, I don't know the purposes of it, okay.

LAUNCH_MISSION scripts are called Subscripts

The START_NEW_SCRIPT target label MUST be inside a scope block... The compiler also checks for the variables in that scope block to see if the START_NEW_SCRIPT extra params can be accept by the variables in the script scope block.

The foreign scripts MUST be inside a folder with the same name as the main script file, inside another folder or not. Example:

 main.sc
 main\
   subscript1.sc
   subscript2.sc
   initial_mission.sc
   mission_guy\
      mission_guy1.sc
      mission_guy2.sc
   darkel\
      darkel1.sc
      darkel2.sc
      darkel3.sc   

Usage Example:

START_NEW_SCRIPT label 1
LAUNCH_MISSION subscript1.sc // launch a subscript
LOAD_AND_LAUNCH_MISSION darkel1.sc // launch a mission
TERMINATE_THIS_SCRIPT

{
label:
LVAR_INT number_1
TERMINATE_THIS_SCRIPT
}

Statements

There's no DO..WHILE_TRUE and probably there's no FOR..ENDFOR too But we have a new statement over here, REPEAT..ENDREPEAT

REPEAT num_times var
  // code here
ENDREPEAT

This is like a FOR (for that reason I said there's no FOR...ENDFOR), will repeat the code num_times, using the var as the counter variable.

Example:

VAR_INT x k
REPEAT 4 x
 k *= 10
ENDREPEAT
TERMINATE_THIS_SCRIPT

>>

0004: $303 = 0 

:Noname_7
0010: $304 *= 10
0008: $303 += 1
0028:   $303 >= 4 
004D: jump_if_false @Noname_7 
004E: end_thread 


128 Byte Strings

128 bytes strings are enclosed in quotation marks, example:

"128B STRING"


Models constant

They are read from the IDE files in maps folder... Actually miss2 read default.ide and gta_vc.dat, after parsing gta_vc.dat, miss2 will read all listed IDE files.

Entity Variables

miss2 doesn't permit you to assign more than one entity to a specific variable, for example:

VAR_INT var
CREATE_CAR 400 0.0 0.0 0.0 var
CREATE_CHAR 4 1 0.0 0.0 0.0 var   // error: Variable has already been used to create a entity of a different type
TERMINATE_THIS_SCRIPT

Link2012 (talk) 12 December 2012 (UTC)