zerodowned

Moderator
Can't figure out why this gump won't come up when I use the command.
I don't get an invalid command response, nor do I get the Message sent from the command method for testing.

Must be something simple that I'm overlooking

Code:
using System;
using Server;
using Server.Gumps;
using Server.Network;
using Server.Commands;
using System.Collections.Generic;
using Server.Mobiles;

namespace Server.Gumps
{
    public class TestGump : Gump
    {
        List<string> AttName = new List<string>() { "Bonus", "Bonus", "Bonus" };
       
        Mobile caller;

        public static void Initialize()
        {
            CommandSystem.Register("Test", AccessLevel.Player, new CommandEventHandler(Test_OnCommand));

        }

        [Usage("Test")]
        [Description("Test gunno")]
        public static void Test_OnCommand(CommandEventArgs e)
        {
            /* if (e.Mobile.HasGump(typeof(TestGump)))
                e.Mobile.CloseGump(typeof(TestGump));
                 */
            e.Mobile.SendGump(new TestGump(e.Mobile));
            e.Mobile.SendMessage("TESTING");
        }

        public TestGump(Mobile m) : base( 100, 100 )
        {
           caller = m;

           AttName =

            this.Closable=true;
            this.Disposable=true;
            this.Dragable=true;
            this.Resizable=false;

            AddPage(0);

            AddBackground(71, 41, 374, 525, 9270);
            AddImageTiled(85, 56, 346, 496, 9354); //white background

            AddButton(429, 41, 22150, 248, 0, GumpButtonType.Reply, 0); // close button

            AddHtml( 87, 56, 343, 34, @"Test", (bool)false, (bool)false);

            AddHtml( 88, 91, 339, 26, @"test", (bool)false, (bool)false);
            AddImageTiled(87, 124, 341, 21, 10004); // exp bar background
            AddImageTiled(90, 126, 250, 17, 30073); // exp green bar
            AddHtml( 92, 122, 332, 22, @"test", (bool)false, (bool)false);

            //var AttNameCount = Enum.GetNames(typeof(AttName)).Length;

            for( int i = 0; i > AttName.Count; i++ )
            {
                AddButton(90, 157 + ((15*i)*i), 22153, 248, 0, GumpButtonType.Reply, 0); // |?| 1
                AddHtml( 110, 155 + ((15*i)*i), 155, 22, AttName[i], (bool)false, (bool)false); // label 1
                AddButton(284, 158 + ((15*i)*i), 5401, 248, 0, GumpButtonType.Reply, 0); // |-| 1
                AddButton(330, 158 + ((15*i)*i), 5402, 248, 0, GumpButtonType.Reply, 0); // |+| 1
                AddHtml( 353, 155 + ((15*i)*i), 69, 22, AttName[i] + " Count", (bool)false, (bool)false); // amount 1
            }

            /* AddButton(90, 181, 22153, 248, 0, GumpButtonType.Reply, 0); // |?|2
            AddHtml( 110, 179, 155, 22, @"bonus hits", (bool)false, (bool)false); // 2
            AddButton(284, 182, 5401, 248, 0, GumpButtonType.Reply, 0); // |-|2
            AddButton(330, 182, 5402, 248, 0, GumpButtonType.Reply, 0); // |+|2
            AddHtml( 353, 179, 69, 22, @"bonus hits amount", (bool)false, (bool)false); // 2

            AddButton(90, 209, 22153, 248, 0, GumpButtonType.Reply, 0);
            AddHtml( 110, 207, 155, 22, @"bonus hits", (bool)false, (bool)false);
            AddButton(284, 210, 5401, 248, 0, GumpButtonType.Reply, 0);
            AddButton(330, 210, 5402, 248, 0, GumpButtonType.Reply, 0);
            AddHtml( 353, 207, 69, 22, @"bonus hits amount", (bool)false, (bool)false); */

           
            AddButton(350, 526, 5204, 248, 0, GumpButtonType.Reply, 0); // cancel
            AddBackground(349, 514, 81, 39, 9250);
            AddHtml( 352, 521, 76, 22, @"<Center><big>Cancel</big></center>", (bool)false, (bool)false);

            AddButton(87, 525, 5200, 248, 0, GumpButtonType.Reply, 0); // apply
            AddBackground(85, 514, 81, 39, 9250);
            AddHtml( 86, 523, 76, 22, @"<Center><big>Apply</big></center>", (bool)false, (bool)false);

           
        }

       

        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile from = sender.Mobile;

            switch(info.ButtonID)
            {
                                case 0:
                {

                    break;
                }

            }
        }
    }
}
 
Make sure there is no other command "Test" that's replacing your gumps' "Test" command

All of your AddButton methods use the same button ID, I'm not sure how the client will cope with having multiple buttons of the same ID.

All of the buttons also have 248 for the "pressed" image ID, though this is just a visual tweak you're probably aware of.

Code:
for(int i =0; i > AttName.Count; i++)
> greater than should be < less than.

Tip: If 'AttName' is never dynamically modified with Add/Remove, consider using a static string[] field instead.
 
This loads for me.

Code:
using System;
using Server;
using Server.Gumps;
using Server.Network;
using Server.Commands;
using System.Collections.Generic;
using Server.Mobiles;

namespace Server.Gumps
{
    public class TestGump : Gump
    {
        private List<string> AttName = new List<string>() { "Bonus", "Bonus", "Bonus" };
		private Mobile m_From;
		
        public static void Initialize()
        {
            CommandSystem.Register("MyTestGump", AccessLevel.Player, new CommandEventHandler(Test_OnCommand));
        }

        [Usage("MyTestGump")]
        [Description("Test gump")]
        public static void Test_OnCommand(CommandEventArgs e)
        {
			e.Mobile.SendMessage("[DEBUG]" + "Sending MyTestGump!");
            e.Mobile.SendGump(new TestGump(e.Mobile));
        }
	
        public TestGump(Mobile from) : base( 100, 100 )
        {
			m_From = from;
			// AttName =

			this.Closable=true;
			this.Disposable=true;
			this.Dragable=true;
			this.Resizable=false;

			AddPage(0);

			AddBackground(71, 41, 374, 525, 9270);
			AddImageTiled(85, 56, 346, 496, 9354); //white background

			AddButton(429, 41, 22150, 248, 400, GumpButtonType.Reply, 0); // close button

			AddHtml( 87, 56, 343, 34, @"Test", (bool)false, (bool)false);

			AddHtml( 88, 91, 339, 26, @"test", (bool)false, (bool)false);
			AddImageTiled(87, 124, 341, 21, 10004); // exp bar background
			AddImageTiled(90, 126, 250, 17, 30073); // exp green bar
			AddHtml( 92, 122, 332, 22, @"test", (bool)false, (bool)false);

			//var AttNameCount = Enum.GetNames(typeof(AttName)).Length;

			for( int i = 0; i > AttName.Count; i++ )
			{
				AddButton(90, 157 + ((15*i)*i), 22153, 248, 0, GumpButtonType.Reply, 0); // |?| 1
				AddHtml( 110, 155 + ((15*i)*i), 155, 22, AttName[i], (bool)false, (bool)false); // label 1
				AddButton(284, 158 + ((15*i)*i), 5401, 248, 0, GumpButtonType.Reply, 0); // |-| 1
				AddButton(330, 158 + ((15*i)*i), 5402, 248, 0, GumpButtonType.Reply, 0); // |+| 1
				AddHtml( 353, 155 + ((15*i)*i), 69, 22, AttName[i] + " Count", (bool)false, (bool)false); // amount 1
			}

			/* AddButton(90, 181, 22153, 248, 0, GumpButtonType.Reply, 0); // |?|2
			AddHtml( 110, 179, 155, 22, @"bonus hits", (bool)false, (bool)false); // 2
			AddButton(284, 182, 5401, 248, 0, GumpButtonType.Reply, 0); // |-|2
			AddButton(330, 182, 5402, 248, 0, GumpButtonType.Reply, 0); // |+|2
			AddHtml( 353, 179, 69, 22, @"bonus hits amount", (bool)false, (bool)false); // 2

			AddButton(90, 209, 22153, 248, 0, GumpButtonType.Reply, 0);
			AddHtml( 110, 207, 155, 22, @"bonus hits", (bool)false, (bool)false);
			AddButton(284, 210, 5401, 248, 0, GumpButtonType.Reply, 0);
			AddButton(330, 210, 5402, 248, 0, GumpButtonType.Reply, 0);
			AddHtml( 353, 207, 69, 22, @"bonus hits amount", (bool)false, (bool)false); */


			AddButton(350, 526, 5204, 248, 0, GumpButtonType.Reply, 0); // cancel
			AddBackground(349, 514, 81, 39, 9250);
			AddHtml( 352, 521, 76, 22, @"<Center><big>Cancel</big></center>", (bool)false, (bool)false);

			AddButton(87, 525, 5200, 248, 0, GumpButtonType.Reply, 0); // apply
			AddBackground(85, 514, 81, 39, 9250);
			AddHtml( 86, 523, 76, 22, @"<Center><big>Apply</big></center>", (bool)false, (bool)false);
        }

        public override void OnResponse(NetState sender, RelayInfo info)
        {
            switch(info.ButtonID)
            {
				case 0: return; 
				case 400: return; 
            }
        }
    }
}
 
Thank you for the help, this was the conflicting command in the repo: https://github.com/ServUO/ServUO/bl...c281ba7e56bb622b/Scripts/Commands/Test.cs#L13

Was only checking in my Customs folder because I didn't think there was any chance the repo had a "Test" command

Make sure there is no other command "Test" that's replacing your gumps' "Test" command

All of your AddButton methods use the same button ID, I'm not sure how the client will cope with having multiple buttons of the same ID.

All of the buttons also have 248 for the "pressed" image ID, though this is just a visual tweak you're probably aware of.

Code:
for(int i =0; i > AttName.Count; i++)
> greater than should be < less than.

Tip: If 'AttName' is never dynamically modified with Add/Remove, consider using a static string[] field instead.

I often don't set the pressed image id or the button ID during the design phase of a gump.The client has never had issues with it.

Thank you for pointing out the i > AttName error and making the list static I changed it to this
Code:
private static readonly List<string> AttName = new List<string>
        (
            new string[]
            {
                "Bonus Hits",
                "Bonus Stamina",
                "Bonus Mana",
                "Hits Regen",
                "Stamina Regen",
                "Mana Regen",
                "Weapon Critical Hit %",
                "Spell Critical Hit %",
                "Critical Hit Multiplier",
                "Melee Proficency"
            }
        );

Could be something to do with line 38. Kinda surprised it compiled.
lol yeah that wouldn't have compiled. was just me being tired and needing to go to bed
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back