Mud Engine:
- Fixed a bug within MudScriptCompiler that prevented it from using standard .NET Types (would only support C# keywords). - Fixed a bug within MudScriptCompiler that prevented it from accessing Engine Type's from within Scripts. Mud Game: - Changed all of the C# keywords (string, bool) back to .NET, cross-language keywords (String, Boolean). Example Scripts will compile regardless of what compiler is used to within the MudScriptCompiler.
This commit is contained in:
parent
402be52e31
commit
7a0d1c5a74
11 changed files with 21 additions and 20 deletions
|
@ -60,7 +60,6 @@ namespace MudEngine.Scripting
|
|||
//Make sure we have a compiler version supplied.
|
||||
if (!CompilerOptions.ContainsKey("CompilerVersion"))
|
||||
CompilerOptions.Add("CompilerVersion", "v4.0");
|
||||
|
||||
//Instance a reference to the C# code provider, this is what will perform the compiling.
|
||||
CSharpCodeProvider provider = new CSharpCodeProvider(CompilerOptions);
|
||||
|
||||
|
@ -75,6 +74,7 @@ namespace MudEngine.Scripting
|
|||
"using System.Collections.Generic;",
|
||||
"using System.Text;",
|
||||
"using System.Linq;",
|
||||
"using MudEngine.Commands;",
|
||||
"using MudEngine.GameObjects;",
|
||||
"using MudEngine.GameObjects.Characters;",
|
||||
"using MudEngine.GameObjects.Environment;",
|
||||
|
@ -118,7 +118,8 @@ namespace MudEngine.Scripting
|
|||
String[] ConvertedScripts = Directory.GetFiles("temp", "*" + this.ScriptExtension, SearchOption.AllDirectories);
|
||||
|
||||
//Compile the scripts and provide the Results property with a reference to the compilation results.
|
||||
Results = provider.CompileAssemblyFromFile(param, baseScripts);
|
||||
param.GenerateInMemory = false;
|
||||
Results = provider.CompileAssemblyFromFile(param, ConvertedScripts);
|
||||
System.IO.Directory.Delete(modifiedScriptsPath, true);
|
||||
|
||||
//if the compiler has errors, return false.
|
||||
|
|
|
@ -35,7 +35,7 @@ public class CommandCreate : IGameCommand
|
|||
/// </summary>
|
||||
public CommandCreate()
|
||||
{
|
||||
Help = new List<string>();
|
||||
Help = new List<String>();
|
||||
Help.Add("Provides Admins the ability to create content dynamically within the game world.");
|
||||
Help.Add("Content is created at run-time while the server/game is running and players are connected.");
|
||||
Help.Add("Newly created content will be available for players to use/traverse immediately after creation is completed.");
|
||||
|
@ -62,7 +62,7 @@ public class CommandCreate : IGameCommand
|
|||
return;
|
||||
}
|
||||
|
||||
//Split the supplied string up. It wil give us an array of strings with the supplied
|
||||
//Split the supplied String up. It wil give us an array of strings with the supplied
|
||||
//object names if the admin has specified environment objects for creation.
|
||||
String[] env = command.Substring("Create ".Length).Split('>');
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ class CommandCreateRoom : IGameCommand
|
|||
/// </summary>
|
||||
public CommandCreateRoom()
|
||||
{
|
||||
Help = new List<string>();
|
||||
Help = new List<String>();
|
||||
Help.Add("Creates a Room within the Admin's current Realm>Zone");
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ public class CommandLinkRoom : IGameCommand
|
|||
public CommandLinkRoom()
|
||||
{
|
||||
//Instance the help collection and add our help information to it.
|
||||
Help = new List<string>();
|
||||
Help = new List<String>();
|
||||
Help.Add("Use this to link two previously created Rooms together.");
|
||||
//Incase Admins try to use the command, they will know that it's broken.
|
||||
//Don't convert this class into a Script until it is fully completed.
|
||||
|
@ -64,7 +64,7 @@ public class CommandLinkRoom : IGameCommand
|
|||
player.Send("2: Exit");
|
||||
|
||||
//Read the input from the Admin.
|
||||
string input = player.ReadInput();
|
||||
String input = player.ReadInput();
|
||||
Int32 value = 0;
|
||||
|
||||
//Attempt to convert their input from a String into a numerical value.
|
||||
|
@ -365,7 +365,7 @@ public class CommandLinkRoom : IGameCommand
|
|||
//to the screen for the user to see and select from.
|
||||
foreach (Int32 v in values)
|
||||
{
|
||||
//Since enum values are not strings, we can't simply assign a string value to the enum.
|
||||
//Since enum values are not strings, we can't simply assign a String value to the enum.
|
||||
//The enum needs to be queried to retrieve a value that matches that of 'v' and convert it to a String
|
||||
String displayName = Enum.GetName(typeof(AvailableTravelDirections), v);
|
||||
|
||||
|
@ -381,7 +381,7 @@ public class CommandLinkRoom : IGameCommand
|
|||
//Loop through each value found in our original array or values acquired from the AvailableTravelDirections enum.
|
||||
foreach (Int32 v in values)
|
||||
{
|
||||
//Since enum values are not strings, we can't simply assign a string value to the enum.
|
||||
//Since enum values are not strings, we can't simply assign a String value to the enum.
|
||||
//The enum needs to be queried to retrieve a value that matches that of 'v' and convert it to a String
|
||||
String displayName = Enum.GetName(typeof(AvailableTravelDirections), v);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ public class CommandList : IGameCommand
|
|||
|
||||
public CommandList()
|
||||
{
|
||||
Help = new List<string>();
|
||||
Help = new List<String>();
|
||||
Help.Add("Using the List command, you can view a generated list of filenames that pertain to a supplied object type.");
|
||||
Help.Add("Usage: List 'ItemType'");
|
||||
Help.Add("Usage: List 'ItemName>ItemType'");
|
||||
|
|
|
@ -24,7 +24,7 @@ public class CommandTeleport : IGameCommand
|
|||
|
||||
public CommandTeleport()
|
||||
{
|
||||
Help = new List<string>();
|
||||
Help = new List<String>();
|
||||
Help.Add("The Teleport command will teleport a player to a specified Room, regardless of where they are at.");
|
||||
Help.Add("Usage: Teleport playername FullyQualifiedRoomPath");
|
||||
Help.Add("Example: Teleport Billy MyRealm>MyZone>MyRoom");
|
||||
|
|
|
@ -32,7 +32,7 @@ public class CommandExit : IGameCommand
|
|||
//Instance the help collection and add our help information to it.
|
||||
//Typically the Help content is placed within the constructor, but this particular help document
|
||||
//needs to access information from the player, so we will build our Help collection in the Execute command.
|
||||
Help = new List<string>();
|
||||
Help = new List<String>();
|
||||
Help.Add("Exits the game.");
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ public class CommandGetTime : IGameCommand
|
|||
public CommandGetTime()
|
||||
{
|
||||
//Instance the help collection and add our help information to it.
|
||||
Help = new List<string>();
|
||||
Help = new List<String>();
|
||||
Help.Add("Gives you the current time and date in the game world.");
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public class CommandHelp : IGameCommand
|
|||
{
|
||||
//Check if we have a topic that the player wants help with. If there is nothing after the Help word
|
||||
//in the command, then the user didn't supply us with a topic.
|
||||
string topic = command.Substring("Help".Length);
|
||||
String topic = command.Substring("Help".Length);
|
||||
|
||||
//if the user did not supply us with a topic, we will print every command currently loaded in the engine
|
||||
//and tell the user how they can access help information regarding that command.
|
||||
|
@ -70,7 +70,7 @@ public class CommandHelp : IGameCommand
|
|||
else
|
||||
topic = topic.Trim();
|
||||
|
||||
//Get a reference to the command the player wants help with. We must insert the 'Command' string into the topic,
|
||||
//Get a reference to the command the player wants help with. We must insert the 'Command' String into the topic,
|
||||
//as all Commands start with the word Command, however the player never sees the word Command. It's internal only.
|
||||
IGameCommand gc = CommandEngine.GetCommand("Command" + topic);
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ public class CommandSay : IGameCommand
|
|||
return; //nothing to say, don't say anything at all.
|
||||
}
|
||||
|
||||
//Get the message out of the command string.
|
||||
//Get the message out of the command String.
|
||||
String message = command.Substring("Say ".Length);
|
||||
|
||||
//Query the game world and find what players are within the same location as the chatting player.
|
||||
|
|
|
@ -35,7 +35,7 @@ public class CommandWalk : IGameCommand
|
|||
Help.Add("You may use the Look command to see a description of the current Room, and decide where you would like to walk.");
|
||||
Help.Add("Usage: Walk 'Direction' where Direction may equal one of the following:");
|
||||
|
||||
//We will construct a string that contains all of the available travel directions for the player.
|
||||
//We will construct a String that contains all of the available travel directions for the player.
|
||||
StringBuilder directions = new StringBuilder();
|
||||
|
||||
//Store a array of existing values within the AvailableTravelDirection enum.
|
||||
|
@ -46,11 +46,11 @@ public class CommandWalk : IGameCommand
|
|||
//to the screen for the user to see and select from.
|
||||
foreach (Int32 v in values)
|
||||
{
|
||||
//Since enum values are not strings, we can't simply assign a string value to the enum.
|
||||
//Since enum values are not strings, we can't simply assign a String value to the enum.
|
||||
//The enum needs to be queried to retrieve a value that matches that of 'v' and convert it to a String
|
||||
String displayName = Enum.GetName(typeof(AvailableTravelDirections), v);
|
||||
|
||||
//Add the current travel direction to our string for later use.
|
||||
//Add the current travel direction to our String for later use.
|
||||
directions.Append(displayName + ", ");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue