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 )
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 )