Ethereal Dye tub
Im trying ot make an ethereal dye tub ( i will be adding charges to it) using custom hues with a gump
When i go to compile the error i get is
[code:1]Scripts: Compiling C# scripts...failed (2 errors, 0 warnings)
- Error: Scripts\Custom\DyeTubs\EtherealDyeTub.cs: CS1513: (line 166, column 2)
} expected
- Error: Scripts\Custom\DyeTubs\EtherealDyeTub.cs: CS1513: (line 166, column 2)
} expected
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
[/code:1]
Here is the script
[code:1]using System;
using Server;
using Server.Gumps;
using Server.Network;
using Server.Misc;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Items
{
public class EtherealDyeTub : DyeTub
{
[Constructable]
public EtherealDyeTub()
{
Weight = 10.0;
Redyable = true;
Name = "Ethereal Mount Dye Tub";
}
public EtherealDyeTub( 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();
}
public override void OnDoubleClick( Mobile from )
{
if ( from.InRange( this.GetWorldLocation(), 1 ) )
{
from.SendMessage( "Select the Ethereal to dye." );
from.Target = new InternalTarget( this );
}
else
{
from.SendLocalizedMessage( 500446 ); // That is too far away.
}
}
private class InternalTarget : Target
{
private EtherealDyeTub m_LTub;
public InternalTarget( EtherealDyeTub tub ) : base( 1, false, TargetFlags.None )
{
m_LTub = tub;
}
protected override void OnTarget( Mobile from, object targeted )
{
if ( targeted is EtherealMount )
{
EtherealMount mount = targeted as EtherealMount;
if ( !from.InRange( m_LTub.GetWorldLocation(), 1 ) || !from.InRange( ((Item)targeted).GetWorldLocation(), 1 ) )
{
from.SendLocalizedMessage( 500446 ); // That is too far away.
}
else if (( ((Item)targeted).Parent != null ) && ( ((Item)targeted).Parent is Mobile ) )
{
from.SendMessage( "You cannot dye that in it's current location." );
}
mount.Hue = m_LTub.Hue;
from.PlaySound( 0x23E );
}
}
public class EtherealDyeGump : Gump
{
private EtherealHueList[] m_Lists;
public DyeTub m_Tub;
public EtherealDyeGump( DyeTub tub ) : base( 50,50 )
{
m_Tub = tub;
EtherealHueList[] checkLists;
checkLists = EtherealHueList.EtherealHueLists;
m_Lists = new EtherealHueList[checkLists.Length];
for ( int i = 0; i < m_Lists.Length; ++i )
m_Lists = checkLists;
AddPage( 0 );
AddBackground( 0, 0, 450, 450, 5054 ); // Outer gump border
AddBackground( 10, 10, 430, 430, 3000 ); // Gump background
AddLabel( 20, 30, 0, "Ethereal Hue Selection Menu" );
AddButton( 20, 400, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0 );
AddLabel( 55, 400, 0x00, "OKAY" );
for ( int i = 0; i < checkLists.Length; ++i )
{
AddButton( 30, 85 + (i * 25), 0x1468, 0x1468, 0, GumpButtonType.Page, Array.IndexOf( m_Lists, checkLists ) + 1 );
AddLabel( 55, 85 + (i * 25), 0, checkLists.HueGroup );
}
for ( int i = 0; i < m_Lists.Length; ++i )
RenderPage( i, Array.IndexOf( checkLists, m_Lists ) );
}
private void RenderPage( int index, int offset )
{
EtherealHueList list = m_Lists[index];
AddPage( index + 1 );
AddButton( 30, 85 + (offset * 25), 0x1468, 0x1468, 0, GumpButtonType.Page, index + 1 );
AddLabel( 55, 85 + (offset * 25), 0, list.HueGroup );
EtherealHueEntry[] entries = list.Entries;
for ( int i = 0; i < entries.Length; ++i )
{
AddRadio( 255, 90 + (i * 25), 210, 211, false, (index * 100) + i );
AddLabel( 275, 90 + (i * 25), entries.Hue, "*****" );
//AddItem( 315, 88 + (i * 25), 7609, entries.Hue);
}
}
public override void OnResponse( NetState state, RelayInfo info ) //Function for GumpButtonType.Reply Buttons
{
Mobile from = state.Mobile;
if ( info.ButtonID == 0 ) // Cancel
return;
int[] switches = info.Switches;
if ( switches.Length == 0 )
return;
int switchID = switches[0];
int listIndex = switchID / 100;
int listEntry = switchID % 100;
if ( listIndex < 0 || listIndex >= m_Lists.Length )
return;
EtherealHueList list = m_Lists[listIndex];
if ( listEntry < 0 || listEntry >= list.Entries.Length )
return;
EtherealHueEntry entry = list.Entries[listEntry];
m_Tub.Hue = entry.Hue + 1; // Add one to 0-base for proper hue
m_Tub.DyedHue = entry.Hue + 1;
Effects.PlaySound( from.Location, from.Map, 0x23E); // Sound 574: The dyetub
return;
}
}
}
[/code:1]
Im trying ot make an ethereal dye tub ( i will be adding charges to it) using custom hues with a gump
When i go to compile the error i get is
[code:1]Scripts: Compiling C# scripts...failed (2 errors, 0 warnings)
- Error: Scripts\Custom\DyeTubs\EtherealDyeTub.cs: CS1513: (line 166, column 2)
} expected
- Error: Scripts\Custom\DyeTubs\EtherealDyeTub.cs: CS1513: (line 166, column 2)
} expected
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
[/code:1]
Here is the script
[code:1]using System;
using Server;
using Server.Gumps;
using Server.Network;
using Server.Misc;
using Server.Mobiles;
using Server.Targeting;
namespace Server.Items
{
public class EtherealDyeTub : DyeTub
{
[Constructable]
public EtherealDyeTub()
{
Weight = 10.0;
Redyable = true;
Name = "Ethereal Mount Dye Tub";
}
public EtherealDyeTub( 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();
}
public override void OnDoubleClick( Mobile from )
{
if ( from.InRange( this.GetWorldLocation(), 1 ) )
{
from.SendMessage( "Select the Ethereal to dye." );
from.Target = new InternalTarget( this );
}
else
{
from.SendLocalizedMessage( 500446 ); // That is too far away.
}
}
private class InternalTarget : Target
{
private EtherealDyeTub m_LTub;
public InternalTarget( EtherealDyeTub tub ) : base( 1, false, TargetFlags.None )
{
m_LTub = tub;
}
protected override void OnTarget( Mobile from, object targeted )
{
if ( targeted is EtherealMount )
{
EtherealMount mount = targeted as EtherealMount;
if ( !from.InRange( m_LTub.GetWorldLocation(), 1 ) || !from.InRange( ((Item)targeted).GetWorldLocation(), 1 ) )
{
from.SendLocalizedMessage( 500446 ); // That is too far away.
}
else if (( ((Item)targeted).Parent != null ) && ( ((Item)targeted).Parent is Mobile ) )
{
from.SendMessage( "You cannot dye that in it's current location." );
}
mount.Hue = m_LTub.Hue;
from.PlaySound( 0x23E );
}
}
public class EtherealDyeGump : Gump
{
private EtherealHueList[] m_Lists;
public DyeTub m_Tub;
public EtherealDyeGump( DyeTub tub ) : base( 50,50 )
{
m_Tub = tub;
EtherealHueList[] checkLists;
checkLists = EtherealHueList.EtherealHueLists;
m_Lists = new EtherealHueList[checkLists.Length];
for ( int i = 0; i < m_Lists.Length; ++i )
m_Lists = checkLists;
AddPage( 0 );
AddBackground( 0, 0, 450, 450, 5054 ); // Outer gump border
AddBackground( 10, 10, 430, 430, 3000 ); // Gump background
AddLabel( 20, 30, 0, "Ethereal Hue Selection Menu" );
AddButton( 20, 400, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0 );
AddLabel( 55, 400, 0x00, "OKAY" );
for ( int i = 0; i < checkLists.Length; ++i )
{
AddButton( 30, 85 + (i * 25), 0x1468, 0x1468, 0, GumpButtonType.Page, Array.IndexOf( m_Lists, checkLists ) + 1 );
AddLabel( 55, 85 + (i * 25), 0, checkLists.HueGroup );
}
for ( int i = 0; i < m_Lists.Length; ++i )
RenderPage( i, Array.IndexOf( checkLists, m_Lists ) );
}
private void RenderPage( int index, int offset )
{
EtherealHueList list = m_Lists[index];
AddPage( index + 1 );
AddButton( 30, 85 + (offset * 25), 0x1468, 0x1468, 0, GumpButtonType.Page, index + 1 );
AddLabel( 55, 85 + (offset * 25), 0, list.HueGroup );
EtherealHueEntry[] entries = list.Entries;
for ( int i = 0; i < entries.Length; ++i )
{
AddRadio( 255, 90 + (i * 25), 210, 211, false, (index * 100) + i );
AddLabel( 275, 90 + (i * 25), entries.Hue, "*****" );
//AddItem( 315, 88 + (i * 25), 7609, entries.Hue);
}
}
public override void OnResponse( NetState state, RelayInfo info ) //Function for GumpButtonType.Reply Buttons
{
Mobile from = state.Mobile;
if ( info.ButtonID == 0 ) // Cancel
return;
int[] switches = info.Switches;
if ( switches.Length == 0 )
return;
int switchID = switches[0];
int listIndex = switchID / 100;
int listEntry = switchID % 100;
if ( listIndex < 0 || listIndex >= m_Lists.Length )
return;
EtherealHueList list = m_Lists[listIndex];
if ( listEntry < 0 || listEntry >= list.Entries.Length )
return;
EtherealHueEntry entry = list.Entries[listEntry];
m_Tub.Hue = entry.Hue + 1; // Add one to 0-base for proper hue
m_Tub.DyedHue = entry.Hue + 1;
Effects.PlaySound( from.Location, from.Map, 0x23E); // Sound 574: The dyetub
return;
}
}
}
[/code:1]