(bug) affects mapmakers, script renaming

Started by warren, July 02, 2014, 12:04:02 PM

Previous topic - Next topic

warren

CRPL authors beware: if you change the case (capitalization) of your script name, (at least on windows), every time you load the scenario the game will aggressively replace your script with an older copy.

Workaround:
Backup script.
delete script from scenario.
Save.
Load.
Copy script back in.
Save.
Load and verify.

Relli

I noticed something similar when deleting scripts I used for testing purposes. They'd always come back when I loaded up the game again. The solution was just a simple save, rather than just quitting when I was done. Luckily it never deleted scripts that I had added, or undid modifications. That would have been extremely painful to learn.

warren

Quote from: Relli on July 02, 2014, 01:41:41 PM
That would have been extremely painful to learn.

Good thing I backup obsessively. I only lost ten lines.

thepenguin

Yep.  This has been happening for a long time.

If you want to delete a script, you have to delete it from inside the game. (scripts panel)
We have become the creeper...

Relli

Quote from: thepenguin on July 06, 2014, 09:13:26 PM
Yep.  This has been happening for a long time.

If you want to delete a script, you have to delete it from inside the game. (scripts panel)
Are you sure? Because that's what I did, and they kept coming back. My first solution that worked was to find the folder they lived in and delete it there instead/as well. Though I later found out you just need to hit the save button, which I usually never needed to hit.

knucracker

Scripts get stored in the cw3 file and will get extracted back out upon load in the editor.  So, the best way to delete a script should be to delete them from within the game (click the delete button), then save the map.  That is supposed to remove them from disk, from the internal data structures, and from the cw3 save file.  If you delete them from disk, they will get re-extracted from the save file on the next load.

The reason it does this is so you can take a cw3 file at some point in the future (like on a new machine) and just load it up in the editor.  Any scripts inside get extracted so you can then edit them.  Note that the game does not extract a script if a file with the same name already exists.  On windows this can be confusing if you try to change the case.  The game knows about the case of scripts, but Windows doesn't care.  So files with different case are the same file.  The game sees the case differences and replaces with the internal version it has (which is the old case).  The workaround in the original post is the only way around this.