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!

Rhymes Fun With SDK PART 1s LOLOLOL

RHYMES

Wanderer
Rhymes Fun With SDK PART 1s LOLOLOL

Hi, LLOLOLOLOL, My name is RHymes and I like the SDK. Its fun to make things with the SDK. I want to make LOLOLOL tutorials on how to use the SDK. I want to start off basic, then move to MAYBE a COMPLETE Client. I got lololol time and if want to read it I gots no problems, also if u use this code dont even think of saying you found out from me since I didnt write the SDK, this guy named Kros did. FIRST I never made a graphical client for UO, but I have developed a UO client that is text based for about 7 months now (finished 5 months ago) and have used the SDK to develop new compacted maps for UO and collision slash resource base maps for UO (since a client that logs in to macro doesnt need friggen 80mb lolololol map file). It was called UOLight and it has about 10 internal users (PvPers use it to auto restock themselves to get back into PvP faster).

Ok Part 1. Rendering Radar. This is EXTREMELY easy. Krrios was pretty smart in making the SDK and almost everything returns as a Bitmap. SO RADARs.

1. This tutorial was made using Visual C# Express 2005 8.0. ITS FREE, goto microsoft.com and download it FOR FREE.

2. Start a new project and make it a "Windows Application" name it "UsingRadar"

3. View the Code of the form, it looks like this:

Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace UsingRadar
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
    }
}


4. Now we need to include the Ultima.dll, if you dont have it, get it, you DONT need the source for it. Right click Refrences on the Solution Explorer and select Add Refrence. Goto the browse tab and goto your Ultima.dll and add it. It doesnt matter where it is really just add it.

5. Now below Ln 7 where it says "using System.Windows.Forms;" add "using Ultima;" before the "namespace UsingRadar"

6. Ok cool, now we got the Ultima SDK in our project and can play with it.

7. Now go back to your form and add a Button and PictureBox. My form now looks like this.



8. Double click the button and it lets you enter code for it.

9a. With VC# Express you can usally type a namespace then a . and get a list of functions with there return. Thats how I did most of this.

9b. This part is Important. The maps are stored in 8x8 sqaures. So if your at moonglow position 4439 and 1170, to get your radar position you would divide them by 8. So for the FIRST line of code in the button do this.

Code:
Bitmap radarmap = Ultima.Map.Felucca.GetImage(4439/8, 1170/8, 25, 25);

10. Now we have the radar in a Bitmap, COOL!. Ok now lets display it to our picture box. So I left our picture box to default name pictureBox1. RIght below the last bit of code type.

Code:
pictureBox1.Image = radarmap;

11. Compile your project, click the button, wait a sec and WAM radar of a spot in moonglow. NOTICE that when it displayed your position, it displayed the position you put in at the top left corner. So maybe you can play with it a bit and figure out a way to center the map on your position!.

Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Ultima;
namespace UsingRadar
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
           Bitmap radarmap = Ultima.Map.Felucca.GetImage(4439/8, 1170/8, 25, 25);
           pictureBox1.Image = radarmap;
        }
    }
}
Post questions and concerns.
RHYMES lololol
 
Top