(bug) affects mapmakers, script renaming

warren · 1674

warren

  • Full Member
  • ***
    • Posts: 410
on: July 02, 2014, 12:04:02 pm
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

  • Community Guild
  • *****
    • Posts: 234
Reply #1 on: July 02, 2014, 01:41:41 pm
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

  • Full Member
  • ***
    • Posts: 410
Reply #2 on: July 02, 2014, 10:36:43 pm
That would have been extremely painful to learn.

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



thepenguin

  • Hero Member
  • *****
    • Posts: 3038
  • "What if ..."
Reply #3 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)

We have become the creeper...


Relli

  • Community Guild
  • *****
    • Posts: 234
Reply #4 on: July 07, 2014, 08:45:13 am
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

  • Administrator
  • *****
    • Posts: 11749
Reply #5 on: July 07, 2014, 09:10:11 am
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.