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!

Sample Code?

megamandos

Wanderer
Sample Code?

Can someone write some sample code for this? For instance, can I give and Item Type number and get a string from it? etc...

Please?

Thx in advance.
 

Sixkillers

Sorceror
Here is little example how to obtain string from cliloc with Ultima SDK.
Code:
using Ultima;

private static readonly StringList list =  new StringList();

public string GetString(int number)
{[INDENT]
return  list.Table[number] as string;[/INDENT]
}

If the Cliloc entry doesn't exist method will return null. I hope it is what you want.
 

megamandos

Wanderer
Sixkillers;789588 said:
Here is little example how to obtain string from cliloc with Ultima SDK.
Code:
using Ultima;

private static readonly StringList list =  new StringList();

public string GetString(int number)
{[INDENT]
return  list.Table[number] as string;[/INDENT]
}

If the Cliloc entry doesn't exist method will return null. I hope it is what you want.

You are AWSOME! just needed to figure out the syntax! Thx.
 

megamandos

Wanderer
Ok, epic fail.

VB.NET

Code:
imports Ultima

Private ReadOnly CliLocStrings As New StringList()

Public Function GetString(byval Number as Integer) as String
     Return CliLocStrings.Table(Number).ToString
End Function

It wants me to specify a language for my new stringlist.

Code:
Private ReadOnly CliLocStrings As New StringList("english")

But when I try running that it comes up with the error: "Attempted to access a path that is not on the disk." from Ultima.

Any ideas?
 

megamandos

Wanderer
Jeff;789641 said:
StringList("ENU")

No go. Tried even copying the cliloc.enu file to the app debug directory.

EDIT: I figured it out. I was missing the registry values that the SDK looks for to locate my client exe path. I just manualy entered them using regedit and it started up like a charm!
 

megamandos

Wanderer
Is there a way to get a base item name from its base ID? like 3705 is "Pouch"?

Razor does it, and I am wondering if it is all programmed in or it is accessing form uo files or what...
 
it is getting it from the cliloc files

if you use the example they showed above (not the one for VB, but 1st example) that should get you the name of the item, if there is a name for it it in the clilocs, not all items have a name, specialy if you have added in your own art
 

megamandos

Wanderer
Another question... Can you convert basic hue picker hues to RGB values? i noticed that razor does it when you need to pick a color for spell speech text.
 

Irian

Page
You should know that a hue isn't just a color. It's a list of colors (otherwise, hueing an item would like pretty bad).

You can get a System.Drawing.Colors from a Hue - for example the first one from the list - by...

Code:
Hue hue = Ultima.Hues.List[<HueID>];
Color color = hue.getColor(0);
 

megamandos

Wanderer
Irian;789713 said:
You should know that a hue isn't just a color. It's a list of colors (otherwise, hueing an item would like pretty bad).

You can get a System.Drawing.Colors from a Hue - for example the first one from the list - by...

Code:
Hue hue = Ultima.Hues.List[<HueID>];
Color color = hue.getColor(0);

Yes, I knew that. And you gave me EXACTLY what I was looking for! Thanks!
 
Top