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!

A Simple Ultima.dll Code Tutorial

rsmiller21

Wanderer
A Simple Ultima.dll Code Tutorial

Below I decided to place some code that will help anyone interested pull common data from the dll. This code is written in Visual Basic but can be easily converted to C# with little effort.

** In order to use Ultima.dll you must add the file as a reference in your VB/C# project. Do a google search for "visual basic add file reference" if you are unsure how to do this. **

Displaying a Gump Image

Code:
Dim gumpImg As Image 
Dim gump As Ultima.Gumps 
 
' Ultima.dll returns the gump image 
gumpImg = gump.GetGump(463) ' Use the Gump ID you need in place of 463 
 
' Make a picture box display the image 
PictureBox1.Image = gumpImg



Displaying a Item Image

Code:
Dim staticImg As Image 
Dim item As Ultima.Art 
 
' Ultima.dll returns the static image 
staticImg = item.GetStatic(463) ' Use the Static ID you need in place of 463 
 
' Make a picture box display the image 
PictureBox1.Image = staticImg



Adding Hues to Images

Code:
Dim gumpImg As Image 
Dim gump As Ultima.Gumps 
Dim hue As Ultima.Hue ' Used to store a hue 
Dim hues As Ultima.Hues ' Used to get hue data 
 
' Ultima.dll returns the gump image 
gumpImg = gump.GetGump(463) ' Use the Gump ID you need in place of 463 
 
' Make a picture box display the image 
PictureBox1.Image = gumpImg 
 
' Loads hue data 
hue = hues.GetHue(1454) 
 
' Applys hue data to the image 
hue.ApplyTo(gumpImg, False) ' Second param is for grey scaling


That should get you by a majority of problems one will face while using the Ultima.dll. Good luck and happy programming.
 
Top