Please create an account or Login! Have fun!

Editing C2G

Jump to navigation Jump to search
You are not logged in. While you can edit without logging in, your IP address will be recorded publicly, along with the time and date, in this page's history. It is sometimes possible for others to identify you with this information. Creating an account will conceal your IP address and provide you with many other benefits. Messages sent to your IP can be viewed on your talk page.

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 282: Line 282:
chain "scriptinanotherdirectory.c2g"</nowiki>
chain "scriptinanotherdirectory.c2g"</nowiki>
Note that if the first c2g file CC2 reads chains to another script but does not provide a map itself, CC2 will say the levelset is invalid. This is because it specifically checks the first c2g it reads for the use of "map" followed by a valid map. To avoid this, put a valid map ''after'' calling the chain, such that it will never be accessed since the parser will be chained away from the script before reaching it.
Note that if the first c2g file CC2 reads chains to another script but does not provide a map itself, CC2 will say the levelset is invalid. This is because it specifically checks the first c2g it reads for the use of "map" followed by a valid map. To avoid this, put a valid map ''after'' calling the chain, such that it will never be accessed since the parser will be chained away from the script before reaching it.
=== Level flags ===
Variables reg1 to reg4 can be used to store arbitrary flags, will be stored between chained scripts, and will be included in the player's save data. Here, a "switch palace" level includes two exits, the second of which sets the lowest bit in reg4 to 1, which the script then detects to swap out a later level for an alternate version:
<nowiki>map "SwitchPalace.c2m"
1 exit == do goto #afterpalace
script
"You touched the switch!"
"This will swap some"
"walls and floors in"
"a future level"
1 reg4 | reg4 =
#afterpalace
map "BoringLevel.c2m"
map "NormalLevel.c2m"
map "GreatLevel.c2m"
1 reg4 && do goto #switchon
#switchoff
map "AwesomeLevel.c2m"
goto #afterawesome
#switchon
map "AwesomeLevelAlt.c2m"
#afterawesome
map "OkayLevel.c2m"</nowiki>
Unused bits of the "flags" variable itself are also available, but flipping them is unadvised, as, theoretically, future updates to CC2 could add new purposes to unused flags at any moment.


== Comments box ==
== Comments box ==
Please note that all contributions to Chip's Challenge Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Chip's Challenge Wiki:Copyrights for details). Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)
Your changes will be visible immediately.
  • If you want to test editing, try the sandbox.
  • On talk pages, please sign your posts by typing four tildes (~~~~).