Full Version : Help got error on svn 122
xmlspawner >>Troubleshooting >>Help got error on svn 122


<< Prev | Next >>

Erica- 12-28-2006
Hi for some reason i get this error after updating to 122 heres the error
CODE
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
Errors:
+ Multis/HouseFoundation.cs:
   CS0305: Line 2382: Using the generic type 'System.Collections.Generic.Queue<
T>' requires '1' type arguments
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
I know it has to do with HouseFoundation script but dont know why i get this error can you please tell me what i need to fix to get this working thanks .

Erica- 12-28-2006
Nvm the first error they fixed that but now since they changed some scripts to 124 svn i get this error
CODE
RunUO - [www.runuo.com] Version 2.0, Build 2553.23365
Core: Running on .NET Framework Version 2.0.50727
Core: Optimizing for 2 processors
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
Errors:
+ Custom Scripts 2.0/CarpetAddons/CarpetAddonDeed.cs:
   CS1502: Line 144: The best overloaded method match for 'Server.Items.BaseAdd
on.CouldFit(Server.IPoint3D, Server.Map, Server.Mobile, ref Server.Multis.BaseHo
use)' has some invalid arguments
   CS1503: Line 144: Argument '4': cannot convert from 'ref System.Collections.
Generic.List<Server.Multis.BaseHouse>' to 'ref Server.Multis.BaseHouse'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
and heres the carpetaddondeed script
CODE
using System;
using System.Collections.Generic;
using Server;
using Server.Gumps;
using Server.Items;
using Server.Network;
using Server.Multis;
using Server.Targeting;

namespace Server.Items
{
public class CarpetAddonDeed : BaseAddonDeed
{
 public override BaseAddon Addon{ get{ return null; } }
 
 [Constructable]
 public CarpetAddonDeed()
 {
  Name = "carpet deed";
 }

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

 public override void OnDoubleClick( Mobile from )
 {
  if ( IsChildOf( from.Backpack ) )
   BoundingBoxPicker.Begin( from, new BoundingBoxCallback( BoundingBox_Callback ), null );
  else
   from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
 }
 
 private void BoundingBox_Callback( Mobile from, Map map, Point3D start, Point3D end, object state )
 {
  IPoint3D p = start as IPoint3D;

  if ( p == null || map == null )
   return;
 
  int width = (end.X - start.X), height = (end.Y - start.Y);
 
  if ( width < 2 || height < 2 )
   from.SendMessage( "The bounding targets must be at least a 3x3 box." );
  else if ( IsChildOf( from.Backpack ) )
   from.SendGump( new CarpetGump( this, p, map, width, height ) );
  else
   from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
 }

 public override void Serialize( GenericWriter writer )
 {
  base.Serialize( writer );

  writer.Write( (int) 0 ); // version
 }

 public override void Deserialize( GenericReader reader )
 {
  base.Deserialize( reader );

  int version = reader.ReadInt();
 }
}
}

namespace Server.Gumps
{
public class CarpetGump : Gump
{
 private const int EntryCount = 3;
 
 private BaseAddonDeed m_Deed;
 private IPoint3D m_P3D;
 private Map m_Map;
 private int m_Width;
 private int m_Height;
 
 public CarpetGump( BaseAddonDeed deed, IPoint3D p, Map map, int width, int height ) : base( 30, 30 )
 {
  m_Deed = deed;
  m_P3D = p;
  m_Map = map;
  m_Width = width;
  m_Height = height;
 
  AddPage( 0 );
 
  AddBackground( 0, 0, 450, 180, 9200 );
 
  AddAlphaRegion( 12, 12, 381, 22 );
  AddHtml( 13, 13, 379, 20, "<BASEFONT COLOR=WHITE>Choose a carpet type</BASEFONT>", false, false );
 
  AddAlphaRegion( 398, 12, 40, 22 );
  AddAlphaRegion( 12, 39, 426, 129 );
 
  AddImage( 400, 16, 9766 );
  AddImage( 420, 16, 9762 );
  AddPage( 1 );

  int page = 1;
 
  for ( int i = 0, index = 0; i < CarpetInfo.Infos.Length; ++i, ++index )
  {
   if ( index >= EntryCount )
   {
    if ( (EntryCount * page) == EntryCount )
     AddImage( 400, 16, 0x2626 );
   
    AddButton( 420, 16, 0x15E1, 0x15E5, 0, GumpButtonType.Page, page + 1 );

    ++page;
    index = 0;

    AddPage( page );

    AddButton( 400, 16, 0x15E3, 0x15E7, 0, GumpButtonType.Page, page - 1 );

    if ( (CarpetInfo.Infos.Length - (EntryCount * page)) < EntryCount )
     AddImage( 420, 16, 0x2622 );
   }
   
   CarpetInfo info = CarpetInfo.GetInfo( i );
   
   for ( int j = 0; j < info.Entries.Length; ++j )
    AddItem( 20 + (index * 140 ) + info.Entries[j].OffsetX, 46 + info.Entries[j].OffsetY, info.Entries[j].ItemID );

   AddButton( 20 + (index * 140 ), 46, 1209, 1210, i+1, GumpButtonType.Reply, 0);
  }
 }

 public override void OnResponse( NetState sender, RelayInfo info )
 {
  Mobile from  = sender.Mobile;
 
  if ( info.ButtonID >= 1 )
  {
   BaseAddon addon = new CarpetAddon( info.ButtonID-1, m_Width, m_Height );

   Server.Spells.SpellHelper.GetSurfaceTop( ref m_P3D );

   List<BaseHouse> houses = new List<BaseHouse>();

   AddonFitResult res = addon.CouldFit( m_P3D, m_Map, from, ref houses );

   if ( res == AddonFitResult.Valid )
    addon.MoveToWorld( new Point3D( m_P3D ), m_Map );
   else if ( res == AddonFitResult.Blocked )
    from.SendLocalizedMessage( 500269 ); // You cannot build that there.
   else if ( res == AddonFitResult.NotInHouse )
    from.SendLocalizedMessage( 500274 ); // You can only place this in a house that you own!
   else if ( res == AddonFitResult.DoorsNotClosed )
    from.SendMessage( "You must close all house doors before placing this." );
   
   if ( res == AddonFitResult.Valid )
   {
    m_Deed.Delete();

    if ( houses != null )
    {
     foreach ( Server.Multis.BaseHouse h in houses )
      h.Addons.Add( addon );
    }
   }
   else
   {
    addon.Delete();
   }
  }
 }
}
}
what do i need to change here thanks.

ArteGordon- 12-29-2006
you need to change this

CODE

List<BaseHouse> houses = new List<BaseHouse>();

AddonFitResult res = addon.CouldFit( m_P3D, m_Map, from, ref houses );



to this

CODE

BaseHouse house = null;

AddonFitResult res = addon.CouldFit( m_P3D, m_Map, from, ref house );


and you will also need to change this

CODE

if ( houses != null )
   {
    foreach ( Server.Multis.BaseHouse h in houses )
     h.Addons.Add( addon );
   }


to this

CODE

house.Addons.Add( addon );

Erica- 12-29-2006
ok did find to more words spelled as Houses then changed those to House was getting 2 errors but now i get this error
CODE
RunUO - [www.runuo.com] Version 2.0, Build 2553.23365
Core: Running on .NET Framework Version 2.0.50727
Core: Optimizing for 2 processors
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
Errors:
+ Custom Scripts 2.0/CarpetAddons/CarpetAddonDeed.cs:
   CS1579: Line 161: foreach statement cannot operate on variables of type 'Ser
ver.Multis.BaseHouse' because 'Server.Multis.BaseHouse' does not contain a publi
c definition for 'GetEnumerator'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

ArteGordon- 12-29-2006
you cant just change the 'houses' references to 'house'. One is a list, the other is not.
Make sure that you made that second change that I mentioned. You have to replace all of this

CODE

if ( houses != null )
  {
   foreach ( Server.Multis.BaseHouse h in houses )
    h.Addons.Add( addon );
  }


with this line

CODE

house.Addons.Add( addon );


There should not be any foreach there after the change.

Erica- 12-29-2006
Ah ok got it thanks ArteGordon complies now.