RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Batch Files (*.bat) Debug Mode / Core Compile

Vorspire

Knight
Two very handy batch files to have sitting next to your RunUO.exe application that make life easier as a shard admin.

Batch (*.bat) files are simple text-based batches of command prompt instructions and supplies a somewhat basic, but flexible "script" language. When executed, these batch files open a command prompt window (CMD.exe) and process their instructions.

Installation:
1. Navigate to your RunUO.exe root directory (the same directory as RunUO.exe).
2. Create a new *.txt file and open it.
3. Copy and paste the code from any of the code examples below.
4. Save and exit.
5. Rename the *.txt file, changing the extension to *.bat.
6. Click OK/Yes/Accept if you receive a warning dialog about the file being unusable, this is normal.
7. If you don't have file extensions visible in Windows, you will probably have a *.bat.txt file, which isn't going to work - check to make sure the extension is correct, you may have to edit it through the file's Properties.
8. Double-click your *.bat file to test it.
9. ???
10. Profit!


1. Debug Mode

For those that don't know what "debug mode" is; It is a feature of RunUO and of the .NET Framework compiler that can be utilized in order to prepare more accurate and detailed information about the process, mainly for when things go wrong.

When "debug mode" is enabled, RunUO will write more detailed crash log files, including the line numbers where the exception was thrown. This can be extremely helpful when trying to diagnose exactly what is causing your shard to melt down.

There is usually a lot of confusion over exactly how to launch RunUO in "debug mode", some instructions can be more complex than they need to be. Here is a very simple and fast solution to running your shard in "debug mode".

File: Debug.bat
------Copy Below This Line------


@"RunUO.exe -debug"
@exit


------Copy Above This Line------



2. Compiling the Core

Compiling your own RunUO "core" can be a daunting task without the right tools.
If you don't use Visual Studio, your only other option is to use the command prompt, or a batch file.
There are two ways to compile your RunUO "core" via the use of batch files, the former being quite a bit more strict than the latter.

The first method is to call the .NET Framework common language runtime compiler with special arguments including input and output directories, file extensions to compile, assembly references and target framework.
In my own opinion, I find this method to be quite strict and not very maintainable.

The second method however, is much cleaner but it still has a down-side, it requires a Visual Studio Solution (*.sln) file in order to compile.
You may be thinking "But I don't have Visual Studio, so this is option useless to me!" - Well you'd be half right.
All you need is the *.sln file, if you don't have Visual Studio but you know someone who does, ask them to set up your shard in their Visual Studio and send you the *.sln file for the project.
If you don't have Visual Studio, but you have a copy of "Unofficial RunUO", you should already have the *.sln files.

This particular batch file will compile under .NET Framework 4.0 and requires "RunUO.sln" - the only two variables you might care about. Notice that instead of calling the .NET Framework common language runtime compiler, we're using "MSBuild" which is designed for processing *.sln files;


File: Compile.bat
------Copy Below This Line------


@del RunUO.exe

@"%windir%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" "%~dp0..\RunUO.sln" /p:Configuration=Release /p:Platform="Any CPU"

@echo:

@pause


------Copy Above This Line------



If you want me to post an example of the first method, make a note in your reply below.
 

Talow

Sorceror
Just another option for doing debug mode with windows, Create a new shortcut, or create a shortcut from the runuo.exe, Insure the path for the shortcut is set to your runuo.exe file. At the end of the path add "-debug". you can then use that shortcut for debugging.
 
Top