Kaiten Commande
01-22-2003, 01:55 AM
ilys posed a question to me the other day when he was finishing off his scripts. "Can I copy files in T2?"
The only ways that I knew of was using a round about way in file_tools.cs or the save option in the Options Screen, but that would only save if the file was a MapFile.
I created this script to overcome this problem. What it does is reads the file line by line till it reaches EOF, then writes the lines back into the new file.
Used ingame to copy files. I don't know why people would want to copy files ingame except for backups before saving prefs, but you never know. Maybe can be used to backup prefs, cs files etc. This is resticted to plain text files (cs, txt, etc). This cannot be used to copy recordings, Screenshots, vl2 or dso files (binary).
Usage: CopyFile("PathTo/SourceFile", "PathTo/DestinationFile", optional true); <---- "PathTo" is relative to Base or mod directory.
Example: CopyFile("scripts/autoexec/copy.cs", "scripts/autoexec/copy.txt"); <--- Copies file if not existing
Example: CopyFile("scripts/autoexec/copy.cs", "scripts/autoexec/copy.txt", 1); <--- Overwrites file if existing
Errors:
"Error: Filenames may not contain any of the following characters: \\ ? * < > \' |" <-- Illegal Chars.
"Error: Source & Destination cannot be the same!" <---- Duh.
"Error: You cannot use blank filenames!" <---- Duh.
"Error: There is no file scripts/autoexec/copy.cs" <---- Source file doesn't exist.
"Error: scripts/autoexec/copy.txt allready exists. Please use a different filename." <---- File allready exists.
I am the first to admit that this file is fairly useless, but someone might find a use for it.
Download (http://www.kaiten.barrysworld.ne t/download.php?op=download&id=31&url=files/zSCRIPT-CopyFile.vl2)
The only ways that I knew of was using a round about way in file_tools.cs or the save option in the Options Screen, but that would only save if the file was a MapFile.
I created this script to overcome this problem. What it does is reads the file line by line till it reaches EOF, then writes the lines back into the new file.
Used ingame to copy files. I don't know why people would want to copy files ingame except for backups before saving prefs, but you never know. Maybe can be used to backup prefs, cs files etc. This is resticted to plain text files (cs, txt, etc). This cannot be used to copy recordings, Screenshots, vl2 or dso files (binary).
Usage: CopyFile("PathTo/SourceFile", "PathTo/DestinationFile", optional true); <---- "PathTo" is relative to Base or mod directory.
Example: CopyFile("scripts/autoexec/copy.cs", "scripts/autoexec/copy.txt"); <--- Copies file if not existing
Example: CopyFile("scripts/autoexec/copy.cs", "scripts/autoexec/copy.txt", 1); <--- Overwrites file if existing
Errors:
"Error: Filenames may not contain any of the following characters: \\ ? * < > \' |" <-- Illegal Chars.
"Error: Source & Destination cannot be the same!" <---- Duh.
"Error: You cannot use blank filenames!" <---- Duh.
"Error: There is no file scripts/autoexec/copy.cs" <---- Source file doesn't exist.
"Error: scripts/autoexec/copy.txt allready exists. Please use a different filename." <---- File allready exists.
I am the first to admit that this file is fairly useless, but someone might find a use for it.
Download (http://www.kaiten.barrysworld.ne t/download.php?op=download&id=31&url=files/zSCRIPT-CopyFile.vl2)