mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-12 19:31:41 +00:00
Parametrize script extension, default to 'tscript'
This commit is contained in:
parent
b8b62292bd
commit
099dd4f1f3
542 changed files with 774 additions and 783 deletions
|
|
@ -323,7 +323,7 @@ void init()
|
|||
ConsoleConstructor::setup();
|
||||
|
||||
// Set up the parser(s)
|
||||
CON_ADD_PARSER(CMD, "cs", true); // TorqueScript
|
||||
CON_ADD_PARSER(CMD, TORQUE_SCRIPT_EXTENSION, true); // TorqueScript
|
||||
|
||||
// Setup the console types.
|
||||
ConsoleBaseType::initialize();
|
||||
|
|
@ -1184,7 +1184,7 @@ bool executeFile(const char* fileName, bool noCalls, bool journalScript)
|
|||
Con::expandScriptFilename(scriptFilenameBuffer, sizeof(scriptFilenameBuffer), fileName);
|
||||
|
||||
// since this function expects a script file reference, if it's a .dso
|
||||
// lets terminate the string before the dso so it will act like a .cs
|
||||
// lets terminate the string before the dso so it will act like a .tscript
|
||||
if (dStrEndsWith(scriptFilenameBuffer, ".dso"))
|
||||
{
|
||||
scriptFilenameBuffer[dStrlen(scriptFilenameBuffer) - dStrlen(".dso")] = '\0';
|
||||
|
|
@ -1206,11 +1206,11 @@ bool executeFile(const char* fileName, bool noCalls, bool journalScript)
|
|||
// Check Editor Extensions
|
||||
bool isEditorScript = false;
|
||||
|
||||
// If the script file extension is '.ed.cs' then compile it to a different compiled extension
|
||||
if (dStricmp(ext, ".cs") == 0)
|
||||
// If the script file extension is '.ed.tscript' then compile it to a different compiled extension
|
||||
if (dStricmp(ext, "." TORQUE_SCRIPT_EXTENSION) == 0)
|
||||
{
|
||||
const char* ext2 = ext - 3;
|
||||
if (dStricmp(ext2, ".ed.cs") == 0)
|
||||
if (dStricmp(ext2, ".ed." TORQUE_SCRIPT_EXTENSION) == 0)
|
||||
isEditorScript = true;
|
||||
}
|
||||
else if (dStricmp(ext, ".gui") == 0)
|
||||
|
|
|
|||
|
|
@ -468,11 +468,11 @@ namespace Con
|
|||
/// This is used in (among other places) the exec() script function, which
|
||||
/// takes a parameter indicating a script file and executes it. Script paths
|
||||
/// can be one of:
|
||||
/// - <b>Absolute:</b> <i>fps/foo/bar.cs</i> Paths of this sort are passed
|
||||
/// - <b>Absolute:</b> <i>fps/foo/bar.tscript</i> Paths of this sort are passed
|
||||
/// through.
|
||||
/// - <b>Mod-relative:</b> <i>~/foo/bar.cs</i> Paths of this sort have their
|
||||
/// - <b>Mod-relative:</b> <i>~/foo/bar.tscript</i> Paths of this sort have their
|
||||
/// replaced with the name of the current mod.
|
||||
/// - <b>File-relative:</b> <i>./baz/blip.cs</i> Paths of this sort are
|
||||
/// - <b>File-relative:</b> <i>./baz/blip.tscript</i> Paths of this sort are
|
||||
/// calculated relative to the path of the current scripting file.
|
||||
///
|
||||
/// @note This function determines paths relative to the currently executing
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@
|
|||
/// setName() - obj.setName(newName)
|
||||
/// @endcode
|
||||
///
|
||||
/// In the Torque example app, there are two functions defined in common\\client\\scriptDoc.cs
|
||||
/// In the Torque example app, there are two functions defined in common\\client\\scriptDoc.tscript
|
||||
/// which automate the process of dumping the documentation. They make use of the ConsoleLogger
|
||||
/// object to output the documentation to a file, and look like this:
|
||||
///
|
||||
|
|
|
|||
|
|
@ -787,7 +787,7 @@ DefineEngineFunction( strIsMatchMultipleExpr, bool, ( const char* patterns, cons
|
|||
"this string. If false, differences in casing are ignored.\n"
|
||||
"@return True if @a str matches any of the given @a patterns.\n\n"
|
||||
"@tsexample\n"
|
||||
"strIsMatchMultipleExpr( \"*.cs *.gui *.mis\", \"mymission.mis\" ) // Returns true.\n"
|
||||
"strIsMatchMultipleExpr( \"*." TORQUE_SCRIPT_EXTENSION " *.gui *.mis\", \"mymission.mis\" ) // Returns true.\n"
|
||||
"@endtsexample\n"
|
||||
"@see strIsMatchExpr\n"
|
||||
"@ingroup Strings" )
|
||||
|
|
@ -1200,7 +1200,7 @@ DefineEngineFunction( isValidIP, bool, ( const char* str),,
|
|||
//----------------------------------------------------------------
|
||||
|
||||
// Torque won't normally add another string if it already exists with another casing,
|
||||
// so this forces the addition. It should be called once near the start, such as in main.cs.
|
||||
// so this forces the addition. It should be called once near the start, such as in main.tscript.
|
||||
DefineEngineStringlyVariadicFunction(addCaseSensitiveStrings,void,2,0,"[string1, string2, ...]"
|
||||
"Adds case sensitive strings to the StringTable.")
|
||||
{
|
||||
|
|
@ -1810,7 +1810,7 @@ DefineEngineFunction( detag, const char*, ( const char* str ),,
|
|||
"to convert a tagged string ID back into a regular string at any time.\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"// From scripts/client/message.cs\n"
|
||||
"// From scripts/client/message. " TORQUE_SCRIPT_EXTENSION "\n"
|
||||
"function clientCmdChatMessage(%sender, %voice, %pitch, %msgString, %a1, %a2, %a3, %a4, %a5, %a6, %a7, %a8, %a9, %a10)\n"
|
||||
"{\n"
|
||||
" onChatMessage(detag(%msgString), %voice, %pitch);\n"
|
||||
|
|
@ -2262,7 +2262,7 @@ static U32 journalDepth = 1;
|
|||
|
||||
DefineEngineFunction( getDSOPath, const char*, ( const char* scriptFileName ),,
|
||||
"Get the absolute path to the file in which the compiled code for the given script file will be stored.\n"
|
||||
"@param scriptFileName %Path to the .cs script file.\n"
|
||||
"@param scriptFileName %Path to the ." TORQUE_SCRIPT_EXTENSION " script file.\n"
|
||||
"@return The absolute path to the .dso file for the given script file.\n\n"
|
||||
"@note The compiler will store newly compiled DSOs in the prefs path but pre-existing DSOs will be loaded "
|
||||
"from the current paths.\n\n"
|
||||
|
|
@ -2303,13 +2303,13 @@ DefineEngineFunction( compile, bool, ( const char* fileName, bool overrideNoDSO
|
|||
if(dsoPath && *dsoPath == 0)
|
||||
return false;
|
||||
|
||||
// If the script file extention is '.ed.cs' then compile it to a different compiled extention
|
||||
// If the script file extention is '.ed.tscript' then compile it to a different compiled extention
|
||||
bool isEditorScript = false;
|
||||
const char *ext = dStrrchr( scriptFilenameBuffer, '.' );
|
||||
if( ext && ( dStricmp( ext, ".cs" ) == 0 ) )
|
||||
if( ext && ( dStricmp( ext, "." TORQUE_SCRIPT_EXTENSION) == 0 ) )
|
||||
{
|
||||
const char* ext2 = ext - 3;
|
||||
if( dStricmp( ext2, ".ed.cs" ) == 0 )
|
||||
if( dStricmp( ext2, ".ed." TORQUE_SCRIPT_EXTENSION) == 0 )
|
||||
isEditorScript = true;
|
||||
}
|
||||
else if( ext && ( dStricmp( ext, ".gui" ) == 0 ) )
|
||||
|
|
@ -2364,8 +2364,8 @@ DefineEngineFunction( exec, bool, ( const char* fileName, bool noCalls, bool jou
|
|||
"@param journalScript Deprecated\n"
|
||||
"@return True if the script was successfully executed, false if not.\n\n"
|
||||
"@tsexample\n"
|
||||
"// Execute the init.cs script file found in the same directory as the current script file.\n"
|
||||
"exec( \"./init.cs\" );\n"
|
||||
"// Execute the init." TORQUE_SCRIPT_EXTENSION " script file found in the same directory as the current script file.\n"
|
||||
"exec( \"./init." TORQUE_SCRIPT_EXTENSION "\" );\n"
|
||||
"@endtsexample\n\n"
|
||||
"@see compile\n"
|
||||
"@see eval\n"
|
||||
|
|
@ -2684,8 +2684,8 @@ DefineEngineFunction( export, void, ( const char* pattern, const char* filename,
|
|||
"@param append If true and @a fileName is not \"\", then the definitions are appended to the specified file. "
|
||||
"Otherwise existing contents of the file (if any) will be overwritten.\n\n"
|
||||
"@tsexample\n"
|
||||
"// Write out all preference variables to a prefs.cs file.\n"
|
||||
"export( \"$prefs::*\", \"prefs.cs\" );\n"
|
||||
"// Write out all preference variables to a prefs." TORQUE_SCRIPT_EXTENSION " file.\n"
|
||||
"export( \"$prefs::*\", \"prefs." TORQUE_SCRIPT_EXTENSION "\" );\n"
|
||||
"@endtsexample\n\n"
|
||||
"@ingroup Scripting" )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ void freeConsoleParserList(void);
|
|||
/// \param p Parse function
|
||||
/// \param r Restart function
|
||||
/// \param ssb SetScanBuffer function
|
||||
/// \param def true if this is the default parser (<b>Note:</b> set this only on the .cs parser!)
|
||||
/// \param def true if this is the default parser (<b>Note:</b> set this only on the .tscript parser!)
|
||||
/// \return true for success, false for failure (out of memory)
|
||||
/// \sa FreeConsoleParserList(), ConsoleParser
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -156,8 +156,8 @@ DefineEngineFunction( findFirstFile, String, ( const char* pattern, bool recurse
|
|||
"@return The path of the first file matched by the search or an empty string if no matching file could be found.\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"// Execute all .cs files in a subdirectory and its subdirectories.\n"
|
||||
"for( %file = findFirstFile( \"subdirectory/*.cs\" ); %file !$= \"\"; %file = findNextFile() )\n"
|
||||
"// Execute all ." TORQUE_SCRIPT_EXTENSION " files in a subdirectory and its subdirectories.\n"
|
||||
"for( %file = findFirstFile( \"subdirectory/*." TORQUE_SCRIPT_EXTENSION "\" ); %file !$= \"\"; %file = findNextFile() )\n"
|
||||
" exec( %file );\n"
|
||||
"@endtsexample\n\n"
|
||||
|
||||
|
|
@ -193,8 +193,8 @@ DefineEngineFunction( findNextFile, String, ( const char* pattern ), ( "" ),
|
|||
"@return The path of the next filename matched by the search or an empty string if no more files match.\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"// Execute all .cs files in a subdirectory and its subdirectories.\n"
|
||||
"for( %file = findFirstFile( \"subdirectory/*.cs\" ); %file !$= \"\"; %file = findNextFile() )\n"
|
||||
"// Execute all ." TORQUE_SCRIPT_EXTENSION " files in a subdirectory and its subdirectories.\n"
|
||||
"for( %file = findFirstFile( \"subdirectory/*." TORQUE_SCRIPT_EXTENSION "\" ); %file !$= \"\"; %file = findNextFile() )\n"
|
||||
" exec( %file );\n"
|
||||
"@endtsexample\n\n"
|
||||
|
||||
|
|
@ -224,8 +224,8 @@ DefineEngineFunction( getFileCount, S32, ( const char* pattern, bool recurse ),
|
|||
"@return Number of files located using the pattern\n\n"
|
||||
|
||||
"@tsexample\n"
|
||||
"// Count the number of .cs files in a subdirectory and its subdirectories.\n"
|
||||
"getFileCount( \"subdirectory/*.cs\" );\n"
|
||||
"// Count the number of ." TORQUE_SCRIPT_EXTENSION " files in a subdirectory and its subdirectories.\n"
|
||||
"getFileCount( \"subdirectory/*." TORQUE_SCRIPT_EXTENSION "\" );\n"
|
||||
"@endtsexample\n\n"
|
||||
|
||||
"@see findFirstFile()"
|
||||
|
|
@ -259,8 +259,8 @@ DefineEngineFunction(findFirstFileMultiExpr, String, ( const char* pattern, bool
|
|||
"call to findFirstFile() and findFirstFileMultiExpr() initiates a new search and renders "
|
||||
"a previous search invalid.\n\n"
|
||||
|
||||
"@param pattern The path and file name pattern to match against, such as *.cs. Separate "
|
||||
"multiple patterns with TABs. For example: \"*.cs\" TAB \"*.dso\"\n"
|
||||
"@param pattern The path and file name pattern to match against, such as *." TORQUE_SCRIPT_EXTENSION ". Separate "
|
||||
"multiple patterns with TABs. For example: \"*." TORQUE_SCRIPT_EXTENSION "\" TAB \"*.dso\"\n"
|
||||
"@param recurse If true, the search will exhaustively recurse into subdirectories "
|
||||
"of the given path and match the given filename patterns.\n"
|
||||
"@return String of the first matching file path, or an empty string if no matching "
|
||||
|
|
@ -333,8 +333,8 @@ DefineEngineFunction(getFileCountMultiExpr, S32, ( const char* pattern, bool rec
|
|||
"If you're interested in a list of files that match the given patterns and not just "
|
||||
"the number of files, use findFirstFileMultiExpr() and findNextFileMultiExpr().\n\n"
|
||||
|
||||
"@param pattern The path and file name pattern to match against, such as *.cs. Separate "
|
||||
"multiple patterns with TABs. For example: \"*.cs\" TAB \"*.dso\"\n"
|
||||
"@param pattern The path and file name pattern to match against, such as *." TORQUE_SCRIPT_EXTENSION ". Separate "
|
||||
"multiple patterns with TABs. For example: \"*." TORQUE_SCRIPT_EXTENSION "\" TAB \"*.dso\"\n"
|
||||
"@param recurse If true, the search will exhaustively recurse into subdirectories "
|
||||
"of the given path and match the given filename pattern.\n"
|
||||
"@return Number of files located using the patterns\n\n"
|
||||
|
|
@ -589,7 +589,7 @@ DefineEngineFunction(fileExt, String, ( const char* fileName ),,
|
|||
"@brief Get the extension of a file\n\n"
|
||||
|
||||
"@param fileName Name and path of file\n"
|
||||
"@return String containing the extension, such as \".exe\" or \".cs\"\n"
|
||||
"@return String containing the extension, such as \".exe\" or \"." TORQUE_SCRIPT_EXTENSION "\"\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
const char *ret = dStrrchr(fileName, '.');
|
||||
|
|
@ -744,7 +744,7 @@ DefineEngineFunction(getExecutableName, String, (),,
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
DefineEngineFunction( getMainDotCsDir, String, (),,
|
||||
"@brief Get the absolute path to the directory that contains the main.cs script from which the engine was started.\n\n"
|
||||
"@brief Get the absolute path to the directory that contains the main." TORQUE_SCRIPT_EXTENSION " script from which the engine was started.\n\n"
|
||||
|
||||
"This directory will usually contain all the game assets and, in a user-side game installation, will usually be "
|
||||
"read-only.\n\n"
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class CodeBlock;
|
|||
/// To use the debugger, use dbgSetParameters(port, password); in the console
|
||||
/// of the server to enable debugger connections. Then on some other system,
|
||||
/// start up the app (you don't have to start a game or connect to the
|
||||
/// server) and exec("common/debugger/debugger.cs"); in the console. Then use
|
||||
/// server) and exec("common/debugger/debugger.tscript"); in the console. Then use
|
||||
/// the debugger GUI to connect to the server with the right port and password.
|
||||
///
|
||||
/// @see http://www.planettribes.com/tribes2/editing.shtml for more thorough discussion.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue