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!

map.<facet>.GetImage()

[Shaman]

Wanderer
map.<facet>.GetImage()

i've been messing around with the ultima skd again, and i've stumbled upon an oddity:

Code:
Ultima.Map.Trammel.GetImage(x, y, 272, 272)

if i make a picturebox hold that image, giving x and y any random coordinate on the map... i get nothing but a black image.. same things go when i try one of the other facets...

Does anybody know why this doesn't work, and/or how to fix it?

Thanks
 

Revan

Sorceror
Here's what i've done that makes it work:
Code:
pictureBox.Image = Ultima.Map.Felucca.GetImage(0, 0, 32, 32, true);

It just shows the water in the top left corner of the map though :p
The resolution there (32x32) isn't the right one to use to get

I recommend you lower your resolution though.. 272x272 shows like 1/4th of the map (takes quite a while to load)
 

[Shaman]

Wanderer
Revan said:
Here's what i've done that makes it work:
Code:
pictureBox.Image = Ultima.Map.Felucca.GetImage(0, 0, 32, 32, true);

It just shows the water in the top left corner of the map though :p
The resolution there (32x32) isn't the right one to use to get

I recommend you lower your resolution though.. 272x272 shows like 1/4th of the map (takes quite a while to load)



i've been messing with it a bit, it clearly is that x and y aren't the .where of a character.. they are somehow linked i think, but i don't know how....

Krrios, do you have something that might clear this up?
 

[Shaman]

Wanderer
i found the sollution, it's not 100% accurate i think but it's close enough..

pictureBox.Image = Ultima.Map.Felucca.GetImage((x/8), (y/8), (picturebox1.width), (picturebox1.height), true);
 

[Shaman]

Wanderer
1) because i spent 5 hours trying to get that control on my form, and still failed(blame vs.net)
2) its 99% accurate, its just 1 or 2 pixels off, so its not such a biggy...

lemme paste the code i used:


Code:
    Private Sub show_img(ByVal x As Integer, ByVal y As Integer)
        Dim w As Integer = PictureBox1.Width * 0.75  ' <<< remove * 0.75 to make it not zoom
        Dim h As Integer = PictureBox1.Height * 0.75 ' <<< same
        Dim a As New Bitmap(w, h, Drawing.Imaging.PixelFormat.Format16bppRgb555)
        Dim img As Image = Ultima.Map.Felucca.GetImage(calc(x, w), calc(y, h), w, h, True)
        Dim graph As Graphics = Graphics.FromImage(a)
        Threading.Thread.Sleep(10)
        graph.DrawImage(img, New Point(0, 0))
        Threading.Thread.Sleep(10)
        PictureBox1.Image = a
    End Sub

    Public Function calc(ByVal coord As Integer, ByVal size As Integer) As Integer
        Return CInt((coord / 8) - ((size / 2) / 8))
    End Function


as you see i made it use the width/height of the picturebox you are using to make the coords you specified the center of the picturebox, in stead of the upper left corner...

you don't really need the threading.thread.sleep(10) in it, i used it to make it not lock up on me when im trying to generate the image
 

[Shaman]

Wanderer
biggy*2 ? wtf i mean cmon its only 1 pixel... not like 1 screen or so :x

and again, its the "simple" sollution, if you want to make it perfect (and the map rotated like the ingame map..) you need to make your own things to do so
 

[Shaman]

Wanderer
i know, but my app doesn't need to be accurate, it just needs to show the general area (even without a dot saying where he is), so its not needed here :)
 
Top