latest problem with the script
i tried adding an endstable just like the animaltrainer to see if it would help., Ironically, it removed the previous error without changing anything, but it gave a new one.
here is the updated script. can you look at it and tell me whats wrong? ty
i tried adding an endstable just like the animaltrainer to see if it would help., Ironically, it removed the previous error without changing anything, but it gave a new one.
Code:
RunUO - [www.runuo.com] Version 1.0.0, Build 36918
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
- Error: Scripts\Customs\montoyastable.cs: CS1518: (line 106, column 8) Expecte
d class, delegate, enum, interface, or struct
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
here is the updated script. can you look at it and tell me whats wrong? ty
Code:
using System;
using System.Collections;
using Server;
using Server.Items;
using Server.Mobiles;
using Server.Targeting;
using Server.ContextMenus;//not sure if i need these
using Server.Network;//not sure if i need these
namespace Server.Factions.Scripts.Commands
{
public class stableCommand
{
public static void Initialize()
{
Server.Commands.Register( "stable", AccessLevel.Player, new CommandEventHandler( stable_OnCommand ) );
}
public static void stable_OnCommand( CommandEventArgs e )
{
int m_stable;
Server.Commands.Register( "stable", AccessLevel.Player, new CommandEventHandler( stable_OnCommand ) );
}
public static void stable_OnCommand( CommandEventArgs e )
{
if(e.Length >= 1)
e.Mobile.Target = new stableTarget( e.GetInt32(0) );
}
public static int GetMaxstabled( Mobile from )
{
double taming = from.Skills[SkillName.AnimalTaming].Value;
double anlore = from.Skills[SkillName.AnimalLore].Value;
double vetern = from.Skills[SkillName.Veterinary].Value;
double sklsum = taming + anlore + vetern;
int max;
if ( sklsum >= 240.0 )
max = 5;
else if ( sklsum >= 200.0 )
max = 4;
else if ( sklsum >= 160.0 )
max = 3;
else
max = 2;
if ( taming >= 100.0 )
max += (int)((taming - 90.0) / 10);
if ( anlore >= 100.0 )
max += (int)((anlore - 90.0) / 10);
if ( vetern >= 100.0 )
max += (int)((vetern - 90.0) / 10);
return max;
}
private class stableTarget : Target
{
public stableTarget( int stable ) : base( -1, false, TargetFlags.None )
{
m_stable = stable;
}
protected override void OnTarget( Mobile from, object targeted )
{
if ( targeted is BaseCreature )
m_Trainer.Endstable( from, (BaseCreature)targeted );
else if ( targeted == from )
m_Trainer.SayTo( from, 502672 ); // HA HA HA! Sorry, I am not an inn.
else
m_Trainer.SayTo( from, 1048053 ); // You can't stable that!
}
}
public void Beginstable( Mobile from )
{
if ( Deleted || !from.CheckAlive() )
return;
if ( from.stabled.Count >= GetMaxstabled( from ) )
{
SayTo( from, 1042565 ); // You have too many pets in the stables!
}
else
{
SayTo( from, 1042558 ); /* I charge 30 gold per pet for a real week's stable time.
* I will withdraw it from thy bank account.
* Which animal wouldst thou like to stable here?
*/
from.Target = new stableTarget( this );
}
}
}
}
public void EndStable( Mobile from, BaseCreature pet )
{
if ( Deleted || !from.CheckAlive() )
return;
if ( !pet.Controled || pet.ControlMaster != from )
{
SayTo( from, 1042562 ); // You do not own that pet!
}
else if ( pet.IsDeadPet )
{
SayTo( from, 1049668 ); // Living pets only, please.
}
else if ( pet.Summoned )
{
SayTo( from, 502673 ); // I can not stable summoned creatures.
}
else if ( pet.Body.IsHuman )
{
SayTo( from, 502672 ); // HA HA HA! Sorry, I am not an inn.
}
else if ( (pet is PackLlama || pet is PackHorse || pet is Beetle) && (pet.Backpack != null && pet.Backpack.Items.Count > 0) )
{
SayTo( from, 1042563 ); // You need to unload your pet.
}
else if ( pet.Combatant != null && pet.InRange( pet.Combatant, 12 ) && pet.Map == pet.Combatant.Map )
{
SayTo( from, 1042564 ); // I'm sorry. Your pet seems to be busy.
}
else if ( from.Stabled.Count >= GetMaxStabled( from ) )
{
SayTo( from, 1042565 ); // You have too many pets in the stables!
}
else
{
Container bank = from.BankBox;
if ( bank != null && bank.ConsumeTotal( typeof( Gold ), 30 ) )
{
pet.ControlTarget = null;
pet.ControlOrder = OrderType.Stay;
pet.Internalize();
pet.SetControlMaster( null );
pet.SummonMaster = null;
pet.IsStabled = true;
from.Stabled.Add( pet );
SayTo( from, 502679 ); // Very well, thy pet is stabled. Thou mayst recover it by saying 'claim' to me. In one real world week, I shall sell it off if it is not claimed!
}
else
{
SayTo( from, 502677 ); // But thou hast not the funds in thy bank account!
}
}
}