↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
I am still not completely sure what you are asking but I will give it a shot.
This is the add button method:
void AddButton( int x, int y, int normalID, int pressedID, int buttonID, GumpButtonType type, int param )
int buttonID is what decides what happens when a button is clicked. if ButtonID is 3 then case 3 in the OnResponse method will be fired.
If you want to send a gump then you just need to make sure that the button has the same ID as the case number in the switch statement in the OnRespone method.
I pasted the script you should understand, the button has been added, but after the button, the GUMP page cannot be displayed.
#endregion Edited By: A.A.R
using System;
using System.Text;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using Server;
using Server.Targeting;
using Server.Items;
using Server.ContextMenus;
using Server.Multis;
using Server.Spells;
using Server.Commands;
using Server.Gumps;
using Server.Mobiles;
using Server.Accounting;
using Server.Misc;
using Server.Network;
using Xanthos.Utilities;
namespace Server.Gumps
{
public class GM_StaffKeywords : Gump
{
private PlayerMobile pm;
Mobile caller;
public static void Initialize()
{
Commands.CommandSystem.Register("GM", AccessLevel.GameMaster, new CommandEventHandler(GM_OnCommand));
}
[Usage("GM")]
[Description("Makes A Call To Your Custom Gump.")]
public static void GM_OnCommand(CommandEventArgs e)
{
e.Mobile.SendGump(new GM_StaffKeywords());
}
#region StaffKeywords Gump Configuration
public GM_StaffKeywords() : base( 0, 0 )
{
this.Closable=true;
this.Disposable=true;
this.Dragable=true;
this.Resizable=false;
AddPage(0);
AddBackground(279, 111, 231, 377, 9200);
AddItem(475, 110, 6917);
AddItem(471, 461, 6913);
AddImage(229, 215, 10400);
AddButton(488, 337, 22150, 22151, 0, GumpButtonType.Reply, 0);
AddItem(274, 460, 6914);
AddItem(272, 111, 6916);
AddItem(288, 357, 6920);
AddBackground(299, 124, 199, 352, 9390);
AddAlphaRegion(329, 164, 140, 272);
AddLabel(357, 168, 129, @" 復活我自己");
AddButton( 330, 168, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0 );
AddLabel(357, 188, 129, @" 復活我的寵物");
AddButton(330, 188, 0xFA5, 0xFA7, 2, GumpButtonType.Reply, 0);
AddLabel(357, 208, 129, @" 城市傳送");
AddButton(330, 208, 0xFA5, 0xFA7, 3, GumpButtonType.Reply, 0);
AddLabel(357, 228, 129, @" 召回我的寵物");
AddButton(330, 228, 0xFA5, 0xFA7, 4, GumpButtonType.Reply, 0);
AddLabel(357, 248, 129, @" 待添加項目");
AddButton(330, 248, 0xFA5, 0xFA7, 5, GumpButtonType.Reply, 0);
AddLabel(357, 268, 129, @" 待添加項目");
AddButton(330, 268, 0xFA5, 0xFA7, 6, GumpButtonType.Reply, 0);
AddLabel(357, 288, 129, @" 待添加項目");
AddButton(330, 288, 0xFA5, 0xFA7, 7, GumpButtonType.Reply, 0);
AddLabel(357, 308, 129, @" 待添加項目");
AddButton(330, 288, 0xFA5, 0xFA7, 8, GumpButtonType.Reply, 0);
AddLabel(357, 328, 129, @" 待添加項目");
AddButton(330, 328, 0xFA5, 0xFA7, 9, GumpButtonType.Reply, 0);
AddLabel(339, 127, 695, @"HELP 快捷系統");
AddLabel(347, 454, 0, @"Xi'an New World");
AddImage(478, 232, 10411);
}
↑↑↑↑↑↑↑↑↑↑↑↑ Above is to add a button, has displayed properly in the game.↑↑↑↑↑↑↑↑↑↑↑↑
#endregion Edited By: A.A.R
public static void DoThis(Mobile from, string command)
{
}
public override void OnResponse(NetState sender, RelayInfo info)
{
Mobile from = sender.Mobile;
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓The following is the sequence, need to write the corresponding set button to trigger. Now I do not know how to modify, always error. Statement cannot be passed.↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
switch (info.ButtonID)
{
case 0:
{
from.CloseGump(typeof(GM_StaffKeywords));
break;
}
case 1:
{
pm.SendGump(new ResurrectGump(pm));
break;
}
case 2:
{
pm.SendGump(new ResurrectGump(pm));//Triggers may need one command, for example, where required command to activate, how to override?
break;
}
case 3:
{
//DoThis(from, "Moongen"); // GUMP world months, here.
sender.Mobile.SendGump(new MoongateGump(from, sender.Mobile));
break;
}
case 4:
{
pm.SendGump(new ResurrectGump(pm));
break;
}
case 5:
{
pm.SendGump(new ResurrectGump(pm));
break;
}
case 6:
{
pm.SendGump(new ResurrectGump(pm));
break;
}
case 7:
{
pm.SendGump(new ResurrectGump(pm));
break;
}
case 8:
{
pm.SendGump(new ResurrectGump(pm));
break;
}
case 9:
{
pm.SendGump(new ResurrectGump(pm));
break;
}
}
}
}
}