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!

cant see the text in my gump

Murzin

Knight
i gotta say, that looks a lot like my travel book i wrote a few years ago other than using dynamic list rather than static list, and no factions sigil check.

not sure i see a way to add entries to the travel book either, until you add some entries it wont have anything to display.
 

m309

Squire
bryant,

Just change the background to something lighter.

Code:
AddBackground( 0, 0, 380, 520, 5054 ); //280

Change the 5054 to another background set.
 

bryant

Sorceror
yes this is just the portion of the script that i thought would be where you change color of text in gump.
its very possible this is your script it was downloaded from runuo 1.0 about 6 7 years ago.
 

m309

Squire
Changing the background won't change the text, but it will make the backing lighter. Same effect if you can't see it.
 

bryant

Sorceror
(2 last questions)
Say i wanted to change the color of the text where would i do this in my script. Also its been a while since if been here and cant remember how to get my code into brackets on website to make it look like it does in script.
 

m309

Squire
If you go to "More Options" at the bottom of the reply box, there is a button for code - you can insert it that way. Stick the entire script in.
 

Hammerhand

Knight
On the 2nd question, look just above where you write your post, in the white field.. See the button with the {} Click on that & post the script in there.
 

Vorspire

Knight
My personal favourite:
Code:
String.Format("<basefont color=#{0:X6}>{1}<basefont color=#FFFFFF>", System.Drawing.Color.SkyBlue.ToArgb(), "Some text to wrap in color." );
<basefont> is a nice tag to use in UO HTML supported places like gumps or hover-property list, but the </basefont> tag can break things, so the best thing to do is simply set the color back to white (FFFFFF) instead of using the closing tag.
 

Vorspire

Knight
Your edit won't compile like that...

Replace this;
Code:
AddHtml( 30, 35 + (i * 25), 150, 20, checkLists[i].Text, false, false );

With this;
Code:
AddHtml( 30, 35 + (i * 25), 150, 20, String.Format("<basefont color=#{0:X6}>{1}", System.Drawing.Color.SkyBlue.ToArgb(), checkLists[i].Text ), false, false );

(There's no need to close the <basefont> tag here, or even reset to white, because the Html will only have one piece of text, so it would be a waste of time to reset the color)

If you want to change the color from SkyBlue, just pick another named color. If you're using NotePad to develop instead of NotePad++ or Visual Studio, you can find a list of available Colors here: http://msdn.microsoft.com/en-gb/library/system.drawing.color.aspx

Be wary though, ToArgb() returns a 32-bit representation of a color, AddHtmlLocalized only supports 16-bit ARGB-555, meaning that you have to convert the color value if you wanted to use it with AddHtmlLocalized (In this case, you don't need to worry about that)
 

bryant

Sorceror
Vorspire thanks for the help was very helpful.
i have found one more problem with my public gates gump as well.
i Have updated it so far and no errors but the problem is the world maps text dosent show up until i click on icon to the left how can i have text show all he time?

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

namespace Server.Items
{
    public class PublicMoongate : Item
    {
        [Constructable]
        public PublicMoongate() : base( 0xF6C )
        {
            Movable = false;
            Light = LightType.Circle300;
        }

        public PublicMoongate( Serial serial ) : base( serial )
        {
        }

        public override void OnDoubleClick( Mobile from )
        {
            if ( !from.Player )
                return;

            if ( from.InRange( GetWorldLocation(), 1 ) )
                UseGate( from );
            else
                from.SendLocalizedMessage( 500446 ); // That is too far away.
        }

        public override bool OnMoveOver( Mobile m )
        {
            return !m.Player || UseGate( m );
        }

        public bool UseGate( Mobile m )
        {
            if ( m.Criminal )
            {
                m.SendLocalizedMessage( 1005561, "", 0x22 ); // Thou'rt a criminal and cannot escape so easily.
                return false;
            }
            else if ( Server.Spells.SpellHelper.CheckCombat( m ) )
            {
                m.SendLocalizedMessage( 1005564, "", 0x22 ); // Wouldst thou flee during the heat of battle??
                return false;
            }
            else if ( m.Spell != null )
            {
                m.SendLocalizedMessage( 1049616 ); // You are too busy to do that at the moment.
                return false;
            }
            else
            {
                m.CloseGump( typeof( MoongateGump ) );
                m.SendGump( new MoongateGump( m, this ) );

                if ( !m.Hidden || m.AccessLevel == AccessLevel.Player )
                    Effects.PlaySound( m.Location, m.Map, 0x20E );

                return true;
            }
        }

        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );

            writer.Write( (int) 0 ); // version
        }

        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();
        }

        public static void Initialize()
        {
            Server.Commands.Register( "MoonGen", AccessLevel.Administrator, new CommandEventHandler( MoonGen_OnCommand ) );
        }

        [Usage( "MoonGen" )]
        [Description( "Generates public moongates. Removes all old moongates." )]
        public static void MoonGen_OnCommand( CommandEventArgs e )
        {
            DeleteAll();

            int count = 0;

            count += MoonGen( PMList.Trammel );
            count += MoonGen( PMList.Felucca );
            count += MoonGen( PMList.Ilshenar );
            count += MoonGen( PMList.Malas );
            count += MoonGen( PMList.Tokuno );

            World.Broadcast( 0x35, true, "{0} moongates generated.", count );
        }

        private static void DeleteAll()
        {
            ArrayList list = new ArrayList();

            foreach ( Item item in World.Items.Values )
            {
                if ( item is PublicMoongate )
                    list.Add( item );
            }

            foreach ( Item item in list )
                item.Delete();

            if ( list.Count > 0 )
                World.Broadcast( 0x35, true, "{0} moongates removed.", list.Count );
        }

        private static int MoonGen( PMList list )
        {
            foreach ( PMEntry entry in list.Entries )
            {
                Item item = new PublicMoongate();

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

                if ( entry.Text == "Umbra" ) // Umbra
                    item.Hue = 0x497;

            }

            return list.Entries.Length;
        }
    }

    public class PMEntry
    {
        private Point3D m_Location;
        private string m_Text;

        public Point3D Location
        {
            get
            {
                return m_Location;
            }
        }

        public string Text
        {
            get
            {
                return m_Text;
            }
        }

        public PMEntry( Point3D loc, string text )
        {
            m_Location = loc;
            m_Text = text;
        }
    }

    public class PMList
    {
        private String m_Text, m_SelText;
        private Map m_Map;
        private PMEntry[] m_Entries;

        public String Text
        {
            get
            {
                return m_Text;
            }
        }

        public String SelText
        {
            get
            {
                return m_SelText;
            }
        }

        public Map Map
        {
            get
            {
                return m_Map;
            }
        }

        public PMEntry[] Entries
        {
            get
            {
                return m_Entries;
            }
        }

        public PMList( string text, string selText, Map map, PMEntry[] entries )
        {
            m_Text = Text;
            m_SelText = selText;
            m_Map = map;
            m_Entries = entries;
        }

        public static readonly PMList Trammel =
            new PMList( "Trammel", "Trammel", Map.Trammel, new PMEntry[]
                {
                    new PMEntry( new Point3D( 4467, 1283, 5 ), "Moonglow" ), // Moonglow
                    new PMEntry( new Point3D( 1336, 1997, 5 ), "Britain" ), // Britain
                    new PMEntry( new Point3D( 1499, 3771, 5 ), "Jhelom" ), // Jhelom
                    new PMEntry( new Point3D(  771,  752, 5 ), "Yew" ), // Yew
                    new PMEntry( new Point3D( 2701,  692, 5 ), "Minoc" ), // Minoc
                    new PMEntry( new Point3D( 1828, 2948,-20), "Trinsic" ), // Trinsic
                    new PMEntry( new Point3D(  643, 2067, 5 ), "Skara Brae" ), // Skara Brae
                    new PMEntry( new Point3D( 3563, 2139, 34), "Magincia" ), // Magincia
                    new PMEntry( new Point3D( 3763, 2771, 50), "Haven" ),  // Haven
                    new PMEntry( new Point3D( 7056, 382, 0), "HartWood" ),
                    new PMEntry( new Point3D( 3682, 1280, 25), "Lost Lands Museum" )
                } );

        public static readonly PMList Felucca =
            new PMList( "Felucca" , "Felucca", Map.Felucca, new PMEntry[]
                {
                new PMEntry( new Point3D( 4467, 1283, 5 ), "Moonglow" ), // Moonglow
                    new PMEntry( new Point3D( 1336, 1997, 5 ), "Britain" ), // Britain
                    new PMEntry( new Point3D( 1499, 3771, 5 ), "Jhelom" ), // Jhelom
                    new PMEntry( new Point3D(  771,  752, 5 ), "Yew" ), // Yew
                    new PMEntry( new Point3D( 2701,  692, 5 ), "Minoc" ), // Minoc
                    new PMEntry( new Point3D( 1828, 2948,-20), "Trinsic" ), // Trinsic
                    new PMEntry( new Point3D(  643, 2067, 5 ), "Skara Brae" ), // Skara Brae
                    new PMEntry( new Point3D( 3563, 2139, 34), "Magincia" ), // Magincia
                    new PMEntry( new Point3D( 2711, 2234, 0 ), "Buccaneer's Den" )  // Buccaneer's Den
                } );

        public static readonly PMList Ilshenar =
            new PMList( "Ilshenar", "Ilshenar", Map.Ilshenar, new PMEntry[]
                {
                new PMEntry( new Point3D( 1215,  467, -13 ), "Compassion" ), // Compassion
                    new PMEntry( new Point3D(  722, 1366, -60 ), "Honesty" ), // Honesty
                    new PMEntry( new Point3D(  744,  724, -28 ), "Honor" ), // Honor
                    new PMEntry( new Point3D(  281, 1016,   0 ), "Humility" ), // Humility
                    new PMEntry( new Point3D(  987, 1011, -32 ), "Justice" ), // Justice
                    new PMEntry( new Point3D( 1174, 1286, -30 ), "Sacrifice" ), // Sacrifice
                    new PMEntry( new Point3D( 1532, 1340, - 3 ), "Spirituality" ), // Spirituality
                    new PMEntry( new Point3D(  528,  216, -45 ), "Valor" ), // Valor
                    new PMEntry( new Point3D( 1721,  218,  96 ), "Chaos" )  // Chaos
                } );

        public static readonly PMList Malas =
            new PMList( "Malas", "Malas", Map.Malas, new PMEntry[]
                {
                    new PMEntry( new Point3D( 1015,  527, -65 ), "Luna" ), // Luna
                    new PMEntry( new Point3D( 1997, 1386, -85 ), "Umbra" )  // Umbra
                } );

        public static readonly PMList Tokuno =
            new PMList( "Tokuno", "Tokuno", Map.Tokuno, new PMEntry[]
                {
                    new PMEntry( new Point3D( 1169,  998, 41 ), "Isamu-Jima" ), // Isamu-Jima
                    new PMEntry( new Point3D(  802, 1204, 25 ), "Makoto-Jima" ), // Makoto-Jima
                    new PMEntry( new Point3D(  270,  628, 15 ), "Homare-Jima" ) // Homare-Jima
                } );

        public static readonly PMList[] UORLists        = new PMList[] { Trammel, Felucca };
        public static readonly PMList[] UORlistsYoung    = new PMList[] { Trammel };
        public static readonly PMList[] LBRLists        = new PMList[] { Trammel, Felucca, Ilshenar };
        public static readonly PMList[] LBRListsYoung    = new PMList[] { Trammel, Ilshenar };
        public static readonly PMList[] AOSLists        = new PMList[] { Trammel, Felucca, Ilshenar, Malas };
        public static readonly PMList[] AOSListsYoung    = new PMList[] { Trammel, Ilshenar, Malas };
        public static readonly PMList[] SELists            = new PMList[] { Trammel, Felucca, Ilshenar, Malas, Tokuno };
        public static readonly PMList[] SEListsYoung    = new PMList[] { Trammel, Ilshenar, Malas, Tokuno };
        public static readonly PMList[] RedLists        = new PMList[] { Felucca, Malas, Tokuno, Ilshenar, Trammel };
        public static readonly PMList[] SigilLists        = new PMList[] { Felucca };
    }

    public class MoongateGump : Gump
    {
        private Mobile m_Mobile;
        private Item m_Moongate;
        private PMList[] m_Lists;

        public MoongateGump( Mobile mobile, Item moongate ) : base( 100, 100 )
        {
            m_Mobile = mobile;
            m_Moongate = moongate;

            PMList[] checkLists;

            if ( mobile.Player )
            {
                if ( Factions.Sigil.ExistsOn( mobile ) )
                {
                    checkLists = PMList.SigilLists;
                }
                else if ( mobile.Kills >= 5 )
                {
                    checkLists = PMList.RedLists;
                }
                else
                {
                    int flags = mobile.NetState == null ? 0 : mobile.NetState.Flags;
                    bool young = mobile is PlayerMobile ? ((PlayerMobile)mobile).Young : false;

                    if ( Core.SE && (flags & 0x10) != 0 )
                        checkLists = young ? PMList.SEListsYoung : PMList.SELists;
                    else if ( Core.AOS && (flags & 0x8) != 0 )
                        checkLists = young ? PMList.AOSListsYoung : PMList.AOSLists;
                    else if ( (flags & 0x4) != 0 )
                        checkLists = young ? PMList.LBRListsYoung : PMList.LBRLists;
                    else
                        checkLists = young ? PMList.UORlistsYoung : PMList.UORLists;
                }
            }
            else
            {
                checkLists = PMList.SELists;
            }

            m_Lists = new PMList[checkLists.Length];

            for ( int i = 0; i < m_Lists.Length; ++i )
                m_Lists[i] = checkLists[i];

            for ( int i = 0; i < m_Lists.Length; ++i )
            {
                if ( m_Lists[i].Map == mobile.Map )
                {
                    PMList temp = m_Lists[i];

                    m_Lists[i] = m_Lists[0];
                    m_Lists[0] = temp;

                    break;
                }
            }

            AddPage( 0 );

            AddBackground( 0, 0, 380, 380, 5054 );

            AddButton( 10, 210, 4005, 4007, 1, GumpButtonType.Reply, 0 );
//            AddHtmlLocalized( 45, 210, 140, 25, 1011036, false, false ); // OKAY
                        AddHtml( 45, 210, 140, 25, String.Format("<basefont color=#{0:X6}>{1}", System.Drawing.Color.Maroon.ToArgb(), "OKAY" ), false, false );

            AddButton( 10, 235, 4005, 4007, 0, GumpButtonType.Reply, 0 );
//            AddHtmlLocalized( 45, 235, 140, 25, 1011012, false, false ); // CANCEL
                    AddHtml( 45, 235, 140, 25, String.Format("<basefont color=#{0:X6}>{1}", System.Drawing.Color.Maroon.ToArgb(), "CANCEL" ), false, false );

//            AddHtmlLocalized( 5, 5, 200, 20, 1012011, false, false ); // Pick your destination:
                        AddHtml( 5, 5, 200, 20, String.Format("<basefont color=#{0:X6}>{1}", System.Drawing.Color.Maroon.ToArgb(), "Pick your destination:" ), false, false );

            for ( int i = 0; i < checkLists.Length; ++i )
            {
                AddButton( 10, 35 + (i * 25), 2117, 2118, 0, GumpButtonType.Page, Array.IndexOf( m_Lists, checkLists[i] ) + 1 );
//                AddHtmlLocalized( 30, 35 + (i * 25), 150, 20, checkLists[i].Text, false, false );
                                AddHtml( 30, 35 + (i * 25), 150, 20, String.Format("<basefont color=#{0:X6}>{1}", System.Drawing.Color.DarkSlateBlue.ToArgb(), checkLists[i].Text ), false, false );
            }

            for ( int i = 0; i < m_Lists.Length; ++i )
                RenderPage( i, Array.IndexOf( checkLists, m_Lists[i] ) );
        }

        private void RenderPage( int index, int offset )
        {
            PMList list = m_Lists[index];

            AddPage( index + 1 );

            AddButton( 10, 35 + (offset * 25), 2117, 2118, 0, GumpButtonType.Page, index + 1 );
//            AddHtmlLocalized( 30, 35 + (offset * 25), 150, 20, list.SelText, false, false );
                        AddHtml( 30, 35 + (offset * 25), 150, 20, String.Format("<basefont color=#{0:X6}>{1}", System.Drawing.Color.LimeGreen.ToArgb(), list.SelText ), false, false );

            PMEntry[] entries = list.Entries;

            for ( int i = 0; i < entries.Length; ++i )
            {
                AddRadio( 200, 35 + (i * 25), 210, 211, false, (index * 100) + i );
//                              AddHtml( 225, 35 + (i * 25), 150, 20, entries[i].Text, false, false );
                                AddHtml( 225, 35 + (i * 25), 150, 20, String.Format("<basefont color=#{0:X6}>{1}", System.Drawing.Color.LimeGreen.ToArgb(), entries[i].Text ), false, false );
            }
        }

        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;

            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 && list.Map != Map.Malas && list.Map != Map.Tokuno && list.Map != Map.Trammel && list.Map != Map.Ilshenar )
            {
                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 ( Server.Spells.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
            {
                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 );
            }
        }
    }
}
 

bryant

Sorceror
Its the portion that is supposed to be slate blue. Doesn't show up until I click on the map icon then its lime green like the cities.
 

Vorspire

Knight
Looks like the portion you want to be slate blue is for check lists and the green is for a different list, used by the RenderPage method.
Maybe you need to change lime green to slate blue in there?
 
Top