Full Version : Score Board
xmlspawner >>Scripting Support >>Score Board
<< Prev | Next >>
Asmir02- 02-09-2006
I'm making score board and im almost done and now when i run it i get few errors im not sure what they mean i tryed change it few time didnt work.
Here are the errors

CODE
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1518: (line 129, column 11) Expected class, delegate, enum, interface, or struct - Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1518: (line 133, column 11) Expected class, delegate, enum, interface, or struct
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1518:
(line 143, column 18) Expected class, delegate, enum, interface, or struct
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1518:
(line 190, column 11) Expected class, delegate, enum, interface, or struct
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1518:
(line 250, column 61) Expected class, delegate, enum, interface, or struct
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1022:
(line 268, column 5) Type or namespace definition, or end-of-file expected
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

Here is the script

CODE
using System; using System.Collections; using Server; using Server.Network; using Server.Mobiles;
using Server.Accounting;
namespace Server.Gumps
{
public class PlayerScoreGump : Gump
{
public static void Initialize()
{
Commands.Register( "dsb", AccessLevel.Player, new CommandEventHandler( PlayerScoreGump_OnCommand ) );
}
public static string m_args;
[Usage( "pvpsb" )]
[Description( "lists ranked pvp competitors" )]
private static void PlayerScoreGump_OnCommand( CommandEventArgs e )
{
e.Mobile.SendGump( new PlayerScoreGump( e.Mobile ) );
}
public const int GumpOffsetX = 30;
public const int GumpOffsetY = 30;
public const int TextHue = 0;
public const int TextOffsetX = 2;
public const int OffsetGumpID = 0x0052; // Pure black
public const int HeaderGumpID = 0x0E14; // Dark navy blue, textured
public const int EntryGumpID = 0x0BBC; // Light offwhite, textured
public const int BackGumpID = 0x13BE; // Gray slate/stoney
public const int ButtonGumpID = 0x0E14; // Dark navy blue, textured
public const int ButtonWidth = 20;
public const int GoOffsetX = 2, GoOffsetY = 2;
public const int GoButtonID1 = 0x15E1; // Arrow pointing right
public const int GoButtonID2 = 0x15E5; // " pressed
public const int DeleteOffsetX = 1, DeleteOffsetY = 1;
public const int DeleteButtonID1 = 0x0A94; // 'X' Button
public const int DeleteButtonID2 = 0x0A95; // " pressed
public const int PrevWidth = 20;
public const int PrevOffsetX = 2, PrevOffsetY = 2;
public const int PrevButtonID1 = 0x15E3; // Arrow pointing left
public const int PrevButtonID2 = 0x15E7; // " pressed
public const int NextWidth = 20;
public const int NextOffsetX = 2, NextOffsetY = 2;
public const int NextButtonID1 = 0x15E1; // Arrow pointing right
public const int NextButtonID2 = 0x15E5; // " pressed
public const int WipeWidth = 20;
public const int WipeOffsetX = 0, WipeOffsetY = 1;
public const int WipeButtonID1 = 0x0A94; // 'X' Button
public const int WipeButtonID2 = 0x0A95; // " pressed
public const int OffsetSize = 1;
public const int EntryHeight = 20;
public const int BorderSize = 10;
private static bool PrevLabel = false, NextLabel = false, WipeLabel = true;
private const int PrevLabelOffsetX = PrevWidth + 1;
private const int PrevLabelOffsetY = 0;
private const int NextLabelOffsetX = -29;
private const int NextLabelOffsetY = 0;
private const int WipeLabelOffsetX = WipeWidth + 1;
private const int WipeLabelOffsetY = 0;
private const int EntryWidth = 500;
private const int EntryCount = 10;
private const int TotalWidth = OffsetSize + EntryWidth + OffsetSize + (ButtonWidth * 2) + OffsetSize;
private const int TotalHeight = OffsetSize + ((EntryHeight + OffsetSize) * (EntryCount + 2));
private const int BackWidth = BorderSize + TotalWidth + BorderSize;
private const int BackHeight = BorderSize + TotalHeight + BorderSize;
private Mobile m_Owner;
private ArrayList m_Names;
private int m_Page;
private static Mobile m_From;
private static ArrayList m_Dudes;
private static int m_CurPage;
private static int m_Dex;
private string TopTen = "**[Top 10 PvP'ers]**";
private static bool Top10 = true;
private static int HueByRank;
private class InternalComparer : IComparer
{
}
public static readonly IComparer Rank = new InternalComparer();
public int Compare( object x, object y )
{
PlayerMobile a = x as PlayerMobile;
PlayerMobile b = y as PlayerMobile;
if ( x == null && y == null )
return 0;
else if ( x == null )
return -1;
else if ( y == null )
return 1;
if ( a == null || b == null )
throw new ArgumentException();
if ( a.Wins > b.Wins )
return -1;
else if ( a.Wins < b.Wins )
return 1;
else
return 0;
}
}
public PlayerScoreGump( Mobile owner ) : this( owner, BuildList( owner ), 0 )
{
}
public PlayerScoreGump( Mobile owner, ArrayList list, int page ) : base( GumpOffsetX, GumpOffsetY )
{
m_Owner = owner;
m_Names = list;
owner.CloseGump( typeof( PlayerScoreGump ) );
Initialize( page );
}
}
public static ArrayList BuildList( Mobile owner )
{
ArrayList list = new ArrayList();
PlayerMobile pm = i as PlayerMobile;
foreach ( Mobile i in World.Mobiles.Values )
{
if ( i is PlayerMobile )
{
if ( pm.Wins >= 1 && pm.AccessLevel == AccessLevel.Player)
{
if (pm.Wins <= 10)
pm.HueByRank = 2499;
else if (pm.Wins <= 20)
pm.HueByRank = 2465;
else if (pm.Wins <= 40)
pm.HueByRank = 2997;
else if (pm.Wins <= 80)
pm.HueByRank = 2914;
else if (pm.Wins <= 160)
pm.HueByRank = 2936;
else if (pm.Wins <= 320)
pm.HueByRank = 2944;
else if (pm.Wins <= 640)
pm.HueByRank = 2946;
else if (pm.Wins <= 1280)
pm.HueByRank = 2947;
else if (pm.Wins <= 2560)
pm.HueByRank = 2954;
else if (pm.Wins <= 5120)
pm.HueByRank = 2951;
else if (pm.Wins <= 10240)
pm.HueByRank = 2463;
else if (pm.Wins <= 9999999)
pm.HueByRank = 2046;
else
pm.HueByRank = 0;
list.Add(pm);
}
list.Sort( InternalComparer.Rank );
return list;
}
}
}
public void Initialize( int page )
{
m_Page = page;
int count = m_Names.Count - (page * EntryCount);
if ( count < 0 )
count = 0;
else if ( count > EntryCount )
count = EntryCount;
int totalHeight = OffsetSize + ((EntryHeight + OffsetSize) * (count + 2));
AddPage( 0 );
AddBackground( 0, 0, BackWidth, BorderSize + totalHeight + BorderSize, BackGumpID );
AddImageTiled( BorderSize, BorderSize, TotalWidth, totalHeight, OffsetGumpID );
int x = BorderSize + OffsetSize;
int y = BorderSize + OffsetSize;
//int emptyWidth = TotalWidth - PrevWidth - NextWidth - (OffsetSize * 4);
int emptyWidth = EntryWidth;
AddImageTiled( x, y, emptyWidth, EntryHeight, EntryGumpID );
AddLabel( x + TextOffsetX, y, 2997, string.Format( "Page {0} of {1} ({2} Competitors) - Deul Score-Board: {3}" + string.Format(Top10 ? TopTen : ""), page+1, (m_Names.Count + EntryCount - 1) / EntryCount, m_Names.Count, m_args) );
x += emptyWidth + OffsetSize;
AddImageTiled( x, y, PrevWidth, EntryHeight, HeaderGumpID );
if ( page > 0 )
{
AddButton( x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 1, GumpButtonType.Reply, 0 );
}
if ( PrevLabel )
{
AddLabel( x + PrevLabelOffsetX, y + PrevLabelOffsetY, 2997, "Previous" );
}
x += PrevWidth + OffsetSize;
AddImageTiled( x, y, NextWidth, EntryHeight, HeaderGumpID );
if ( (page + 1) * EntryCount < m_Names.Count )
{
AddButton( x + NextOffsetX, y + NextOffsetY, NextButtonID1, NextButtonID2, 2, GumpButtonType.Reply, 1 );
}
if ( NextLabel )
{
AddLabel( x + NextLabelOffsetX, y + NextLabelOffsetY, 2997, "Next" );
{
for ( int i = 0, index = page * EntryCount; i < EntryCount && index < m_Names.Count; ++i, ++index )
{
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
PlayerMobile ListPlayer = (PlayerMobile)m_Names[index];
AddImageTiled( x, y, EntryWidth, EntryHeight, EntryGumpID );
AddLabelCropped( x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, ListPlayer.HueByRank,
ListPlayer.Deleted ? "(NULL)" : (string.Format("* Name: {0} * Wins: {1} * Loses: {2} * Rank: {3} *", ListPlayer.Name, ListPlayer.Wins, ListPlayer.Loses, ListPlayer.PvpRanks ) ) );
x += EntryWidth + OffsetSize;
AddImageTiled( x, y, ButtonWidth, EntryHeight, ButtonGumpID );
AddButton( x + DeleteOffsetX, y + DeleteOffsetY, DeleteButtonID1, DeleteButtonID2, GumpButtonType.Reply, 2 );
x += ButtonWidth + OffsetSize;
AddImageTiled( x, y, ButtonWidth, EntryHeight, ButtonGumpID );
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
AddImageTiled( x, y, TotalWidth, EntryHeight, EntryGumpID );
AddLabel( x + WipeLabelOffsetX, y + WipeLabelOffsetY, 2997, "Alternate-PK PvP Score-Board" );
}
}
public override void OnResponse( NetState state, RelayInfo info )
{
Mobile from = state.Mobile;
switch ( info.ButtonID )
{
case 0: // Closed
{
return;
}
}
case 1: // Previous
{
if ( m_Page > 0 )
}
else if ((m_Page - 1) > 0 )
{
Top10 = false;
}
else
{
Top10 = true;
}
from.SendGump( new PlayerScoreGump( from, m_Names, m_Page - 1 ) );
break;
}
}
case 2: // Next
{
if ( (m_Page + 1) * EntryCount < m_Names.Count )
}
else if( from != null)
{
else if((m_Page + 1) > 0 )
{
Top10 = false;
}
else
{
Top10 = true;
}
from.SendGump( new PlayerScoreGump( from, m_Names, m_Page + 1 ) );
break;
}
}
}
}

Thank you all for taking your time to help me with my errors im still trying to learn and im doing better.
Zyle- 02-10-2006
It's a bit hard to see as the formatting is a bit messed up, but you need to add a } at line 271. What program do you use to script in?

QUOTE
using System; using System.Collections; using Server; using Server.Network; using Server.Mobiles;
using Server.Accounting;
namespace Server.Gumps
{
public class PlayerScoreGump : Gump
{
public static void Initialize()
{
Commands.Register( "dsb", AccessLevel.Player, new CommandEventHandler( PlayerScoreGump_OnCommand ) );
}
public static string m_args;
[Usage( "pvpsb" )]
[Description( "lists ranked pvp competitors" )]
private static void PlayerScoreGump_OnCommand( CommandEventArgs e )
{
e.Mobile.SendGump( new PlayerScoreGump( e.Mobile ) );
}
public const int GumpOffsetX = 30;
public const int GumpOffsetY = 30;
public const int TextHue = 0;
public const int TextOffsetX = 2;
public const int OffsetGumpID = 0x0052; // Pure black
public const int HeaderGumpID = 0x0E14; // Dark navy blue, textured
public const int EntryGumpID = 0x0BBC; // Light offwhite, textured
public const int BackGumpID = 0x13BE; // Gray slate/stoney
public const int ButtonGumpID = 0x0E14; // Dark navy blue, textured
public const int ButtonWidth = 20;
public const int GoOffsetX = 2, GoOffsetY = 2;
public const int GoButtonID1 = 0x15E1; // Arrow pointing right
public const int GoButtonID2 = 0x15E5; // " pressed
public const int DeleteOffsetX = 1, DeleteOffsetY = 1;
public const int DeleteButtonID1 = 0x0A94; // 'X' Button
public const int DeleteButtonID2 = 0x0A95; // " pressed
public const int PrevWidth = 20;
public const int PrevOffsetX = 2, PrevOffsetY = 2;
public const int PrevButtonID1 = 0x15E3; // Arrow pointing left
public const int PrevButtonID2 = 0x15E7; // " pressed
public const int NextWidth = 20;
public const int NextOffsetX = 2, NextOffsetY = 2;
public const int NextButtonID1 = 0x15E1; // Arrow pointing right
public const int NextButtonID2 = 0x15E5; // " pressed
public const int WipeWidth = 20;
public const int WipeOffsetX = 0, WipeOffsetY = 1;
public const int WipeButtonID1 = 0x0A94; // 'X' Button
public const int WipeButtonID2 = 0x0A95; // " pressed
public const int OffsetSize = 1;
public const int EntryHeight = 20;
public const int BorderSize = 10;
private static bool PrevLabel = false, NextLabel = false, WipeLabel = true;
private const int PrevLabelOffsetX = PrevWidth + 1;
private const int PrevLabelOffsetY = 0;
private const int NextLabelOffsetX = -29;
private const int NextLabelOffsetY = 0;
private const int WipeLabelOffsetX = WipeWidth + 1;
private const int WipeLabelOffsetY = 0;
private const int EntryWidth = 500;
private const int EntryCount = 10;
private const int TotalWidth = OffsetSize + EntryWidth + OffsetSize + (ButtonWidth * 2) + OffsetSize;
private const int TotalHeight = OffsetSize + ((EntryHeight + OffsetSize) * (EntryCount + 2));
private const int BackWidth = BorderSize + TotalWidth + BorderSize;
private const int BackHeight = BorderSize + TotalHeight + BorderSize;
private Mobile m_Owner;
private ArrayList m_Names;
private int m_Page;
private static Mobile m_From;
private static ArrayList m_Dudes;
private static int m_CurPage;
private static int m_Dex;
private string TopTen = "**[Top 10 PvP'ers]**";
private static bool Top10 = true;
private static int HueByRank;
private class InternalComparer : IComparer
{
}
public static readonly IComparer Rank = new InternalComparer();
public int Compare( object x, object y )
{
PlayerMobile a = x as PlayerMobile;
PlayerMobile b = y as PlayerMobile;
if ( x == null && y == null )
return 0;
else if ( x == null )
return -1;
else if ( y == null )
return 1;
if ( a == null || b == null )
throw new ArgumentException();
if ( a.Wins > b.Wins )
return -1;
else if ( a.Wins < b.Wins )
return 1;
else
return 0;
}
}
public PlayerScoreGump( Mobile owner ) : this( owner, BuildList( owner ), 0 )
{
}
public PlayerScoreGump( Mobile owner, ArrayList list, int page ) : base( GumpOffsetX, GumpOffsetY )
{
m_Owner = owner;
m_Names = list;
owner.CloseGump( typeof( PlayerScoreGump ) );
Initialize( page );
}
}
public static ArrayList BuildList( Mobile owner )
{
ArrayList list = new ArrayList();
PlayerMobile pm = i as PlayerMobile;
foreach ( Mobile i in World.Mobiles.Values )
{
if ( i is PlayerMobile )
{
if ( pm.Wins >= 1 && pm.AccessLevel == AccessLevel.Player)
{
if (pm.Wins <= 10)
pm.HueByRank = 2499;
else if (pm.Wins <= 20)
pm.HueByRank = 2465;
else if (pm.Wins <= 40)
pm.HueByRank = 2997;
else if (pm.Wins <= 80)
pm.HueByRank = 2914;
else if (pm.Wins <= 160)
pm.HueByRank = 2936;
else if (pm.Wins <= 320)
pm.HueByRank = 2944;
else if (pm.Wins <= 640)
pm.HueByRank = 2946;
else if (pm.Wins <= 1280)
pm.HueByRank = 2947;
else if (pm.Wins <= 2560)
pm.HueByRank = 2954;
else if (pm.Wins <= 5120)
pm.HueByRank = 2951;
else if (pm.Wins <= 10240)
pm.HueByRank = 2463;
else if (pm.Wins <= 9999999)
pm.HueByRank = 2046;
else
pm.HueByRank = 0;
list.Add(pm);
}
list.Sort( InternalComparer.Rank );
return list;
}
}
}
public void Initialize( int page )
{
m_Page = page;
int count = m_Names.Count - (page * EntryCount);
if ( count < 0 )
count = 0;
else if ( count > EntryCount )
count = EntryCount;
int totalHeight = OffsetSize + ((EntryHeight + OffsetSize) * (count + 2));
AddPage( 0 );
AddBackground( 0, 0, BackWidth, BorderSize + totalHeight + BorderSize, BackGumpID );
AddImageTiled( BorderSize, BorderSize, TotalWidth, totalHeight, OffsetGumpID );
int x = BorderSize + OffsetSize;
int y = BorderSize + OffsetSize;
//int emptyWidth = TotalWidth - PrevWidth - NextWidth - (OffsetSize * 4);
int emptyWidth = EntryWidth;
AddImageTiled( x, y, emptyWidth, EntryHeight, EntryGumpID );
AddLabel( x + TextOffsetX, y, 2997, string.Format( "Page {0} of {1} ({2} Competitors) - Deul Score-Board: {3}" + string.Format(Top10 ? TopTen : ""), page+1, (m_Names.Count + EntryCount - 1) / EntryCount, m_Names.Count, m_args) );
x += emptyWidth + OffsetSize;
AddImageTiled( x, y, PrevWidth, EntryHeight, HeaderGumpID );
if ( page > 0 )
{
AddButton( x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 1, GumpButtonType.Reply, 0 );
}
if ( PrevLabel )
{
AddLabel( x + PrevLabelOffsetX, y + PrevLabelOffsetY, 2997, "Previous" );
}
x += PrevWidth + OffsetSize;
AddImageTiled( x, y, NextWidth, EntryHeight, HeaderGumpID );
if ( (page + 1) * EntryCount < m_Names.Count )
{
AddButton( x + NextOffsetX, y + NextOffsetY, NextButtonID1, NextButtonID2, 2, GumpButtonType.Reply, 1 );
}
if ( NextLabel )
{
AddLabel( x + NextLabelOffsetX, y + NextLabelOffsetY, 2997, "Next" );
{
for ( int i = 0, index = page * EntryCount; i < EntryCount && index < m_Names.Count; ++i, ++index )
{
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
PlayerMobile ListPlayer = (PlayerMobile)m_Names[index];
AddImageTiled( x, y, EntryWidth, EntryHeight, EntryGumpID );
AddLabelCropped( x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, ListPlayer.HueByRank,
ListPlayer.Deleted ? "(NULL)" : (string.Format("* Name: {0} * Wins: {1} * Loses: {2} * Rank: {3} *", ListPlayer.Name, ListPlayer.Wins, ListPlayer.Loses, ListPlayer.PvpRanks ) ) );
x += EntryWidth + OffsetSize;
AddImageTiled( x, y, ButtonWidth, EntryHeight, ButtonGumpID );
AddButton( x + DeleteOffsetX, y + DeleteOffsetY, DeleteButtonID1, DeleteButtonID2, GumpButtonType.Reply, 2 );
x += ButtonWidth + OffsetSize;
AddImageTiled( x, y, ButtonWidth, EntryHeight, ButtonGumpID );
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
AddImageTiled( x, y, TotalWidth, EntryHeight, EntryGumpID );
AddLabel( x + WipeLabelOffsetX, y + WipeLabelOffsetY, 2997, "Alternate-PK PvP Score-Board" );
}
}
} // ADD THIS BRACKET
public override void OnResponse( NetState state, RelayInfo info )
{
Mobile from = state.Mobile;
switch ( info.ButtonID )
{
case 0: // Closed
{
return;
}
}
case 1: // Previous
{
if ( m_Page > 0 )
}
else if ((m_Page - 1) > 0 )
{
Top10 = false;
}
else
{
Top10 = true;
}
from.SendGump( new PlayerScoreGump( from, m_Names, m_Page - 1 ) );
break;
}
}
case 2: // Next
{
if ( (m_Page + 1) * EntryCount < m_Names.Count )
}
else if( from != null)
{
else if((m_Page + 1) > 0 )
{
Top10 = false;
}
else
{
Top10 = true;
}
from.SendGump( new PlayerScoreGump( from, m_Names, m_Page + 1 ) );
break;
}
}
}
}

Asmir02- 02-11-2006
ok i have i got helped from xxspiderxx and got lot of it fixxed but i still get some errors
There are the errors

CODE
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1513: (line 245, column 10) } expected - Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1519: (line 247, column 7) Invalid token '+=' in class, struct, or interface member d
eclaration
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1519:
(line 247, column 22) Invalid token '+' in class, struct, or interface member d
eclaration
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1519:
(line 247, column 34) Invalid token ';' in class, struct, or interface member d
eclaration
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1520:
(line 248, column 5) Class, struct, or interface method must have a return type
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1001:
(line 248, column 21) Identifier expected
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1001:
(line 248, column 24) Identifier expected
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1001:
(line 248, column 37) Identifier expected
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1001:
(line 248, column 50) Identifier expected
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1001:
(line 248, column 65) Identifier expected
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1519:
(line 250, column 7) Invalid token '=' in class, struct, or interface member de
claration
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1519:
(line 250, column 20) Invalid token '+' in class, struct, or interface member d
eclaration
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1519:
(line 250, column 32) Invalid token ';' in class, struct, or interface member d
eclaration
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1519:
(line 251, column 7) Invalid token '+=' in class, struct, or interface member d
eclaration
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1519:
(line 251, column 22) Invalid token '+' in class, struct, or interface member d
eclaration
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1519:
(line 251, column 34) Invalid token ';' in class, struct, or interface member d
eclaration
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1520:
(line 253, column 5) Class, struct, or interface method must have a return type
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1001:
(line 253, column 21) Identifier expected
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1001:
(line 253, column 24) Identifier expected
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1001:
(line 253, column 36) Identifier expected
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1001:
(line 253, column 49) Identifier expected
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1001:
(line 253, column 63) Identifier expected
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1520:
(line 254, column 5) Class, struct, or interface method must have a return type
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1001:
(line 254, column 17) Identifier expected
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1519:
(line 254, column 35) Invalid token ',' in class, struct, or interface member d
eclaration
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1519:
(line 254, column 39) Invalid token '+' in class, struct, or interface member d
eclaration
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1519:
(line 254, column 57) Invalid token ',' in class, struct, or interface member d
eclaration
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1518:
(line 258, column 19) Expected class, delegate, enum, interface, or struct
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS1022:
(line 285, column 3) Type or namespace definition, or end-of-file expected
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

here is the script

CODE
using System; using System.Collections; using Server; using Server.Network; using Server.Mobiles;
using Server.Accounting;
namespace Server.Gumps
{
public class PlayerScoreGump : Gump
{
public static void Initialize()
{
Commands.Register( "duelscore", AccessLevel.Player, new CommandEventHandler( PlayerScoreGump_OnCommand ) );
}
public static string m_args;
[Usage( "pvpsb" )]
[Description( "lists ranked pvp competitors" )]
private static void PlayerScoreGump_OnCommand( CommandEventArgs e )
{
e.Mobile.SendGump( new PlayerScoreGump( e.Mobile ) );
}
public const int GumpOffsetX = 30;
public const int GumpOffsetY = 30;
public const int TextHue = 0;
public const int TextOffsetX = 2;
public const int OffsetGumpID = 0x0052; // Pure black
public const int HeaderGumpID = 0x0E14; // Dark navy blue, textured
public const int EntryGumpID = 0x0BBC; // Light offwhite, textured
public const int BackGumpID = 0x13BE; // Gray slate/stoney
public const int ButtonGumpID = 0x0E14; // Dark navy blue, textured
public const int ButtonWidth = 20;
public const int GoOffsetX = 2, GoOffsetY = 2;
public const int GoButtonID1 = 0x15E1; // Arrow pointing right
public const int GoButtonID2 = 0x15E5; // " pressed
public const int DeleteOffsetX = 1, DeleteOffsetY = 1;
public const int DeleteButtonID1 = 0x0A94; // 'X' Button
public const int DeleteButtonID2 = 0x0A95; // " pressed
public const int PrevWidth = 20;
public const int PrevOffsetX = 2, PrevOffsetY = 2;
public const int PrevButtonID1 = 0x15E3; // Arrow pointing left
public const int PrevButtonID2 = 0x15E7; // " pressed
public const int NextWidth = 20;
public const int NextOffsetX = 2, NextOffsetY = 2;
public const int NextButtonID1 = 0x15E1; // Arrow pointing right
public const int NextButtonID2 = 0x15E5; // " pressed
public const int WipeWidth = 20;
public const int WipeOffsetX = 0, WipeOffsetY = 1;
public const int WipeButtonID1 = 0x0A94; // 'X' Button
public const int WipeButtonID2 = 0x0A95; // " pressed
public const int OffsetSize = 1;
public const int EntryHeight = 20;
public const int BorderSize = 10;
private static bool PrevLabel = false, NextLabel = false, WipeLabel = true;
private const int PrevLabelOffsetX = PrevWidth + 1;
private const int PrevLabelOffsetY = 0;
private const int NextLabelOffsetX = -29;
private const int NextLabelOffsetY = 0;
private const int WipeLabelOffsetX = WipeWidth + 1;
private const int WipeLabelOffsetY = 0;
private const int EntryWidth = 500;
private const int EntryCount = 10;
private const int TotalWidth = OffsetSize + EntryWidth + OffsetSize + (ButtonWidth * 2) + OffsetSize;
private const int TotalHeight = OffsetSize + ((EntryHeight + OffsetSize) * (EntryCount + 2));
private const int BackWidth = BorderSize + TotalWidth + BorderSize;
private const int BackHeight = BorderSize + TotalHeight + BorderSize;
private Mobile m_Owner;
private ArrayList m_Names;
private int m_Page;
private static Mobile m_From;
private static ArrayList m_Dudes;
private static int m_CurPage;
private static int m_Dex;
private string TopTen = "**[Top 10 PvP'ers]**";
private static bool Top10 = true;
private static int HueByRank;
public PlayerScoreGump( Mobile owner ) : this( owner, BuildList( owner ), 0 )
{
}
public PlayerScoreGump( Mobile owner, ArrayList list, int page ) : base( GumpOffsetX, GumpOffsetY )
{
m_Owner = owner;
m_Names = list;
owner.CloseGump( typeof( PlayerScoreGump ) );
Initialize( page );
}
private class InternalComparer : IComparer
{
public static readonly IComparer Rank = new InternalComparer();
public int Compare( object x, object y )
{
PlayerMobile a = x as PlayerMobile;
PlayerMobile b = y as PlayerMobile;
if ( x == null && y == null )
return 0;
else if ( x == null )
return -1;
else if ( y == null )
return 1;
if ( a == null || b == null )
throw new ArgumentException();
if ( a.Wins > b.Wins )
return -1;
else if ( a.Wins < b.Wins )
return 1;
else
return 0;
}
}
public static ArrayList BuildList( Mobile owner )
{
ArrayList list = new ArrayList();
foreach ( Mobile i in World.Mobiles.Values )
{
PlayerMobile pm = i as PlayerMobile;
if ( pm != null )
{
if ( pm.Wins >= 1 && pm.AccessLevel == AccessLevel.Player )
{
if (pm.Wins <= 10)
pm.Hue = 2499;
else if (pm.Wins <= 20)
pm.Hue = 2465;
else if (pm.Wins <= 40)
pm.Hue = 2997;
else if (pm.Wins <= 80)
pm.Hue = 2914;
else if (pm.Wins <= 160)
pm.Hue = 2936;
else if (pm.Wins <= 320)
pm.Hue = 2944;
else if (pm.Wins <= 640)
pm.Hue = 2946;
else if (pm.Wins <= 1280)
pm.Hue = 2947;
else if (pm.Wins <= 2560)
pm.Hue = 2954;
else if (pm.Wins <= 5120)
pm.Hue = 2951;
else if (pm.Wins <= 10240)
pm.Hue = 2463;
else if (pm.Wins <= 9999999)
pm.Hue = 2046;
else
pm.Hue = 0;
list.Add( pm );
}
list.Sort( InternalComparer.Rank );
return list;
}
}
}
public void Initialize( int page )
{
m_Page = page;
int count = m_Names.Count - ( page * EntryCount );
if ( count < 0 )
count = 0;
else if ( count > EntryCount )
count = EntryCount;
int totalHeight = OffsetSize + ((EntryHeight + OffsetSize) * (count + 2));
AddPage( 0 );
AddBackground( 0, 0, BackWidth, BorderSize + totalHeight + BorderSize, BackGumpID );
AddImageTiled( BorderSize, BorderSize, TotalWidth, totalHeight, OffsetGumpID );
int x = BorderSize + OffsetSize;
int y = BorderSize + OffsetSize;
//int emptyWidth = TotalWidth - PrevWidth - NextWidth - (OffsetSize * 4);
int emptyWidth = EntryWidth;
AddImageTiled( x, y, emptyWidth, EntryHeight, EntryGumpID );
AddLabel( x + TextOffsetX, y, 2997, string.Format( "Page {0} of {1} ({2} Competitors) - Deul Score-Board: {3}" + string.Format(Top10 ? TopTen : ""), page+1, (m_Names.Count + EntryCount - 1) / EntryCount, m_Names.Count, m_args) );
x += emptyWidth + OffsetSize;
AddImageTiled( x, y, PrevWidth, EntryHeight, HeaderGumpID );
if ( page > 0 )
AddButton( x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 1, GumpButtonType.Reply, 0 );
if ( PrevLabel )
AddLabel( x + PrevLabelOffsetX, y + PrevLabelOffsetY, 2997, "Previous" );
x += PrevWidth + OffsetSize;
AddImageTiled( x, y, NextWidth, EntryHeight, HeaderGumpID );
if ( (page + 1) * EntryCount < m_Names.Count )
AddButton( x + NextOffsetX, y + NextOffsetY, NextButtonID1, NextButtonID2, 2, GumpButtonType.Reply, 1 );
if ( NextLabel )
AddLabel( x + NextLabelOffsetX, y + NextLabelOffsetY, 2997, "Next" );
for ( int i = 0, index = page * EntryCount; i < EntryCount && index < m_Names.Count; ++i, ++index )
{
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
PlayerMobile ListPlayer = (PlayerMobile)m_Names[index];
AddImageTiled( x, y, EntryWidth, EntryHeight, EntryGumpID );
AddLabelCropped( x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, ListPlayer.Hue,
ListPlayer.Deleted ? "(NULL)" : (string.Format("* Name: {0} * Wins: {1} * Loses: {2} * Rank: {3} *", ListPlayer.Name, ListPlayer.Wins, ListPlayer.Loses, ListPlayer.PvpRank ) ) );
x += EntryWidth + OffsetSize;
AddImageTiled( x, y, ButtonWidth, EntryHeight, ButtonGumpID );
void AddButton( int x, int y, int normalID, int pressedID, int buttonID, GumpButtonType type, int param );
x += ButtonWidth + OffsetSize;
AddImageTiled( x, y, ButtonWidth, EntryHeight, ButtonGumpID );
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
AddImageTiled( x, y, TotalWidth, EntryHeight, EntryGumpID );
AddLabel( x + WipeLabelOffsetX, y + WipeLabelOffsetY, 2997, "Alternate-PK PvP Score-Board" );
}
}
public override void OnResponse( NetState state, RelayInfo info )
{
Mobile from = state.Mobile;
if ( info.ButtonID == 0) // Close
{
}
if ( info.ButtonID == 1) // Previous
{
if ( m_Page > 0 )
{
Top10 = (m_Page - 1) <= 0;
from.SendGump( new PlayerScoreGump( from, m_Names, m_Page - 1 ) );
}
break;
}
if ( info.ButtonID == 2 ) // Next
{
if ( ( m_Page + 1 ) * EntryCount < m_Names.Count )
{
Top10 = (m_Page + 1) <= 0;
from.SendGump( new PlayerScoreGump( from, m_Names, m_Page + 1 ) );
}
break;
}
}
}
}
}

Thanks for all the help guys
ArteGordon- 02-11-2006
you put this line inside of your gump code. It cannot go there. You need to remove it.

QUOTE
x += EntryWidth + OffsetSize; AddImageTiled( x, y, ButtonWidth, EntryHeight, ButtonGumpID ); void AddButton( int x, int y, int normalID, int pressedID, int buttonID, GumpButtonType type, int param ); x += ButtonWidth + OffsetSize;

Asmir02- 02-11-2006
ok well i got one error left to fix i been fixxing a lot of errors today ty guys for helping me
Here is the error

CODE
- Error: Scripts\Custom Made Scripts\Challenge Game\PlayerScoreGump.cs: CS0161: (line 139, column 27) 'Server.Gumps.PlayerScoreGump.BuildList(Server.Mobile)': not all code paths return a value

Here is the script

CODE
using System; using System.Collections; using Server; using Server.Network; using Server.Mobiles;
using Server.Accounting;
namespace Server.Gumps
{
public class PlayerScoreGump : Gump
{
public static void Initialize()
{
Commands.Register( "duelscore", AccessLevel.Player, new CommandEventHandler( PlayerScoreGump_OnCommand ) );
}
public static string m_args;
[Usage( "pvpsb" )]
[Description( "lists ranked pvp competitors" )]
private static void PlayerScoreGump_OnCommand( CommandEventArgs e )
{
e.Mobile.SendGump( new PlayerScoreGump( e.Mobile ) );
}
public const int GumpOffsetX = 30;
public const int GumpOffsetY = 30;
public const int TextHue = 0;
public const int TextOffsetX = 2;
public const int OffsetGumpID = 0x0052; // Pure black
public const int HeaderGumpID = 0x0E14; // Dark navy blue, textured
public const int EntryGumpID = 0x0BBC; // Light offwhite, textured
public const int BackGumpID = 0x13BE; // Gray slate/stoney
public const int ButtonGumpID = 0x0E14; // Dark navy blue, textured
public const int ButtonWidth = 20;
public const int GoOffsetX = 2, GoOffsetY = 2;
public const int GoButtonID1 = 0x15E1; // Arrow pointing right
public const int GoButtonID2 = 0x15E5; // " pressed
public const int DeleteOffsetX = 1, DeleteOffsetY = 1;
public const int DeleteButtonID1 = 0x0A94; // 'X' Button
public const int DeleteButtonID2 = 0x0A95; // " pressed
public const int PrevWidth = 20;
public const int PrevOffsetX = 2, PrevOffsetY = 2;
public const int PrevButtonID1 = 0x15E3; // Arrow pointing left
public const int PrevButtonID2 = 0x15E7; // " pressed
public const int NextWidth = 20;
public const int NextOffsetX = 2, NextOffsetY = 2;
public const int NextButtonID1 = 0x15E1; // Arrow pointing right
public const int NextButtonID2 = 0x15E5; // " pressed
public const int WipeWidth = 20;
public const int WipeOffsetX = 0, WipeOffsetY = 1;
public const int WipeButtonID1 = 0x0A94; // 'X' Button
public const int WipeButtonID2 = 0x0A95; // " pressed
public const int OffsetSize = 1;
public const int EntryHeight = 20;
public const int BorderSize = 10;
private static bool PrevLabel = false, NextLabel = false, WipeLabel = true;
private const int PrevLabelOffsetX = PrevWidth + 1;
private const int PrevLabelOffsetY = 0;
private const int NextLabelOffsetX = -29;
private const int NextLabelOffsetY = 0;
private const int WipeLabelOffsetX = WipeWidth + 1;
private const int WipeLabelOffsetY = 0;
private const int EntryWidth = 500;
private const int EntryCount = 10;
private const int TotalWidth = OffsetSize + EntryWidth + OffsetSize + (ButtonWidth * 2) + OffsetSize;
private const int TotalHeight = OffsetSize + ((EntryHeight + OffsetSize) * (EntryCount + 2));
private const int BackWidth = BorderSize + TotalWidth + BorderSize;
private const int BackHeight = BorderSize + TotalHeight + BorderSize;
private Mobile m_Owner;
private ArrayList m_Names;
private int m_Page;
private static Mobile m_From;
private static ArrayList m_Dudes;
private static int m_CurPage;
private static int m_Dex;
private string TopTen = "**[Top 10 PvP'ers]**";
private static bool Top10 = true;
private static int HueByRank;
public PlayerScoreGump( Mobile owner ) : this( owner, BuildList( owner ), 0 )
{
}
public PlayerScoreGump( Mobile owner, ArrayList list, int page ) : base( GumpOffsetX, GumpOffsetY )
{
m_Owner = owner;
m_Names = list;
owner.CloseGump( typeof( PlayerScoreGump ) );
Initialize( page );
}
private class InternalComparer : IComparer
{
public static readonly IComparer Rank = new InternalComparer();
public int Compare( object x, object y )
{
PlayerMobile a = x as PlayerMobile;
PlayerMobile b = y as PlayerMobile;
if ( x == null && y == null )
return 0;
else if ( x == null )
return -1;
else if ( y == null )
return 1;
if ( a == null || b == null )
throw new ArgumentException();
if ( a.Wins > b.Wins )
return -1;
else if ( a.Wins < b.Wins )
return 1;
else
return 0;
}
}
public static ArrayList BuildList( Mobile owner )
{
ArrayList list = new ArrayList();
foreach ( Mobile i in World.Mobiles.Values )
{
PlayerMobile pm = i as PlayerMobile;
if ( pm != null )
{
if ( pm.Wins >= 1 && pm.AccessLevel == AccessLevel.Player )
{
if (pm.Wins <= 10)
pm.Hue = 2499;
else if (pm.Wins <= 20)
pm.Hue = 2465;
else if (pm.Wins <= 40)
pm.Hue = 2997;
else if (pm.Wins <= 80)
pm.Hue = 2914;
else if (pm.Wins <= 160)
pm.Hue = 2936;
else if (pm.Wins <= 320)
pm.Hue = 2944;
else if (pm.Wins <= 640)
pm.Hue = 2946;
else if (pm.Wins <= 1280)
pm.Hue = 2947;
else if (pm.Wins <= 2560)
pm.Hue = 2954;
else if (pm.Wins <= 5120)
pm.Hue = 2951;
else if (pm.Wins <= 10240)
pm.Hue = 2463;
else if (pm.Wins <= 9999999)
pm.Hue = 2046;
else
pm.Hue = 0;
list.Add( pm );
}
list.Sort( InternalComparer.Rank );
return list;
}
}
}
public void Initialize( int page )
{
m_Page = page;
int count = m_Names.Count - ( page * EntryCount );
if ( count < 0 )
count = 0;
else if ( count > EntryCount )
count = EntryCount;
int totalHeight = OffsetSize + ((EntryHeight + OffsetSize) * (count + 2));
AddPage( 0 );
AddBackground( 0, 0, BackWidth, BorderSize + totalHeight + BorderSize, BackGumpID );
AddImageTiled( BorderSize, BorderSize, TotalWidth, totalHeight, OffsetGumpID );
int x = BorderSize + OffsetSize;
int y = BorderSize + OffsetSize;
//int emptyWidth = TotalWidth - PrevWidth - NextWidth - (OffsetSize * 4);
int emptyWidth = EntryWidth;
AddImageTiled( x, y, emptyWidth, EntryHeight, EntryGumpID );
AddLabel( x + TextOffsetX, y, 2997, string.Format( "Page {0} of {1} ({2} Competitors) - Deul Score-Board: {3}" + string.Format(Top10 ? TopTen : ""), page+1, (m_Names.Count + EntryCount - 1) / EntryCount, m_Names.Count, m_args) );
x += emptyWidth + OffsetSize;
AddImageTiled( x, y, PrevWidth, EntryHeight, HeaderGumpID );
if ( page > 0 )
AddButton( x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 1, GumpButtonType.Reply, 0 );
if ( PrevLabel )
AddLabel( x + PrevLabelOffsetX, y + PrevLabelOffsetY, 2997, "Previous" );
x += PrevWidth + OffsetSize;
AddImageTiled( x, y, NextWidth, EntryHeight, HeaderGumpID );
if ( (page + 1) * EntryCount < m_Names.Count )
AddButton( x + NextOffsetX, y + NextOffsetY, NextButtonID1, NextButtonID2, 2, GumpButtonType.Reply, 1 );
if ( NextLabel )
AddLabel( x + NextLabelOffsetX, y + NextLabelOffsetY, 2997, "Next" );
for ( int i = 0, index = page * EntryCount; i < EntryCount && index < m_Names.Count; ++i, ++index )
{
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
PlayerMobile ListPlayer = (PlayerMobile)m_Names[index];
AddImageTiled( x, y, EntryWidth, EntryHeight, EntryGumpID );
AddLabelCropped( x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, ListPlayer.Hue,
ListPlayer.Deleted ? "(NULL)" : (string.Format("* Name: {0} * Wins: {1} * Loses: {2} * Rank: {3} *", ListPlayer.Name, ListPlayer.Wins, ListPlayer.Loses, ListPlayer.PvpRank ) ) );
x += EntryWidth + OffsetSize;
AddImageTiled( x, y, ButtonWidth, EntryHeight, ButtonGumpID );
x += ButtonWidth + OffsetSize;
AddImageTiled( x, y, ButtonWidth, EntryHeight, ButtonGumpID );
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
AddImageTiled( x, y, TotalWidth, EntryHeight, EntryGumpID );
AddLabel( x + WipeLabelOffsetX, y + WipeLabelOffsetY, 2997, "Alternate-PK PvP Score-Board" );
}
}
public override void OnResponse( NetState state, RelayInfo info )
{
Mobile from = state.Mobile;
if ( info.ButtonID == 0) // Close
{
}
if ( info.ButtonID == 1) // Previous
{
if ( m_Page > 0 )
{
Top10 = (m_Page - 1) <= 0;
from.SendGump( new PlayerScoreGump( from, m_Names, m_Page - 1 ) );
}
}
if ( info.ButtonID == 2 ) // Next
{
if ( ( m_Page + 1 ) * EntryCount < m_Names.Count )
{
Top10 = (m_Page + 1) <= 0;
from.SendGump( new PlayerScoreGump( from, m_Names, m_Page + 1 ) );
}
}
}
}
}

ArteGordon- 02-11-2006
with any method that has a return type, you are required to always return a value of that type.

QUOTE
private class InternalComparer : IComparer { public static readonly IComparer Rank = new InternalComparer(); public int Compare(object x, object y) {
PlayerMobile a = x as PlayerMobile;
PlayerMobile b = y as PlayerMobile;
if (x == null && y == null)
return 0;
else if (x == null)
return -1;
else if (y == null)
return 1;
if (a == null || b == null)
return 0;
if (a.Wins > b.Wins)
return -1;
else if (a.Wins < b.Wins)
return 1;
else
return 0;
}
}

and

QUOTE
public static ArrayList BuildList(Mobile owner) { ArrayList list = new ArrayList(); foreach (Mobile i in World.Mobiles.Values) {
PlayerMobile pm = i as PlayerMobile;
if (pm != null)
{
if (pm.Wins >= 1 && pm.AccessLevel == AccessLevel.Player)
{
if (pm.Wins <= 10)
pm.Hue = 2499;
else if (pm.Wins <= 20)
pm.Hue = 2465;
else if (pm.Wins <= 40)
pm.Hue = 2997;
else if (pm.Wins <= 80)
pm.Hue = 2914;
else if (pm.Wins <= 160)
pm.Hue = 2936;
else if (pm.Wins <= 320)
pm.Hue = 2944;
else if (pm.Wins <= 640)
pm.Hue = 2946;
else if (pm.Wins <= 1280)
pm.Hue = 2947;
else if (pm.Wins <= 2560)
pm.Hue = 2954;
else if (pm.Wins <= 5120)
pm.Hue = 2951;
else if (pm.Wins <= 10240)
pm.Hue = 2463;
else if (pm.Wins <= 9999999)
pm.Hue = 2046;
else
pm.Hue = 0;
list.Add(pm);
}
list.Sort(InternalComparer.Rank);
//return list;
}
}
return list;
}