I would like to make a custom GUMP for the "checkmobfactions" command on my shard. I have added
quite a few more factions to the list and it's all working properly, but I'd like to make a fancier GUMP to look at it with. I tried to use GUMP Studio, but it's giving me a register error.

So, I'd like to start one from scratch but I don't know how to call the XMLMobFactions attribute data.
Here is my GUMP, it wont compile, and I'm not sure why.

Code:
//////////////////////////////////////////////////////////////////////
// Automatically generated by Bradley's GumpStudio and roadmaster's
// exporter.dll,  Special thanks goes to Daegon whose work the exporter
// was based off of, and Shadow wolf for his Template Idea.
//////////////////////////////////////////////////////////////////////
//#define RunUo2_0

using System;
using Server;
using Server.Gumps;
using Server.Network;
using Server.Commands;

namespace Server.Gumps
{
    public class XMLvirtuegump : Gump
    {
        Mobile caller;

        public static void Initialize()
        {
#if(RunUo2_0)
            CommandSystem.Register("XMLvirtuegump", AccessLevel.Administrator, new CommandEventHandler(XMLvirtuegump_OnCommand));
#else
            Register("XMLvirtuegump", AccessLevel.Administrator, new CommandEventHandler(XMLvirtuegump_OnCommand));
#endif
        }

        [Usage("XMLvirtuegump")]
        [Description("Makes a call to your custom gump.")]
        public static void XMLvirtuegump_OnCommand(CommandEventArgs e)
        {
            caller = e.Mobile;

            if (caller.HasGump(typeof(XMLvirtuegump)))
                caller.CloseGump(typeof(XMLvirtuegump));
            caller.SendGump(new XMLvirtuegump(caller));
        }

        public XMLvirtuegump(Mobile from) : this()
        {
            caller = from;
        }

        public XMLvirtuegump() : base( 0, 0 )
        {
            this.Closable=true;
            this.Disposable=true;
            this.Dragable=true;
            this.Resizable=false;

            AddPage(0);
            AddBackground(45, 37, 420, 367, 9200);
            AddImage(242, 51, 113);
            AddImage(223, 1, 9000);
            AddLabel(69, 130, 0, @"Honesty"); //AddHTML(100,130, 0, 0, 1234, false, false);
            AddLabel(69, 160, 0, @"Compassion");
            AddLabel(69, 190, 0, @"Valor");
            AddLabel(69, 220, 0, @"Justice");
            AddLabel(69, 250, 0, @"Sacrifice");
            AddLabel(69, 280, 0, @"Honor");
            AddLabel(69, 310, 0, @"Spirituality");
            AddLabel(69, 340, 0, @"Humility");
            AddLabel(250, 130, 0, @"Deceit");
            AddLabel(250, 160, 0, @"Despise");
            AddLabel(250, 190, 0, @"Destard");
            AddLabel(250, 220, 0, @"Wrong");
            AddLabel(250, 250, 0, @"Covetous");
            AddLabel(250, 280, 0, @"Shame");
            AddLabel(250, 310, 0, @"Hyloth");
            AddLabel(250, 340, 0, @"Pride");
            AddImage(432, -1, 10441, 141);
            AddImage(-5, -1, 10440, 4);
          

          
        }

      

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

            switch(info.ButtonID)
            {
                                case 0:
                {

                    break;
                }

            }
        }
    }
}

And here is the error:

Code:
----------------------------------------------------------------------------
JustUO - [http://www.playuo.org] Version 2.0
Publish 4
Core: .NET Framework Version 4.0.30319
Core: Optimizing for 8 64-bit processors
Core: Server garbage collection mode enabled
RandomImpl: CSPRandom (Software)
Scripts: Compiling C# scripts...Failed with: 1 errors, 0 warnings
Errors:
+ Custom Systems/XMLvirtuegump.cs:
    CS0103: Line 26: The name 'Register' does not exist in the current context
    CS0120: Line 34: An object reference is required for the non-static field, m
ethod, or property 'Server.Gumps.XMLvirtuegump.caller'
    CS0120: Line 36: An object reference is required for the non-static field, m
ethod, or property 'Server.Gumps.XMLvirtuegump.caller'
    CS0120: Line 37: An object reference is required for the non-static field, m
ethod, or property 'Server.Gumps.XMLvirtuegump.caller'
    CS0120: Line 38: An object reference is required for the non-static field, m
ethod, or property 'Server.Gumps.XMLvirtuegump.caller'
    CS0120: Line 38: An object reference is required for the non-static field, m
ethod, or property 'Server.Gumps.XMLvirtuegump.caller'
    CS0103: Line 57: The name 'AddHTML' does not exist in the current context
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
 
Do you need anything at the top of this for the XML?\--------
------------------------------------------------------------------------------------------------------------------------
I would take this out-- I'm not sure why it's reading the html when it has //

// Register("XMLvirtuegump", AccessLevel.Administrator, new CommandEventHandler(XMLvirtuegump_OnCommand));
---------------------------------------------------------------------------------------------
After
private static void Gingerbreadquestgump_OnCommand( CommandEventArgs e )
{
----------------------------------------------------------------------
All my gump quests have this: after this goes on for the addimage etc.

  1. {
    e.Mobile.SendGump( new Gingerbreadquestgump( e.Mobile ) );
    }

    public Gingerbreadquestgump(Mobile owner)
    : base(50, 50)
    {
    this.Closable=true;
    this.Disposable=true;
    this.Dragable=true;
    this.Resizable=false;
 
Last edited:
Great! I made these changes and I can get the GUMP to compile now!

So, how do I go about adding values to the GUMP? I want to place XMLMobfactions values next to each label.
How do I go about calling those values?

Is there a good tutorial that I can access? I've googled around, but
I can't find a basic tutorial on standard GUMP programming.
 
I'm not sure how to reference XmlMobFactions data correctly. Here is the code I've found in XmlMobFactions.cs that fills the default GUMP with faction data:

Code:
public override string OnIdentify(Mobile from)
        {
            // dont let other people identify your faction standings
            if(AttachedTo is Mobile && (from != (Mobile)AttachedTo && from != null && from.AccessLevel == AccessLevel.Player)) return null;

            // display the faction status in a gump
            StringBuilder gumpmsg = new StringBuilder();

            gumpmsg.AppendFormat("\n{0,-15}{1,-15}{2,-10}\n",
                "Mob Faction","Standing","Level");
            if(FactionList != null)
                foreach(GroupStatus g in FactionList)
                {
                    gumpmsg.AppendFormat("{0,-15}{1,-15}{2,-10}\n",
                        g.GroupType, GetTitle(g.FactionLevel), g.FactionLevel);
                }


            if(from != null)
            {
                from.CloseGump(typeof(MobFactionGump));
                from.SendGump(new MobFactionGump(from, this, gumpmsg.ToString()));
            }
            string msg = null;

            if(Expiration > TimeSpan.Zero)
            {
                msg = String.Format("{0}expires in {0} mins ", msg, Expiration.TotalMinutes);
            }

            if(Refractory > TimeSpan.Zero)
            {
                return String.Format("{0}with a minimum of {1} secs between gains",msg, Refractory.TotalSeconds);
            }
            else
                return msg;
        }

That part where g.FactionLevel happens I don't quite understand. I get that it's iterating over the
list of Factions defined, but I'd like to find a way to call each one independently and add the value
to an HTML string in my Gump.

Can anyone help me decipher this?
 
Back