-
Notifications
You must be signed in to change notification settings - Fork 31
TazUO.Scripts
ℹ️ This system needs TazUO v3.16.0+
Examples
Scripts is something TazUO ported over from ServUO where you can write C# scripts with access to many events and classes to alter the client without needing to create a fork and build your own version of TazUO.
-
Using the latest Visual Studio Community Edition create a new project:
-
Choose Class Library for a template:
-
Name it whatever you'd like and wherever you'd like. If it asks what
.net
version you can pick any version, we are going to manually change this after as VS doesn't support the version we are using for TUO. -
Now that you have your project open, double click the project in the solution explorer window here:
-
Change the
targetframework
tonet4.7.2
and also disableimplicitusings
:
-
Add TazUO(Still named ClassicUO.exe) as a reference by clicking
Project -> Add Project Reference
:
Start `grammin!
When you have a script you like, you can just copy the .cs
file to TazUO/Scripts/
and restart your client.
The public static void Configure()
method will be called no sooner than immediately before the game is fully loaded, this is the best place to set up various configurations you may need to do.
The public static void Initialize()
method will be called no sooner than the game is loaded, potentially right before it is started, so it is best to use this to set up event handlers or command registers. Don't try to make changes here as much of it may not be started yet.
To keep client load times down, Configure and Initialize are run on a separate thread, if compiling is taking a long time the game will continue to load and these methods may get called later than expected.
You can use the OnConnected event to start up things as this is when the player is in game.
You can create an Assemblies.cfg
file inside your Data file(TazUO/Data/) to add custom assemblies needed for your scripts such as:
System.Linq.dll
However these files must be present. (In the .exe directory)