RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Ethereal Dye tub

Shay

Wanderer
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]
 

wolf

Wanderer
there is already a ethereal dye tub out there like this one
[code:1]using System;
using Server;

namespace Server.Items
{
public class EtherealDyeTub : DyeTub
{
[Constructable]
public EtherealDyeTub()
{
Name = "Ethereal DyeTub";
Hue = DyedHue = 0x4001;
Redyable = false;
}

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();
}
}
} [/code:1]

you can change the colors with dyes and such not to be smug just pointing it out. did i help any? probally not :(
 

Shay

Wanderer
no but thanks for the attempt.


What i did is i took the special dyetub script from the marrs reward system and mixed in the ethereal dye tub that i got off the forums. I want the players to be able to choose our custom hues to dye with. It's a reward item with 10 charges (i will add the charges after this)

Anyway i just seem to have this small error and have tried since about 130 this afternoon to correct it
and i believe the one you are showing is just to dye things the ethereal color
 

wolf

Wanderer
are you saying creating a gump? like if you double click the tub a gump appears stating the hues they can choose if they have the right amount of charges?
 

Shay

Wanderer
erm it's already created i just need to know WHY it's not compiling. I read somewhere that the error im getting is because something in the script isnt right. Usually if i cant compile i can figure the problem out easily but because im getting an error about a } expected at the end of the file when there are already 3 there is confusing me.
Where is phantom when i need him 8)
 

UOT

Knight
You were missing a few brackets here's the fixed code pointing out were they were missing. After I fixed the bracket problem I was getting EtheralHueList missing error, but I assume you have that in another 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 );
} //<---This bracket was missing
} //<---This bracket was missing
} //<---This bracket was missing
}

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]
 

Shay

Wanderer
OMG THANK YOU. When the script is complete i will add it to submissions. I own you a ton man! And yes i have the other file completed
 
Top