I have a level system and a [level command in my server.
I want to add progressbar which shows "%exp" in the [level gump.
Is it possible ?
 
Yes, it is possible.

The bigger question is do you want it to update automatically or each time you open the gump?

If you only need it to show progress when you first open the gump, its pretty easy.

If you want it to update on the fly, you will need a framework like SuperGumps from VNC.
 
I just want it to change every [level command

I found a way to this :
Code:
public class SeviyeGump : Gump
    {
        private Mobile from;
        public SeviyeGump(Mobile m)
            : base( 0, 0 )
        {
            from = m;
            PlayerMobile pm = m as PlayerMobile;
            int xdeger = (pm.Exp * 100) / pm.NeedExp;
            this.Closable=true;
            this.Disposable=true;
            this.Dragable=true;
            this.Resizable=false;
            this.AddPage(0);
            this.AddBackground(157, 58, 510, 434, 83);
            this.AddImageTiled(259, 224, 100, 12, 5055);
            this.AddImageTiled(259, 224, xdeger, 12, 9271);
            this.AddLabel(261, 246, 1153, "%"+xdeger+"");

        }
[doublepost=1489440193][/doublepost]And It looks like this :
Thanks mate

upload_2017-3-14_0-23-9.png
 
That's more or less how I'd do it - with AddImageTiled

Auto Refresh with VNC is always a nice bonus. I still need to find time to play around with it.
 
You don't have to use tiled images, you can use any solid color you wish;

Code:
public void AddProgressBar(int x, int y, int w, int h, string text, double min, double max, Color color, Color back, Color fore)
{
	var bg = String.Format("<BODYBGCOLOR=#{0:X}>", back.ToArgb( ) );
	var fg = String.Format("<BODYBGCOLOR=#{0:X}>", fore.ToArgb( ) );

	var label = String.Format("<BASEFONT COLOR=#{0:X}><CENTER>{1} {2:#,0.0}%", color.ToArgb( ), text, ( min / max ) * 100 );

	AddHtml( x, y, w, h, bg, false, false );
	AddHtml( x + 2, y + 2, (int)Math.Ceiling( ( w - 4 ) * ( min / max ) ), h - 4, fg, false, false );
	AddHtml( x + 2, y + 2, w - 4, h - 4, label, false, false );
}

Code:
AddProgressBar( 0, 0, 300, 30, "Progress", 33, 100, Color.White, Color.Black, Color.Blue );
 
You don't have to use tiled images, you can use any solid color you wish;

Code:
public void AddProgressBar(int x, int y, int w, int h, string text, double min, double max, Color color, Color back, Color fore)
{
	var bg = String.Format("<BODYBGCOLOR=#{0:X}>", back.ToArgb( ) );
	var fg = String.Format("<BODYBGCOLOR=#{0:X}>", fore.ToArgb( ) );

	var label = String.Format("<BASEFONT COLOR=#{0:X}><CENTER>{1} {2:#,0.0}%", color.ToArgb( ), text, ( min / max ) * 100 );

	AddHtml( x, y, w, h, bg, false, false );
	AddHtml( x + 2, y + 2, (int)Math.Ceiling( ( w - 4 ) * ( min / max ) ), h - 4, fg, false, false );
	AddHtml( x + 2, y + 2, w - 4, h - 4, label, false, false );
}

Code:
AddProgressBar( 0, 0, 300, 30, "Progress", 33, 100, Color.White, Color.Black, Color.Blue );
Am I crazy or does VNC support all kinds of background colors? Solid, Rainbow, etc.
 
Can you explain me what is it exactly?

And thanks for all.

That is just a link to all the extended gump entries that VNc's SuperGumps provide, if you or anyone else wished to use them - now you know they exist :)
 
Back