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!

Ultima SDK 2.1

Joeku

Lord
Ultima SDK 2.1

Some of you may have noticed that, if you try to use the StringList (Clilocs) with the SDK 2.0, you'll experience a nasty crash.

Thankfully, Zippy provided a fix for this issue, so I was able to integrate the fix into the SDK.

This 2.1 version is for use with RunUO 2.0 (.Net 2.0); I've uploaded the DLL and the source.

Admins: this thread could use a sticky.

Enjoy!
 

Attachments

  • Ultima SDK 2.1.zip
    21.2 KB · Views: 966
  • Ultima SDK 2.1 Source.zip
    30.1 KB · Views: 603

HellRazor

Knight
I'd like to see an official RunUO SVN put up for the Ultima SDK. There have been a lot of fixes posted, but the lack of a central repository is resulting in lots of different versions of the SDK floating around. It would be good to have a place to submit bug fixes and improvements to so we could have one version with all the fixes in it.
 

Joeku

Lord
That would be very nice.

Here's an example of how to use the new StringList methods:
Code:
using System;
using Server;
using Ultima;

namespace Joeku.Test
{
	public class Test_Main
	{
		public static StringList StringList = new StringList( "ENU" ); // Initialize an instance of the StringList.

		public static void Initialize()
		{
			// If you want to simply convert a cliloc into a string...
			Console.WriteLine( StringList.Table[1076267] ); // Boiling Cauldron
				// Boiling Cauldron

			// If you want to format a cliloc with args...
			Console.WriteLine( StringList.Format( 1070749, "John", "Amy" ) ); // ~1_val~ has joined ~2_val~.
				// John has joined Amy.

			// If you want to format a cliloc with a single arg string that is separated by tabs...
			string args = "Jim\tKelly"; // "\t" is the Tab character
			Console.WriteLine( StringList.SplitFormat( 1070749, args ) ); // ~1_val~ has joined ~2_val~.
				// Jim has joined Kelly.
		}
	}
}
Fully compiled and functional with RunUO 2.0 RC2.
 

Jeff

Lord
i_am_neo;757972 said:
Umm... Is it supposed to work with RunUo 2.0 RC1?? Cause for me it doesn't seem to work (fatal errors)

it has nothing to do with runuo. its for making 3rd party applications like pandora's box
 

HellRazor

Knight
Don't .NET DLL's and the programs they are used with need to be compiled with the same version of .NET?

Just wondering because I know I tried to use ultima.dll compiled under .NET 2.0 with a 1.3 compiled version of Pandora's Box and it wouldn't work, Pandora would just crash.
 

HellRazor

Knight
(Edit - Found some problems with this, will re-post it once I have the kinks worked out!)

ULTIMA SDK 2.2
--------------------

1. New Feature: You can now specify the UO directory path for use with the SDK by using the MyPath property. Here's an example:

Ultima.FileIndex.MyPath = "C:/My UO Directory";

If MyPath is null or empty, the SDK will continue to use the system registry for the UO install path as before.

2. Bug Fix: Fixed a problem with the SDK being sometimes unable to read the UO install data from the system registry of Windows 64 Bit operating systems (due to Wow6432Node being inserted into the registry path under those OS').

Compiled under .NET Framework 2.0.

Hope you find the updates useful!
 

Jeff

Lord
arul;774419 said:
In what parallel universe do you live in?
I'm pretty sure I've read that in a MS article for XNA, perhaps I'm wrong, however, come to think of it, i guess its faster since you don't have to box and unbox, so disregard my comment. One thing i do wish Dictionary didnt do was through a KeyNotFoundExcetion, just return null for damn sake....
 

arul

Sorceror
SomeObj val;
dictionary.TryGetValue(key, out val);

Yeah but I agree that with those constructions the code looks a little ugly.
 

Jeff

Lord
arul;774423 said:
SomeObj val;
dictionary.TryGetValue(key, out val);

Yeah but I agree that with those constructions the code looks a little ugly.

Point is, its not a straight replacement, especially with this SDK, i believe I tried to juts replace it once and got issues with the NoKeyFoundException, got lazy and stopped :)
 

HellRazor

Knight
Hey Jeff (or anyone else who can help):

I am attempting to modify the DLL to allow the the path to the UO directory to be changed programically from the calling application.

I've tried using a public static variable to hold the file path, which is then used in FileIndex.cs. The problem I am running into is that once the path to the UO client has been set the first time, the DLL always uses that path, even when the static public variable has changed.

Can anyone give me an idea as to why this happens and what I can do to work around it?

Thanks!
 
My idea is to use InvalidateProperties() in the "set" constructor. Since it reads the path once, probably we need to trigger it again to get the current value, I hope... :/
 

Jeff

Lord
HellRazor;774502 said:
Hey Jeff (or anyone else who can help):

I am attempting to modify the DLL to allow the the path to the UO directory to be changed programically from the calling application.

I've tried using a public static variable to hold the file path, which is then used in FileIndex.cs. The problem I am running into is that once the path to the UO client has been set the first time, the DLL always uses that path, even when the static public variable has changed.

Can anyone give me an idea as to why this happens and what I can do to work around it?

Thanks!
Ya you would have to re-initialize the FileIndexes when the path is changed, kind of a pain in the ass, but doable.
 

HellRazor

Knight
Jeff;774516 said:
Ya you would have to re-initialize the FileIndexes when the path is changed, kind of a pain in the ass, but doable.

I thought it might be something like that. How should I go about doing it? I'm a little lost on how to proceed. Something like Lord Mashadow suggested?
 

Jeff

Lord
Well for instance Animations.cs you would do this

Code:
        private static FileIndex m_FileIndex = new FileIndex( "Anim.idx", "Anim.mul", 0x40000, 6 );
        public static FileIndex FileIndex{ get{ return m_FileIndex; } }

        private static FileIndex m_FileIndex2 = new FileIndex( "Anim2.idx", "Anim2.mul", 0x10000, -1 );
        public static FileIndex FileIndex2{ get{ return m_FileIndex; } }

        private static FileIndex m_FileIndex3 = new FileIndex( "Anim3.idx", "Anim3.mul", 0x20000, -1 );
        public static FileIndex FileIndex3{ get{ return m_FileIndex; } }

        static Animations()
        {
            Initialize();
        }

        public static void Initialize()
        {
            Utility.EnsureClose(m_FileIndex);
            Utility.EnsureClose(m_FileIndex2);
            Utility.EnsureClose(m_FileIndex3);

            m_FileIndex = new FileIndex("Anim.idx", "Anim.mul", 0x40000, 6);
            m_FileIndex2 = new FileIndex("Anim2.idx", "Anim2.mul", 0x10000, -1);
            m_FileIndex3 = new FileIndex("Anim3.idx", "Anim3.mul", 0x20000, -1);
        }

Then make a Utility function EnsureClose
Code:
        public static void EnsureClose(FileIndex fileIndex)
        {
            if (fileIndex != null && fileIndex.Stream != null)
            {
                fileIndex.Stream.Close();
            }
        }


Be sure you inlude your custom paths, and whenenver the custom path changes call Animations.Initilize();, just do this for each class that has a FileIndex in it.
 
Thanks very much for making this available, however there's something up with the source.zip. I can't open with WinRAR or Windows Explorer. Wrong filetype?
 
Top