Please create an account or Login! Have fun!
Editing C2G
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 72: | Line 72: | ||
In addition, variables can be formatted into strings in script sections by placing the variable after a string with a printf-style format specifier: | In addition, variables can be formatted into strings in script sections by placing the variable after a string with a printf-style format specifier: | ||
"flags = %ld" flags | "flags = %ld" flags | ||
=== Score === | === Score === | ||
Line 144: | Line 133: | ||
Replace "<#>" with the desired time limit for the set. This will ignore any time limits set for individual levels. Time limits will be carried over from one level to the next, and restarting the level does not reset the time limit. [[Time bonus]]es and [[time penalty|time penalties]] can still be used. After the time limit reaches 0, or if a level is skipped, all future levels will be untimed. | Replace "<#>" with the desired time limit for the set. This will ignore any time limits set for individual levels. Time limits will be carried over from one level to the next, and restarting the level does not reset the time limit. [[Time bonus]]es and [[time penalty|time penalties]] can still be used. After the time limit reaches 0, or if a level is skipped, all future levels will be untimed. | ||
=== | === Exit choices === | ||
If a level has several [[exit]]s, C2G scripting can be used to send the player to different levels depending on what exit is entered. | |||
In order to do this, each level must be given a label starting with a pound (#) character. For example: | |||
<nowiki>#bonuslevel | |||
In order to do this, | |||
<nowiki># | |||
script | script | ||
" | "Congratulations!" | ||
"You have reached" | |||
"the secret level!" | |||
" | map "BonusLevel.c2m"</nowiki> | ||
" | In the example above, the level BonusLevel.c2m as well as the preceding text are given the label "bonuslevel". | ||
In the above | |||
Exits are numbered in reading order, starting at 1; there does not appear to be any limit. In order to use the feature, after calling the "map" of the level containing the exits, | Exits are numbered in reading order, starting at 1; there does not appear to be any limit. In order to use the feature, after calling the "map" of the level containing the exits, a line similar to this will be required: | ||
<nowiki> <#> exit == do goto #label</nowiki> | <nowiki> <#> exit == do goto #label</nowiki> | ||
Replace <#> with the exit number, and #label with the label name (including the #). For example: | Replace <#> with the exit number, and #label with the label name (including the #). For example: | ||
Line 218: | Line 158: | ||
script | script | ||
"This is the end."</nowiki> | "This is the end."</nowiki> | ||
In the example above, the game will load the level stored in the file ChooseYourFuture.c2m; if the player exits using the first exit in reading order, the game will then display the THIS IS THE END message. If the player exits using the second exit, however, the game will load the level in the file SuperSecretFinalLevel.c2m instead, and the THIS IS THE END message will be displayed after the level has been solved. | In the example above, the game will load the level stored in the file ChooseYourFuture.c2m; if the player exits using the first exit in reading order, the game will then display the THIS IS THE END. message. If the player exits using the second exit, however, the game will load the level in the file SuperSecretFinalLevel.c2m instead, and the THIS IS THE END message will be displayed after the level has been solved. | ||
If there are several players in the level, the exit used by the last player to finish the level will be the one used by the C2G script. If an invalid label is called, or no label is assigned for the exit that was used, the game will continue to work through the C2G file as it would normally. | If there are several players in the level, the exit used by the last player to finish the level will be the one used by the C2G script. If an invalid label is called, or no label is assigned for the exit that was used, the game will continue to work through the C2G file as it would normally. | ||
Line 231: | Line 171: | ||
If there are several players in the level, the gender of the last one to finish the level will be the one used by the C2G script. If an invalid label is called, or no line is specified for a specific gender, the game will continue to work through the C2G file as it would normally. | If there are several players in the level, the gender of the last one to finish the level will be the one used by the C2G script. If an invalid label is called, or no line is specified for a specific gender, the game will continue to work through the C2G file as it would normally. | ||
=== Goto === | |||
Goto can also be used in absence of a gender or exit check. For example: | |||
<nowiki>map "NormalProgression.c2m" | |||
#loop | |||
map "DejaVu.c2m" | |||
map "StuckInALoop.c2m" | |||
goto #loop</nowiki> | |||
In the example above, completing StuckInALoop.c2m will always take you back by one level to DejaVu.c2m. | |||
=== Fake level numbers === | === Fake level numbers === | ||
Line 247: | Line 196: | ||
map "Normal.c2m"</nowiki> | map "Normal.c2m"</nowiki> | ||
In the example above, Normal.c2m will be level 9. | In the example above, Normal.c2m will be level 9. | ||
=== Speed === | === Speed === | ||
Line 272: | Line 219: | ||
The following lines | The following lines | ||
<nowiki>1 level = | <nowiki>1 level = | ||
50 | 50 highspeed = continue replay | silent | flags =</nowiki> | ||
added to the beginning of the file (after the set name) will cause the game to automatically replay the recorded solutions for all levels in the set, in extremely high speed. This can be used to quickly verify that all levels are solvable and have recorded replays. | added to the beginning of the file (after the set name) will cause the game to automatically replay the recorded solutions for all levels in the set, in extremely high speed. This can be used to quickly verify that all levels are solvable and have recorded replays. | ||
== Comments box == | == Comments box == | ||
Line 345: | Line 252: | ||
<pre>2 exit == do goto #secret</pre> | <pre>2 exit == do goto #secret</pre> | ||
|- | |- | ||
| ==<br /><=<br />>=<br />!=<br /><<br />> | | ==<br /><=<br />>=<br />!=<br /><<br />> | ||
| binary operator | | binary operator | ||
| <pre><expressions...> <operator></pre> | | <pre><expressions...> <operator></pre> | ||
Line 373: | Line 280: | ||
| variable | | variable | ||
| <pre>enter</pre> | | <pre>enter</pre> | ||
| | | Use is currently unknown. | ||
|- | |- | ||
| SCORE | | SCORE | ||
Line 429: | Line 336: | ||
| label | | label | ||
| <pre>#<name></pre> | | <pre>#<name></pre> | ||
| Labels can be jumped to with the "goto" directive. There appears to be some interaction with the | | Labels can be jumped to with the "goto" directive. There appears to be some interaction with the **end** directive, but this is untested. | ||
|- | |- | ||
| 0..9 | | 0..9 | ||
Line 458: | Line 365: | ||
reg3 | reg3 | ||
reg4</pre> | reg4</pre> | ||
| | | Use is currently unknown. Possibly used as scratch registers for more complex expression evaluation? | ||
|- | |- | ||
| FLAGS | | FLAGS | ||
Line 473: | Line 380: | ||
| directive | | directive | ||
| <pre>chain "<filename>"</pre> | | <pre>chain "<filename>"</pre> | ||
| | | Use is currently unknown. | ||
|- | |- | ||
| LINE | | LINE | ||
| variable | | variable | ||
| <pre>line</pre> | | <pre>line</pre> | ||
| | | Use is currently unknown. | ||
|- | |- | ||
| CHDIR | | CHDIR | ||
Line 503: | Line 410: | ||
| constant | | constant | ||
| <pre>continue</pre> | | <pre>continue</pre> | ||
| Value: 0x1<br />When set in flags, automatically continue to the next level | | Value: 0x1<br />When set in flags, automatically continue to the next level. | ||
|- | |- | ||
| SILENT | | SILENT | ||
| constant | | constant | ||
| <pre>silent</pre> | | <pre>silent</pre> | ||
| Value: 0x4<br />When set in flags, | | Value: 0x4<br />When set in flags, ? | ||
|- | |- | ||
| KTIME | | KTIME | ||
Line 538: | Line 445: | ||
| directive | | directive | ||
| <pre>art "..."</pre> | | <pre>art "..."</pre> | ||
| | | Use is currently unknown. | ||
|- | |- | ||
| WAV | | WAV | ||
| directive | | directive | ||
| <pre>wav "..."</pre> | | <pre>wav "..."</pre> | ||
| | | Use is currently unknown. | ||
|- | |- | ||
| RAND | | RAND | ||
| pseudo-variable | | pseudo-variable | ||
| <pre>rand</pre> | | <pre>rand</pre> | ||
| When read, generates a pseudo-random integer. | | When read, generates a pseudo-random integer. | ||
|- | |- | ||
| SPEED | | SPEED | ||
Line 563: | Line 470: | ||
| unknown | | unknown | ||
| | | | ||
| Appears to be | | Appears to be unused. | ||
|- | |- | ||
| MAIN | | MAIN |