Go Back   RunUO - Ultima Online Emulation > RunUO > Custom Script Release Archive

Custom Script Release Archive This is a pre-script database archive of what our users had released.

 
 
Thread Tools Display Modes
Old 04-14-2006, 09:29 AM   #26 (permalink)
Forum Expert
 
Manu's Avatar
 
Join Date: Jul 2005
Location: München/Deutschland (Munich/Germany)
Age: 27
Posts: 1,948
Send a message via ICQ to Manu Send a message via Skype™ to Manu
Default

Ok, added the book with ".add static 4079", punched a ".set hue 1150" in and then used the Gen. This is the result:

Code:
/////////////////////////////////////////////////
//                                             //
// Automatically generated by the              //
// AddonGenerator script by Arya               //
//                                             //
/////////////////////////////////////////////////
using System;
using Server;
using Server.Items;

namespace Server.Items
{
	public class BookTestAddon : BaseAddon
	{
		public override BaseAddonDeed Deed
		{
			get
			{
				return new BookTestAddonDeed();
			}
		}

		[ Constructable ]
		public BookTestAddon()
		{
			AddComponent( new AddonComponent( 4079 ), 0, 0, 0 );
			AddonComponent ac;

		}

		public BookTestAddon( Serial serial ) : base( serial )
		{
		}

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );
			writer.Write( 0 ); // Version
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
		}
	}

	public class BookTestAddonDeed : BaseAddonDeed
	{
		public override BaseAddon Addon
		{
			get
			{
				return new BookTestAddon();
			}
		}

		[Constructable]
		public BookTestAddonDeed()
		{
			Name = "BookTest";
		}

		public BookTestAddonDeed( Serial serial ) : base( serial )
		{
		}

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );
			writer.Write( 0 ); // Version
		}

		public override void	Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
		}
	}
}
__________________
Tides of Magic
doc-chaos.dyndns.org - Status: Gathering ideas, working out the concept
Manu is offline  
Old 04-15-2006, 04:32 PM   #27 (permalink)
Forum Expert
 
Lucid Nagual's Avatar
 
Join Date: Nov 2004
Location: Beyond the Gates of Hell
Age: 37
Posts: 3,509
Smile Manu

I just created a book in game, changed the hue, and renamed it. I then saved it as an addon and here is the results:
Code:
/////////////////////////////////////////////////
// //
// Automatically generated by the //
// AddonGenerator script by Arya //
// //
/////////////////////////////////////////////////
using System;
using Server;
using Server.Items;
namespace Server.Items
{
public class MyTestBookAddon : BaseAddon
{
public override BaseAddonDeed Deed
{
get
{
return new MyTestBookAddonDeed();
}
}
[ Constructable ]
public MyTestBookAddon()
{
AddonComponent ac;
ac = new AddonComponent( 8786 );
ac.Hue = 11;
ac.Name = "My Title";
AddComponent( ac, 0, 0, 0 );
}
public MyTestBookAddon( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( 0 ); // Version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
public class MyTestBookAddonDeed : BaseAddonDeed
{
public override BaseAddon Addon
{
get
{
return new MyTestBookAddon();
}
}
[Constructable]
public MyTestBookAddonDeed()
{
Name = "MyTestBook";
}
public MyTestBookAddonDeed( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( 0 ); // Version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}
As you can see....it saved the hue and the name of the item. I'm not sure what you are doing wrong.
__________________
Leader of the Anti-OSI Movement. Inventing a new game experience in an EA Games-free environment.

Don Juan Matus "The basic difference between an ordinary man and a warrior is that a warrior takes everything as a challenge, while an ordinary man takes everything as a blessing or as a curse."


My Customs:
Lucid Nagual is offline  
Old 04-15-2006, 06:08 PM   #28 (permalink)
Forum Expert
 
Manu's Avatar
 
Join Date: Jul 2005
Location: München/Deutschland (Munich/Germany)
Age: 27
Posts: 1,948
Send a message via ICQ to Manu Send a message via Skype™ to Manu
Default

Did you create it as static, or normal item? Could you post me the script as it is on your test server (w/o the filepaths of course), so I can compare it with mine?
__________________
Tides of Magic
doc-chaos.dyndns.org - Status: Gathering ideas, working out the concept
Manu is offline  
Old 04-15-2006, 06:27 PM   #29 (permalink)
Forum Expert
 
Lucid Nagual's Avatar
 
Join Date: Nov 2004
Location: Beyond the Gates of Hell
Age: 37
Posts: 3,509
Default Manu

I created it as a static item then prop'd it to set my name and hue. Here is the script:
Attached Files
File Type: cs AddonGenerator.cs (13.2 KB, 20 views)
__________________
Leader of the Anti-OSI Movement. Inventing a new game experience in an EA Games-free environment.

Don Juan Matus "The basic difference between an ordinary man and a warrior is that a warrior takes everything as a challenge, while an ordinary man takes everything as a blessing or as a curse."


My Customs:
Lucid Nagual is offline  
Old 04-15-2006, 06:50 PM   #30 (permalink)
Forum Expert
 
Manu's Avatar
 
Join Date: Jul 2005
Location: München/Deutschland (Munich/Germany)
Age: 27
Posts: 1,948
Send a message via ICQ to Manu Send a message via Skype™ to Manu
Default

Ok, I figured it out. All the way my mistake. I enabled the "export statics" checkbox, cuz that allowed me to simply klick the items directy. But then it doesnt save name and hue. When only the "export items" checkbox is enabled you cannot click the items directly, but actually have to click the cornes of the area around the item, but then it saves hue and name.
Sorry for the trouble and thanks SO MUCH for your help!
__________________
Tides of Magic
doc-chaos.dyndns.org - Status: Gathering ideas, working out the concept
Manu is offline  
Old 04-15-2006, 07:18 PM   #31 (permalink)
Forum Expert
 
Lucid Nagual's Avatar
 
Join Date: Nov 2004
Location: Beyond the Gates of Hell
Age: 37
Posts: 3,509
Smile Manu

Quote:
Ok, I figured it out. All the way my mistake. I enabled the "export statics" checkbox, cuz that allowed me to simply klick the items directy. But then it doesnt save name and hue. When only the "export items" checkbox is enabled you cannot click the items directly, but actually have to click the cornes of the area around the item, but then it saves hue and name.
Sorry for the trouble and thanks SO MUCH for your help!
NP I'm glade you got it working
__________________
Leader of the Anti-OSI Movement. Inventing a new game experience in an EA Games-free environment.

Don Juan Matus "The basic difference between an ordinary man and a warrior is that a warrior takes everything as a challenge, while an ordinary man takes everything as a blessing or as a curse."


My Customs:
Lucid Nagual is offline  
Old 04-19-2006, 01:51 PM   #32 (permalink)
Account Terminated
 
Join Date: Oct 2005
Location: Louisiana
Age: 36
Posts: 247
Default

I've gotten some pretty bad bugs with the latest update. Can you locate where the problem might be?




Errors:


Code:
RunUO - [www.runuo.com] Version 1.0.0, Build 36918
Scripts: Compiling C# scripts...failed (19 errors, 0 warnings)
 - Error: Scripts\UOS-CORE13\4x4Addon.cs: CS1001: (line 13, column 15) Identifier expected
 - Error: Scripts\UOS-CORE13\4x4Addon.cs: CS1519: (line 13, column 24) Invalid token ':' in class, s
truct, or interface member declaration
 - Error: Scripts\UOS-CORE13\4x4Addon.cs: CS1519: (line 14, column 2) Invalid token '{' in class, st
ruct, or interface member declaration
 - Error: Scripts\UOS-CORE13\4x4Addon.cs: CS1031: (line 24, column 10) Type expected
 - Error: Scripts\UOS-CORE13\4x4Addon.cs: CS1520: (line 24, column 11) Class, struct, or interface m
ethod must have a return type
 - Error: Scripts\UOS-CORE13\4x4Addon.cs: CS1031: (line 57, column 10) Type expected
 - Error: Scripts\UOS-CORE13\4x4Addon.cs: CS1520: (line 57, column 11) Class, struct, or interface m
ethod must have a return type
 - Error: Scripts\UOS-CORE13\4x4Addon.cs: CS1002: (line 57, column 36) ; expected
 - Error: Scripts\UOS-CORE13\4x4Addon.cs: CS1519: (line 57, column 51) Invalid token ')' in class, s
truct, or interface member declaration
 - Error: Scripts\UOS-CORE13\4x4Addon.cs: CS1001: (line 74, column 15) Identifier expected
 - Error: Scripts\UOS-CORE13\4x4Addon.cs: CS1519: (line 74, column 28) Invalid token ':' in class, s
truct, or interface member declaration
 - Error: Scripts\UOS-CORE13\4x4Addon.cs: CS1519: (line 75, column 2) Invalid token '{' in class, st
ruct, or interface member declaration
 - Error: Scripts\UOS-CORE13\4x4Addon.cs: CS1031: (line 85, column 10) Type expected
 - Error: Scripts\UOS-CORE13\4x4Addon.cs: CS1520: (line 85, column 11) Class, struct, or interface m
ethod must have a return type
 - Error: Scripts\UOS-CORE13\4x4Addon.cs: CS1031: (line 90, column 10) Type expected
 - Error: Scripts\UOS-CORE13\4x4Addon.cs: CS1520: (line 90, column 11) Class, struct, or interface m
ethod must have a return type
 - Error: Scripts\UOS-CORE13\4x4Addon.cs: CS1002: (line 90, column 40) ; expected
 - Error: Scripts\UOS-CORE13\4x4Addon.cs: CS1519: (line 90, column 55) Invalid token ')' in class, s
truct, or interface member declaration
 - Error: Scripts\UOS-CORE13\4x4Addon.cs: CS0101: (line 74, column 9) The namespace 'Server.Items' a
lready contains a definition for '?'





The AddonGen.cs

Code:
using System;
using System.Collections;
using System.IO;
using Server;
using Server.Items;
using Server.Gumps;
 
namespace Arya.Misc
{
 public class AddonGenerator
 {
  /// <summary>
  /// Set this value if you wish the scripts to be output somewhere else rather than in the default RunUO\TheBox
  /// directory. This should be a full valid path on your computer
  /// 
  /// Example:
  /// 
  /// private static string m_CustomOutputDirector = @"C:\Program Files\RunUO\Scripts\Custom\Addons";
  /// </summary>
  private static string m_CustomOutputDirectory = null;
 
  #region Template
  private const string m_Template = @"/////////////////////////////////////////////////
//                                             //
// Automatically generated by the              //
// AddonGenerator script by Arya               //
//                                             //
/////////////////////////////////////////////////
using System;
using Server;
using Server.Items;
namespace {namespace}
{
 public class {name}Addon : BaseAddon
 {
  public override BaseAddonDeed Deed
  {
   get
   {
    return new {name}AddonDeed();
   }
  }
  [ Constructable ]
  public {name}Addon()
  {
{components}
  }
  public {name}Addon( Serial serial ) : base( serial )
  {
  }
  public override void Serialize( GenericWriter writer )
  {
   base.Serialize( writer );
   writer.Write( 0 ); // Version
  }
  public override void Deserialize( GenericReader reader )
  {
   base.Deserialize( reader );
   int version = reader.ReadInt();
  }
 }
 public class {name}AddonDeed : BaseAddonDeed
 {
  public override BaseAddon Addon
  {
   get
   {
    return new {name}Addon();
   }
  }
  [Constructable]
  public {name}AddonDeed()
  {
   Name = ""{name}"";
  }
  public {name}AddonDeed( Serial serial ) : base( serial )
  {
  }
  public override void Serialize( GenericWriter writer )
  {
   base.Serialize( writer );
   writer.Write( 0 ); // Version
  }
  public override void Deserialize( GenericReader reader )
  {
   base.Deserialize( reader );
   int version = reader.ReadInt();
  }
 }
}";
 
  #endregion
 
  public static void Initialize()
  {
   Server.Commands.Register( "AddonGen", AccessLevel.Administrator, new CommandEventHandler( OnAddonGen ) );
  }
 
  [ Usage( "AddonGen [<name> [namespace]]"),
   Description( "Brings up the addon script generator gump. When used with the name (and eventually namespace) parameter generates an addon script from the targeted region.") ]
  private static void OnAddonGen( CommandEventArgs e )
  {
   //
   // State object:
   // 0: Name
   // 1: Namespace (Server.Items)
   // 2: Items (true)
   // 3: Statics (false)
   // 4: Use range (false)
   // 5: Min Z (-128)
   // 6: Max Z (127)
 
   object[] state = new object[ 7 ];
 
   state[ 0 ] = "";
   state[ 1 ] = "Server.Items";
   state[ 2 ] = true;
   state[ 3 ] = false;
   state[ 4 ] = false;
   state[ 5 ] = -128;
   state[ 6 ] = 127;
 
   if ( e.Arguments.Length > 0 )
   {
    state[ 0 ] = e.Arguments[ 0 ];
 
    if ( e.Arguments.Length > 1 )
    {
     state[ 1 ] = e.Arguments[ 1 ];
    }
 
    BoundingBoxPicker.Begin( e.Mobile, new BoundingBoxCallback( PickerCallback ), state );
   }
   else
   {
    // Send gump
    e.Mobile.SendGump( new InternalGump( e.Mobile, state ) );
   }
  }
 
  private static void PickerCallback( Mobile from, Map map, Point3D start, Point3D end, object state )
  {
   object[] args = state as object[];
 
   if ( start.X > end.X )
   {
    int x = start.X;
    start.X = end.X;
    end.X = x;
   }
 
   if ( start.Y > end.Y )
   {
    int y = start.Y;
    start.Y = end.Y;
    end.Y = y;
   }
 
   Rectangle2D bounds = new Rectangle2D( start, end );
 
   string name = args[ 0 ] as string;
   string ns = args[ 1 ] as string;
 
   bool items = (bool) args[ 2 ];
   bool statics = (bool) args[ 3 ];
   bool range = (bool) args[ 4 ];
 
   sbyte min = sbyte.MinValue;
   sbyte max = sbyte.MaxValue;
 
   try { min = sbyte.Parse( args[ 5 ] as string ); }
   catch {}
   try { max = sbyte.Parse( args[ 6 ] as string ); }
   catch {}
 
   if ( max < min )
   {
    sbyte temp = max;
    max = min;
    min = temp;
   }
 
   Hashtable tiles = new Hashtable();
 
   if ( statics )
   {
    for ( int x = start.X; x <= end.X; x++ )
    {
     for ( int y = start.Y; y <= end.Y; y++ )
     {
      ArrayList list = map.GetTilesAt( new Point2D( x, y ), items, false, statics );
 
      if ( range )
      {
       ArrayList remove = new ArrayList();
 
       foreach ( Tile t in list )
       {
        if ( t.Z < min || t.Z > max )
         remove.Add( t );
       }
 
       foreach( Tile t in remove )
        list.Remove( t );
      }
 
      if ( list != null && list.Count > 0 )
      {
       tiles[ new Point2D( x, y ) ] = list;
      }
     }
    }
   }
 
   IPooledEnumerable en = map.GetItemsInBounds( bounds );
   ArrayList target = new ArrayList();
   bool fail = false;
 
   try
   {
    foreach( object o in en )
    {
     Static s = o as Static;
 
     if ( s == null )
      continue;
 
     if ( range && ( s.Z < min || s.Z > max ) )
      continue;
 
     target.Add( o );
    }
   }
   catch ( Exception err )
   {
    Console.WriteLine( err.ToString() );
    from.SendMessage( 0x40, "The targeted items have been modified. Please retry." );
    fail = true;
   }
   finally
   {
    en.Free();
   }
 
   if ( fail )
    return;
 
   if ( target.Count == 0 && tiles.Keys.Count == 0 )
   {
    from.SendMessage( 0x40, "No items have been selected" );
    return;
   }
 
   // Get center
   Point3D center = new Point3D();
   center.Z = 127;
 
   int x1 = bounds.End.X;
   int y1 = bounds.End.Y;
   int x2 = bounds.Start.X;
   int y2 = bounds.Start.Y;
 
   // Get correct bounds
   foreach( Static item in target )
   {
    if ( item.Z < center.Z )
    {
     center.Z = item.Z;
    }
 
    x1 = Math.Min( x1, item.X );
    y1 = Math.Min( y1, item.Y );
    x2 = Math.Max( x2, item.X );
    y2 = Math.Max( y2, item.Y );
   }
 
   foreach( Point2D p in tiles.Keys )
   {
    ArrayList list = tiles[ p ] as ArrayList;
 
    foreach( Tile t in list )
    {
     if ( t.Z < center.Z )
     {
      center.Z = t.Z;
     }
    }
 
    x1 = Math.Min( x1, p.X );
    y1 = Math.Min( y1, p.Y );
    x2 = Math.Max( x2, p.X );
    y2 = Math.Max( y2, p.Y );
   }
 
   center.X = x1 + ( ( x2 - x1 ) / 2 );
   center.Y = y1 + ( ( y2 - y1 ) / 2 );
 
   // Build items
   System.Text.StringBuilder sb = new System.Text.StringBuilder();
 
   // Statics
   foreach( Point2D p in tiles.Keys )
   {
    ArrayList list = tiles[ p ] as ArrayList;
 
    int xOffset = p.X - center.X;
    int yOffset = p.Y - center.Y;
 
    foreach( Tile t in list )
    {
     int zOffset = t.Z - center.Z;
     int id = t.ID - 16384;
 
     sb.AppendFormat( "\t\t\tAddComponent( new AddonComponent( {0} ), {1}, {2}, {3} );\n", id, xOffset, yOffset, zOffset );
    }
   }
 
   sb.AppendFormat( "\t\t\tAddonComponent ac;\n" );
 
   foreach( Static item in target )
   {
    int xOffset = item.X - center.X;
    int yOffset = item.Y - center.Y;
    int zOffset = item.Z - center.Z;
    int id = item.ItemID;
 
    sb.AppendFormat( "\t\t\tac = new AddonComponent( {0} );\n", item.ItemID );
 
    if ( ( item.ItemData.Flags & TileFlag.LightSource ) == TileFlag.LightSource )
    {
     sb.AppendFormat( "\t\t\tac.Light = LightType.{0};\n", item.Light.ToString() );
    }
 
    if ( item.Hue != 0 )
    {
     sb.AppendFormat( "\t\t\tac.Hue = {0};\n", item.Hue );
    }
    if ( item.Name != null )
    {
     sb.AppendFormat( "\t\t\tac.Name = \"{0}\";\n", item.Name );
    }
 
    sb.AppendFormat( "\t\t\tAddComponent( ac, {0}, {1}, {2} );\n", xOffset, yOffset, zOffset );
   }
 
   string output = m_Template.Replace( "{name}", name );
   output = output.Replace( "{namespace}", ns );
   output = output.Replace( "{components}", sb.ToString() );
 
   StreamWriter writer = null;
   string path = null;
 
   if ( m_CustomOutputDirectory != null )
    path = Path.Combine( m_CustomOutputDirectory, string.Format( @"TheBox\{0}Addon.cs", name ) );
   else
    path = Path.Combine( Core.BaseDirectory, string.Format( @"TheBox\{0}Addon.cs", name ) );
 
   fail = false;
 
   try
   {
    string folder = Path.GetDirectoryName( path );
 
    if ( ! Directory.Exists( folder ) )
    {
     Directory.CreateDirectory( folder );
    }
 
    writer = new StreamWriter( path, false );
    writer.Write( output );
   }
   catch
   {
    from.SendMessage( 0x40, "An error occurred when writing the file." );
    fail = true;
   }
   finally
   {
    if ( writer != null )
     writer.Close();
   }
 
   if ( ! fail )
   {
    from.SendMessage( 0x40, "Script saved to {0}", path );
   }
  }
 
 
  #region Gump
  private class InternalGump : Gump
  {
   private const int LabelHue = 0x480;
   private const int GreenHue = 0x40;
   private object[] m_State;
 
   public InternalGump( Mobile m, object[] state ) : base( 100, 50 )
   {
    m.CloseGump( typeof( InternalGump ) );
    m_State = state;
    MakeGump();
   }
 
   private void MakeGump()
   {
    this.Closable=true;
    this.Disposable=true;
    this.Dragable=true;
    this.Resizable=false;
    this.AddPage(0);
    this.AddBackground(0, 0, 280, 225, 9270);
    this.AddAlphaRegion(10, 10, 260, 205);
    this.AddLabel(64, 15, GreenHue, @"Addon Script Generator");
    this.AddLabel(20, 40, LabelHue, @"Name");
    this.AddImageTiled(95, 55, 165, 1, 9304);
 
    // Name: 0
    this.AddTextEntry(95, 35, 165, 20, LabelHue, 0, m_State[ 0 ] as string );
 
    this.AddLabel(20, 60, LabelHue, @"Namespace");
    this.AddImageTiled(95, 75, 165, 1, 9304);
 
    // Namespace: 1
    this.AddTextEntry(95, 55, 165, 20, LabelHue, 1, m_State[ 1 ] as string );
 
    // Items: Check 0
    this.AddCheck(20, 85, 2510, 2511, ((bool) m_State[2]), 0);
    this.AddLabel(40, 85, LabelHue, @"Export Items");
 
    // Statics: Check 1
    this.AddCheck(20, 110, 2510, 2511, ((bool) m_State[3]), 1);
    this.AddLabel(40, 110, LabelHue, @"Export Statics");
 
    // Range: Check 2
    this.AddCheck(20, 135, 2510, 2511, ((bool) m_State[4]), 2);
    this.AddLabel(40, 135, LabelHue, @"Specify Z Range");
 
    // Min Z: Text 2
    this.AddLabel(50, 160, LabelHue, @"min.");
    this.AddImageTiled(85, 175, 60, 1, 9304);
    this.AddTextEntry(85, 155, 60, 20, LabelHue, 2, m_State[5].ToString() );
 
    // Max Z: Text 3
    this.AddLabel(160, 160, LabelHue, @"max.");
    this.AddImageTiled(200, 175, 60, 1, 9304);
    this.AddTextEntry(200, 155, 60, 20, LabelHue, 3, m_State[6].ToString());
 
    // Cancel: B0
    this.AddButton(20, 185, 4020, 4021, 0, GumpButtonType.Reply, 0);
    this.AddLabel(55, 185, LabelHue, @"Cancel");
 
    // Generate: B1
    this.AddButton(155, 185, 4005, 4006, 1, GumpButtonType.Reply, 0);
    this.AddLabel(195, 185, LabelHue, @"Generate");
   }
 
   public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
   {
    if ( info.ButtonID == 0 )
     return;
 
    foreach( TextRelay text in info.TextEntries )
    {
     switch ( text.EntryID )
     {
      case 0: // Name, 0
 
       m_State[ 0 ] = text.Text;
 
       break;
 
      case 1: // Namespace, 1
 
       m_State[ 1 ] = text.Text;
 
       break;
 
      case 2: // Min Z, 5
 
       m_State[ 5 ] = text.Text;
 
       break;
 
      case 3: // Max Z, 6
 
       m_State[ 6 ] = text.Text;
 
       break;
     }
    }
 
    // Reset checks
    m_State[ 2 ] = false;
    m_State[ 3 ] = false;
    m_State[ 4 ] = false;
 
    foreach( int check in info.Switches )
    {
     m_State[ check + 2 ] = true; // Offset by 2 in the state object
    }
 
    if ( Verify( m_State ) )
    {
     BoundingBoxPicker.Begin( sender.Mobile, new BoundingBoxCallback( AddonGenerator.PickerCallback ), m_State );
    }
    else
    {
     sender.Mobile.SendMessage( 0x40, "Please review the generation parameters, some are invalid." );
     sender.Mobile.SendGump( new InternalGump( sender.Mobile, m_State ) );
    }
   }
 
   private static bool Verify( object[] state )
   {
    if ( state[ 0 ] == null || ( state[ 0 ] as string ).Length == 0 )
     return false;
 
    if ( state[ 1 ] == null || ( state[ 1 ] as string ).Length == 0 )
     return false;
 
    bool items = (bool) state[ 2 ];
    bool statics = (bool) state[ 3 ];
    bool range = (bool) state[ 4 ];
    sbyte min = sbyte.MaxValue;
    sbyte max = sbyte.MinValue;
    bool fail = false;
 
    try
    {
     min = sbyte.Parse( state[ 5 ] as string );
    }
    catch { fail = true; }
 
    try
    {
     max = sbyte.Parse( state[ 6 ] as string );
    }
    catch { fail = true; }
 
    if ( ! ( items || statics ) )
     return false;
 
    if ( range && fail )
     return false;
 
    return true;
   }
  }
  #endregion
 }
}



My Addon Made With The AddonGen:

Code:
/////////////////////////////////////////////////
//                                             //
// Automatically generated by the              //
// AddonGenerator script by Arya               //
//                                             //
/////////////////////////////////////////////////
using System;
using Server;
using Server.Items;
namespace Server.Items
{
 public class 4x4Addon : BaseAddon
 {
  public override BaseAddonDeed Deed
  {
   get
   {
    return new 4x4AddonDeed();
   }
  }
  [ Constructable ]
  public 4x4Addon()
  {
   AddonComponent ac;
   ac = new AddonComponent( 1298 );
   ac.Hue = 1234;
   AddComponent( ac, -1, 1, 0 );
   ac = new AddonComponent( 1298 );
   ac.Hue = 1046;
   AddComponent( ac, -1, 0, 0 );
   ac = new AddonComponent( 1298 );
   ac.Hue = 1234;
   AddComponent( ac, -1, -1, 0 );
   ac = new AddonComponent( 1298 );
   ac.Hue = 1046;
   AddComponent( ac, 0, -1, 0 );
   ac = new AddonComponent( 1298 );
   ac.Hue = 1234;
   AddComponent( ac, 0, 0, 0 );
   ac = new AddonComponent( 1298 );
   ac.Hue = 1046;
   AddComponent( ac, 0, 1, 0 );
   ac = new AddonComponent( 1298 );
   ac.Hue = 1234;
   AddComponent( ac, 1, -1, 0 );
   ac = new AddonComponent( 1298 );
   ac.Hue = 1046;
   AddComponent( ac, 1, 0, 0 );
   ac = new AddonComponent( 1298 );
   ac.Hue = 1234;
   AddComponent( ac, 1, 1, 0 );
  }
  public 4x4Addon( Serial serial ) : base( serial )
  {
  }
  public override void Serialize( GenericWriter writer )
  {
   base.Serialize( writer );
   writer.Write( 0 ); // Version
  }
  public override void Deserialize( GenericReader reader )
  {
   base.Deserialize( reader );
   int version = reader.ReadInt();
  }
 }
 public class 4x4AddonDeed : BaseAddonDeed
 {
  public override BaseAddon Addon
  {
   get
   {
    return new 4x4Addon();
   }
  }
  [Constructable]
  public 4x4AddonDeed()
  {
   Name = "4x4";
  }
  public 4x4AddonDeed( Serial serial ) : base( serial )
  {
  }
  public override void Serialize( GenericWriter writer )
  {
   base.Serialize( writer );
   writer.Write( 0 ); // Version
  }
  public override void Deserialize( GenericReader reader )
  {
   base.Deserialize( reader );
   int version = reader.ReadInt();
  }
 }
}
Arcanus is offline  
Old 04-20-2006, 02:53 AM   #33 (permalink)
Forum Expert
 
Manu's Avatar
 
Join Date: Jul 2005
Location: München/Deutschland (Munich/Germany)
Age: 27
Posts: 1,948
Send a message via ICQ to Manu Send a message via Skype™ to Manu
Default

I think it doesnt like Addons with names that start with a number. I tried and switched everything from "4x4Addon" to "Test4x4Addon" and that compiled and worked.

Side-Note: its not 4x4, its only 3x3
__________________
Tides of Magic
doc-chaos.dyndns.org - Status: Gathering ideas, working out the concept
Manu is offline  
Old 04-20-2006, 03:04 AM   #34 (permalink)
Forum Expert
 
Lucid Nagual's Avatar
 
Join Date: Nov 2004
Location: Beyond the Gates of Hell
Age: 37
Posts: 3,509
Smile Arcanus

Quote:
I think it doesnt like Addons with names that start with a number. I tried and switched everything from "4x4Addon" to "Test4x4Addon" and that compiled and worked.

Side-Note: its not 4x4, its only 3x3
I've never used numbers before And have no idea how to fix that at this point in time.
__________________
Leader of the Anti-OSI Movement. Inventing a new game experience in an EA Games-free environment.

Don Juan Matus "The basic difference between an ordinary man and a warrior is that a warrior takes everything as a challenge, while an ordinary man takes everything as a blessing or as a curse."


My Customs:
Lucid Nagual is offline  
Old 04-20-2006, 03:44 AM   #35 (permalink)
Forum Expert
 
Manu's Avatar
 
Join Date: Jul 2005
Location: München/Deutschland (Munich/Germany)
Age: 27
Posts: 1,948
Send a message via ICQ to Manu Send a message via Skype™ to Manu
Default

For now I guess a warning in the readme and maybe the GUMP should be enough I guess one could include a check of the keyed in name and if it starts with [Number] replace that with SG[Number]. Or just change the naming, so it always puts SG as a prefix to the name of the addon... just some random thoughts...
__________________
Tides of Magic
doc-chaos.dyndns.org - Status: Gathering ideas, working out the concept

Last edited by Manu; 04-20-2006 at 03:47 AM.
Manu is offline  
Old 04-20-2006, 04:32 AM   #36 (permalink)
Forum Expert
 
Lucid Nagual's Avatar
 
Join Date: Nov 2004
Location: Beyond the Gates of Hell
Age: 37
Posts: 3,509
Thumbs up Manu

Quote:
For now I guess a warning in the readme and maybe the GUMP should be enough I guess one could include a check of the keyed in name and if it starts with [Number] replace that with SG[Number]. Or just change the naming, so it always puts SG as a prefix to the name of the addon... just some random thoughts...
Excellent Idea. I will add a prefix for now, cause I don't know how to do a check for an integer or string and have to change the type
__________________
Leader of the Anti-OSI Movement. Inventing a new game experience in an EA Games-free environment.

Don Juan Matus "The basic difference between an ordinary man and a warrior is that a warrior takes everything as a challenge, while an ordinary man takes everything as a blessing or as a curse."


My Customs:
Lucid Nagual is offline  
Old 04-20-2006, 04:39 AM   #37 (permalink)
Forum Expert
 
Lucid Nagual's Avatar
 
Join Date: Nov 2004
Location: Beyond the Gates of Hell
Age: 37
Posts: 3,509
Exclamation Attention:

Updated!
Fixed name (int / string) issue.
__________________
Leader of the Anti-OSI Movement. Inventing a new game experience in an EA Games-free environment.

Don Juan Matus "The basic difference between an ordinary man and a warrior is that a warrior takes everything as a challenge, while an ordinary man takes everything as a blessing or as a curse."


My Customs:
Lucid Nagual is offline  
Old 04-20-2006, 06:04 AM   #38 (permalink)
Forum Expert
 
Manu's Avatar
 
Join Date: Jul 2005
Location: München/Deutschland (Munich/Germany)
Age: 27
Posts: 1,948
Send a message via ICQ to Manu Send a message via Skype™ to Manu
Default

Weeeeee, my thoughts made sense for a change

Glad I could help
__________________
Tides of Magic
doc-chaos.dyndns.org - Status: Gathering ideas, working out the concept
Manu is offline  
Old 04-20-2006, 07:51 PM   #39 (permalink)
Account Terminated
 
Join Date: Oct 2005
Location: Louisiana
Age: 36
Posts: 247
Default

The 3x3 was a test file while showing one of my staff how to use it The object was initially 4x4.


That was one of 2 files though. The other actually started with an M. But of course, there were other characters in there"()". I didnt think about that though, so I'll revert to the latest available and see if it works (I reverted back to the original ).


Thanx for the help guys. If it's still goes strange, I'll let cha know.

And many thanx for the update Lucid. I cream everytime I see something new come out by you, in this case, even if it's a remake of an old script. You guys are my hero's. Really
Arcanus is offline  
Old 05-20-2006, 11:58 PM   #40 (permalink)
Forum Novice
 
Join Date: Oct 2003
Age: 35
Posts: 101
Send a message via Yahoo to timothyisreal
Exclamation ok i have a small problem

/////////////////////////////////////////////////
// //
// Automatically generated by the //
// AddonGenerator script by Arya //
// //
/////////////////////////////////////////////////
using System;
using Server;
using Server.Items;

namespace Server.Items
{
public class AG_bigscreentvAddon : BaseAddon
{
public override BaseAddonDeed Deed
{
get
{
return new AG_bigscreentvAddonDeed();
}
}

[ Constructable ]
public AG_bigscreentvAddon()
{
AddComponent( new AddonComponent( 2717 ), -1, 0, 0 );
AddComponent( new AddonComponent( 2717 ), 1, 0, 0 );
AddComponent( new AddonComponent( 6742 ), 1, 0, 8 );
AddComponent( new AddonComponent( 2717 ), 0, 0, 0 );
AddComponent( new AddonComponent( 6742 ), 0, 0, 8 );
AddonComponent ac;

}

public AG_bigscreentvAddon( Serial serial ) : base( serial )
{
}

public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( 0 ); // Version
}

public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}

public class AG_bigscreentvAddonDeed : BaseAddonDeed
{
public override BaseAddon Addon
{
get
{
return new AG_bigscreentvAddon();
}
}

[Constructable]
public AG_bigscreentvAddonDeed()
{
Name = "AG_bigscreentv";
}

public AG_bigscreentvAddonDeed( Serial serial ) : base( serial )
{
}

public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( 0 ); // Version
}

public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}


I use add the empty bookshelf static hued black via pandys box, and renamed them. then i added static 6742 2 times for the screen,and moved them into place then renamed them. I used the generator targeted both sides. Problem is, it saves the parts just fine but, it wont save the new hues or names. I may be doing something wrong or not doing enough. Can you help me out?
__________________
life sucks thats why we have UO ;) :eek:
timothyisreal is offline  
Old 05-21-2006, 01:25 PM   #41 (permalink)
Forum Novice
 
Join Date: May 2005
Age: 36
Posts: 222
Default

THANK YOU for updating and fixing this script Lucid! A lot of us idiots (like me) who don't really know how to script, but preffer to make addons use this script, and we appreciate it! This script as everyone well knows is also great for moving structures from 1 location to another. Great work.
seanandre is offline  
Old 06-01-2006, 05:09 AM   #42 (permalink)
Forum Newbie
 
LindyLou's Avatar
 
Join Date: Nov 2003
Location: The Great Northwest
Posts: 24
Send a message via ICQ to LindyLou Send a message via Yahoo to LindyLou
Default Still have Issues with Names and Hues

I will post the script here so that maybe you can tell what we are doing wrong. I downloaded the latest version you have posted of the addongen. I wanted the statues and brambles all hued 2101but the steps to remain original 0 hue. I didn't rename any on this one but on others I have and they didn't retain names or colors. All help is appreciated as we are novices at this sort of thing. Thanks in advance.

/////////////////////////////////////////////////
// //
// Automatically generated by the //
// AddonGenerator script by Arya //
// //
/////////////////////////////////////////////////
using
System;
using Server;
using Server.Items;
namespace Server.Items
{
public class AG_InvasionStatueAddon : BaseAddon
{
public override BaseAddonDeed Deed
{
get
{
return new AG_InvasionStatueAddonDeed();
}
}
[
Constructable ]
public AG_InvasionStatueAddon()
{
AddComponent( new AddonComponent( 2328 ), 1, 1, 0 );
AddComponent( new AddonComponent( 3391 ), 1, 1, 3 );
AddComponent( new AddonComponent( 8441 ), 1, 1, 8 );
AddComponent( new AddonComponent( 2328 ), 0, 1, 0 );
AddComponent( new AddonComponent( 8396 ), 0, 1, 0 );
AddComponent( new AddonComponent( 2328 ), 0, 0, 0 );
AddComponent( new AddonComponent( 8452 ), 0, 0, 3 );
AddComponent( new AddonComponent( 3392 ), 0, 0, 0 );
AddComponent( new AddonComponent( 2328 ), 1, 0, 0 );
AddComponent( new AddonComponent( 8395 ), 1, 0, 0 );
AddonComponent ac;
ac = new AddonComponent( 2328 );
AddComponent( ac, 0, 0, 0 );
ac = new AddonComponent( 8452 );