- ServUO Version
- Publish 57
- Ultima Expansion
- Endless Journey
Getting the following error when trying to use two scripts that were downloaded from here, the error:
the code causing the error:
and the script it is referencing:
Sample script with the code causing the error:
C#:
error CS0118: 'BirthdayCake' is a namespace but is used like a type [C:\ServUO\Scripts\Scripts.csproj]
C#:
BirthdayCake bc = new BirthdayCake();
bc.Hue = 6;
bc.Name = "Happy Birthday Nathan!";
box.DropItem( bc );
C#:
using System;
using System.Collections;
using Server;
using Server.Network;
namespace Server.Items
{
public class BirthdayCake : Food
{
[Constructable]
public BirthdayCake() : this( 1 )
{
}
[Constructable]
public BirthdayCake( int amount ) : base( 0xF8F, amount )
{
this.Hue = 2634;
this.Name = "A Happy Birthday cake";
this.Movable = true;
this.ItemID = 2537;
this.Amount = amount;
this.FillFactor = 20;
this.Weight = 0;
this.Stackable = true;
}
public override void GetProperties( ObjectPropertyList list )
{
base.GetProperties( list );
list.Add( "Happy Birthday!" );
}
public BirthdayCake( Serial serial ) : base( serial )
{
}
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();
}
}
}
Sample script with the code causing the error:
C#:
using System;
using Server;
using Server.Items;
using Server.Gumps;
namespace Server.Misc
{
public class NathanBirthdayCakeGiver : GiftGiver
{
public static void Initialize()
{
GiftGiving.Register( new NathanBirthdayCakeGiver() );
}
public override DateTime Start{ get{ return new DateTime( 1980, 6, 26 ); } }
public override DateTime Finish{ get{ return new DateTime( 2023, 6, 29 ); } }
public override void GiveGift( Mobile mob )
{
GiftBox box = new GiftBox();
box.Hue = Utility.RandomList( 1436 );
box.DropItem( new FireworksWand() );
BirthdayCake bc = new BirthdayCake();
bc.Hue = 6;
bc.Name = "Happy Birthday Nathan!";
box.DropItem( bc );
bool pack = GiveGift( mob, box);
mob.SendGump( new GiftPackageGump( pack, "Happy Birthday Nathan!" ));
}
}
}