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!

Scripting questions

Furio

Wanderer
Scripting questions

Uhmmm after Begging I'll trying to write some commands and other skills... so... is present any method like GetProprByName(string sName) ?

If i write ((Mobile) targeted).GetPropByName("str") I'll get the same of ((Mobile) targeted).Str

I'm asking this because I'm writing [show command (like in Sphere) but I'm writing it using if and .Equals()
[code:1]
private static void Show_OnCommand( CommandEventArgs e )
{
if (e.Length > 0)
{
e.Mobile.Target = new ShowTarget ( e.GetString( 0 ) );
}
else
{
e.Mobile.SendMessage( "Format: Show <props>" );
}
}

private class ShowTarget : Target
{
private string stProps;

public ShowTarget( string eProps ) : base( -1, false, TargetFlags.None )
{
stProps = eProps.ToLower();
}

protected override void OnTarget( Mobile from, object targeted )
{
if ( targeted is Item )
{
if (stProps.Equals("serial"))
{
from.SendMessage( "{0} is {1}", stProps, ((Item)targeted).Serial);
}
}
else if ( targeted is Mobile )
{
if ((stProps.Equals("access level")) || (stProps.Equals("plevel")))
{
from.SendMessage( "Property {0} for {1} is {2} ", stProps, ((Mobile)targeted).Name, ((Mobile)targeted).AccessLevel);
}
else if (stProps.Equals("page notify"))
{
from.SendMessage( "Property {0} for {1} is {2} ", stProps, ((Mobile)targeted).Name, ((Mobile)targeted).AutoPageNotify);
}
else if (stProps.Equals("blessed"))
{
from.SendMessage( "Property {0} for {1} is {2} ", stProps, ((Mobile)targeted).Name, ((Mobile)targeted).Blessed);
}
else if (stProps.Equals("body"))
{
from.SendMessage( "Property {0} for {1} is {2} ", stProps, ((Mobile)targeted).Name, ((Mobile)targeted).Body);
}
[/code:1]

ecc... ecc... ecc...


Uhm the other questions are:

- In [props to change the props there is a textentry... how can i call it? AddTextEntry ? (edit: I read now the reference... eheheh )
- The gumps like the one that change tha Access Level is a standard type like in Sphere?
- The skill raise is hardcoded? (because I haven't seen any commands only the CheckSkill)
- Uhmmm there is a method to check if an item is near me?


Thx all :) (The emu is great, I'm waiting for the next release :) )
 

krrios

Administrator
Why not use the existing [get command? You can do [get Str, [get Serial, [get AccessLevel, and so forth.

Yes, AddTextEntry( int x, int y, int width, int height, int hue, int entryID, string initialText ).

Enumerations (like AccessLevel) are changed through a the Menu interface. (Check Server.Menus.Questions.QuestionMenu)

Currently the skill gain algorithm is hardcoded. I'll work on adding an event hook into that function.

You can use:

[code:1]foreach ( Item item in somePerson.Map.GetItemsInRange( somePerson.Location ) )
{
// Do something with <item> here.
}[/code:1]
 

Furio

Wanderer
krrios said:
Why not use the existing [get command? You can do [get Str, [get Serial, [get AccessLevel, and so forth.

Yes... i'm writing it only for exercise ^^

Thanks for the answers :)
 
A

AlejandroX

Guest
I just want to use this thread as an excuse to tell everyone how exciting it is to have so many people interested in scripting and programing for RunUO. If this level of support continues I think the end product will 0wn osi's nub a$$
 
Top