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!

} error

} error

i know it has something to do with the {} brackets, i tryed fixing it but kept getting more errors.

Code:
Scripts: Compiling C# scripts...failed (1 err
Errors:
 + Items/Misc/PublicMoongate.cs:
    CS1513: Line 516: } expected
    CS1513: Line 516: } expected
    CS1513: Line 516: } expected
Scripts: One or more scripts failed to compil
 - Press return to exit, or R to try again.


Code:
		public override void OnResponse( NetState state, RelayInfo info )
		{
			if ( info.ButtonID == 0 ) // Cancel
				return;
			else if ( m_Mobile.Deleted || m_Moongate.Deleted || m_Mobile.Map == null )
				return;

			if ( info.ButtonID == 2 )
			{
				ArrayList a = new ArrayList();

				foreach ( Item i in World.Items.Values )
				{
					if ( i is CityManagementStone )
					{
						CityManagementStone s = (CityManagementStone)i;
						
						if ( s.HasMoongate == true && s.IsRegistered == true )
[COLOR="Red"]scroll down	[/COLOR]		a.Add( i );
					}
				}

				if ( a.Count == 0 )
				{
					m_Mobile.SendGump( new NoCitiesGump() );
				}
				else
				{
					m_Mobile.SendGump( new PCMoongateGump( m_Moongate, 0, null, null ) );
				}
			}

			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;

			PMList list = m_Lists[listIndex];

			if ( listEntry < 0 || listEntry >= list.Entries.Length )
				return;

			PMEntry entry = list.Entries[listEntry];

			if ( !m_Mobile.InRange( m_Moongate.GetWorldLocation(), 1 ) || m_Mobile.Map != m_Moongate.Map )
			{
				m_Mobile.SendLocalizedMessage( 1019002 ); // You are too far away to use the gate.
			}
			else if ( m_Mobile.Player && m_Mobile.Kills >= 5 && list.Map != Map.Felucca )
			{
				m_Mobile.SendLocalizedMessage( 1019004 ); // You are not allowed to travel there.
			}
			else if ( Factions.Sigil.ExistsOn( m_Mobile ) && list.Map != Factions.Faction.Facet )
			{
				m_Mobile.SendLocalizedMessage( 1019004 ); // You are not allowed to travel there.
			}
			else if ( m_Mobile.Criminal )
			{
				m_Mobile.SendLocalizedMessage( 1005561, "", 0x22 ); // Thou'rt a criminal and cannot escape so easily.
			}
			else if ( SpellHelper.CheckCombat( m_Mobile ) )
			{
				m_Mobile.SendLocalizedMessage( 1005564, "", 0x22 ); // Wouldst thou flee during the heat of battle??
			}
			else if ( m_Mobile.Spell != null )
			{
				m_Mobile.SendLocalizedMessage( 1049616 ); // You are too busy to do that at the moment.
			}
			else if ( m_Mobile.Map == list.Map && m_Mobile.InRange( entry.Location, 1 ) )
			{
				m_Mobile.SendLocalizedMessage( 1019003 ); // You are already there.
			}
			else
			{

				CityManagementStone outgoingCity = null;
				Region currentRegion = Region.Find( m_Mobile.Location, m_Mobile.Map );

				if ( currentRegion != null )
				{
					if ( currentRegion is PlayerCityRegion )
					{
						PlayerCityRegion pcr = (PlayerCityRegion)currentRegion;

						outgoingCity = pcr.Stone;
					}
				}

				if ( outgoingCity != null && outgoingCity.TravelTax >= 1 )
				{
					m_Mobile.SendGump( new PCMoongateToll2Gump( m_Moongate, outgoingCity, entry.Location, list.Map ) );
				}
				else
				{
					BaseCreature.TeleportPets( m_Mobile, entry.Location, list.Map );
	
					m_Mobile.Combatant = null;
					m_Mobile.Warmode = false;
					m_Mobile.Hidden = true;

					m_Mobile.MoveToWorld( entry.Location, list.Map );

					Effects.PlaySound( entry.Location, list.Map, 0x1FE );
				}
   }

[COLOR="Red"]516[/COLOR]}
 
K

KevinEvans

Guest
Try putting another } at the end.

Remeber, if you have a bracket, you need to have another bracket on the other side, like {} [] () etc
 
gave me same error on another line
i added another bracket n got
Code:
Errors:
 + Items/Misc/PublicMoongate.cs:
    CS1513: Line 517: } expected
 
K

KevinEvans

Guest
ohh

Code:
public override void OnResponse( NetState state, RelayInfo info )
		{
			if ( info.ButtonID == 0 ) // Cancel
				return;
			else if ( m_Mobile.Deleted || m_Moongate.Deleted || m_Mobile.Map == null )
				return;

			if ( info.ButtonID == 2 )
			{
				ArrayList a = new ArrayList();

				foreach ( Item i in World.Items.Values )
				{
					if ( i is CityManagementStone )
					{
						CityManagementStone s = (CityManagementStone)i;
						
						if ( s.HasMoongate == true && s.IsRegistered == true )
 			a.Add( i );
					}
				}

				if ( a.Count == 0 )
				{
					m_Mobile.SendGump( new NoCitiesGump() );
				}
				else
				{
					m_Mobile.SendGump( new PCMoongateGump( m_Moongate, 0, null, null ) );
				}
			}

			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;

			PMList list = m_Lists[listIndex];

			if ( listEntry < 0 || listEntry >= list.Entries.Length )
				return;

			PMEntry entry = list.Entries[listEntry];

			if ( !m_Mobile.InRange( m_Moongate.GetWorldLocation(), 1 ) || m_Mobile.Map != m_Moongate.Map )
			{
				m_Mobile.SendLocalizedMessage( 1019002 ); // You are too far away to use the gate.
			}
			else if ( m_Mobile.Player && m_Mobile.Kills >= 5 && list.Map != Map.Felucca )
			{
				m_Mobile.SendLocalizedMessage( 1019004 ); // You are not allowed to travel there.
			}
			else if ( Factions.Sigil.ExistsOn( m_Mobile ) && list.Map != Factions.Faction.Facet )
			{
				m_Mobile.SendLocalizedMessage( 1019004 ); // You are not allowed to travel there.
			}
			else if ( m_Mobile.Criminal )
			{
				m_Mobile.SendLocalizedMessage( 1005561, "", 0x22 ); // Thou'rt a criminal and cannot escape so easily.
			}
			else if ( SpellHelper.CheckCombat( m_Mobile ) )
			{
				m_Mobile.SendLocalizedMessage( 1005564, "", 0x22 ); // Wouldst thou flee during the heat of battle??
			}
			else if ( m_Mobile.Spell != null )
			{
				m_Mobile.SendLocalizedMessage( 1049616 ); // You are too busy to do that at the moment.
			}
			else if ( m_Mobile.Map == list.Map && m_Mobile.InRange( entry.Location, 1 ) )
			{
				m_Mobile.SendLocalizedMessage( 1019003 ); // You are already there.
			}
			else
			{

				CityManagementStone outgoingCity = null;
				Region currentRegion = Region.Find( m_Mobile.Location, m_Mobile.Map );

				if ( currentRegion != null )
				{
					if ( currentRegion is PlayerCityRegion )
					{
						PlayerCityRegion pcr = (PlayerCityRegion)currentRegion;

						outgoingCity = pcr.Stone;
					}
				}

				if ( outgoingCity != null && outgoingCity.TravelTax >= 1 )
				{
					m_Mobile.SendGump( new PCMoongateToll2Gump( m_Moongate, outgoingCity, entry.Location, list.Map ) );
				}
				else
				{
					BaseCreature.TeleportPets( m_Mobile, entry.Location, list.Map );
	
					m_Mobile.Combatant = null;
					m_Mobile.Warmode = false;
					m_Mobile.Hidden = true;

					m_Mobile.MoveToWorld( entry.Location, list.Map );

					Effects.PlaySound( entry.Location, list.Map, 0x1FE );
				}
   }

you had too many brackets
try using this...
 
Code:
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
Errors:
 + Items/Misc/PublicMoongate.cs:
    CS1513: Line 514: } expected
    CS1513: Line 514: } expected
    CS1513: Line 514: } 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:
[COLOR="Red"]403[/COLOR]public override void OnResponse( NetState state, RelayInfo info )
		{
			if ( info.ButtonID == 0 ) // Cancel
				return;
			else if ( m_Mobile.Deleted || m_Moongate.Deleted || m_Mobile.Map == null )
				return;

			if ( info.ButtonID == 2 )
			{
				ArrayList a = new ArrayList();

				foreach ( Item i in World.Items.Values )
				{
					if ( i is CityManagementStone )
					{
						CityManagementStone s = (CityManagementStone)i;
						
						if ( s.HasMoongate == true && s.IsRegistered == true )
 			a.Add( i );
					}
				}

				if ( a.Count == 0 )
				{
					m_Mobile.SendGump( new NoCitiesGump() );
				}
				else
				{
					m_Mobile.SendGump( new PCMoongateGump( m_Moongate, 0, null, null ) );
				}
			}

			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;

			PMList list = m_Lists[listIndex];

			if ( listEntry < 0 || listEntry >= list.Entries.Length )
				return;

			PMEntry entry = list.Entries[listEntry];

			if ( !m_Mobile.InRange( m_Moongate.GetWorldLocation(), 1 ) || m_Mobile.Map != m_Moongate.Map )
			{
				m_Mobile.SendLocalizedMessage( 1019002 ); // You are too far away to use the gate.
			}
			else if ( m_Mobile.Player && m_Mobile.Kills >= 5 && list.Map != Map.Felucca )
			{
				m_Mobile.SendLocalizedMessage( 1019004 ); // You are not allowed to travel there.
			}
			else if ( Factions.Sigil.ExistsOn( m_Mobile ) && list.Map != Factions.Faction.Facet )
			{
				m_Mobile.SendLocalizedMessage( 1019004 ); // You are not allowed to travel there.
			}
			else if ( m_Mobile.Criminal )
			{
				m_Mobile.SendLocalizedMessage( 1005561, "", 0x22 ); // Thou'rt a criminal and cannot escape so easily.
			}
			else if ( SpellHelper.CheckCombat( m_Mobile ) )
			{
				m_Mobile.SendLocalizedMessage( 1005564, "", 0x22 ); // Wouldst thou flee during the heat of battle??
			}
			else if ( m_Mobile.Spell != null )
			{
				m_Mobile.SendLocalizedMessage( 1049616 ); // You are too busy to do that at the moment.
			}
			else if ( m_Mobile.Map == list.Map && m_Mobile.InRange( entry.Location, 1 ) )
			{
				m_Mobile.SendLocalizedMessage( 1019003 ); // You are already there.
			}
			else
			{

				CityManagementStone outgoingCity = null;
				Region currentRegion = Region.Find( m_Mobile.Location, m_Mobile.Map );

				if ( currentRegion != null )
				{
					if ( currentRegion is PlayerCityRegion )
					{
						PlayerCityRegion pcr = (PlayerCityRegion)currentRegion;

						outgoingCity = pcr.Stone;
					}
				}

				if ( outgoingCity != null && outgoingCity.TravelTax >= 1 )
				{
					m_Mobile.SendGump( new PCMoongateToll2Gump( m_Moongate, outgoingCity, entry.Location, list.Map ) );
				}
				else
				{
					BaseCreature.TeleportPets( m_Mobile, entry.Location, list.Map );
	
					m_Mobile.Combatant = null;
					m_Mobile.Warmode = false;
					m_Mobile.Hidden = true;

					m_Mobile.MoveToWorld( entry.Location, list.Map );

					Effects.PlaySound( entry.Location, list.Map, 0x1FE );
				}
[COLOR="Red"]514[/COLOR]}
 

Soteric

Knight
Download normal IDE (like C# Express or SharpDeveloper) or count all opened and closed brackets manually (their amount should match). Anyway you know what's the error about, don't wait for anyone to do this stupid job for you
 

Vorspire

Knight
Soteric is right, go get Visual C# Express 2008, it's completely free and the IDE will point out silly errors like this for you :D
 
Top