I'm trying to make a gump which is refresh again and again like Status Gump( Alt + s ) or Skills Gump ( Alt + K )
Those gumps are dragable when data changes.
For example, My mana is 3/100 and regenerate until 100/100, And I can drag this gump with refreshing datas.
I made a custom skills gump and refreshing it with re-open method, but this method doesn't allows drag the gump.
So, is anyone know how to refresh gump without close-open method?
I just want to keep that gump. Just refresh that gump.
 
It is handled in the client (refresh bar etc. of status bar)

Though, it could be haxed with two gumps.
I didn't test it so i'm not totally sure, using two gumps, one that would be sort of invisible over the first one (and prehaps containing the buttons) that would be never refreshing except if you click one.
Now that you have the front layer, making a background sort of thing with another gump, and i think you can select it's spawn location in the constructor.
So why not taking the first invisible layer location, and sending that onto the refreshing one, so it always appear under?

Possible problems:
-Can't get the current location of a gump.
-Can't focus a specific gump without having to reopen it.
-It's too ugly call the cops.

I'm not quite sure of the limitations of the gump system.
Just wanted to show a valid path for that other than "client: impossible."
 
There's always VitaNex that has refreshing gumps but I think I remember seeing that it doesn't work with ServUO anymore.
Could be wrong.

Anyway, it's the Cast Bars or something in the VitaNex system
 
Any SuperGump in VNc supports the Refresh( ) method :)

It is a case of clearing the gump's Entries list and rebuilding it, so you could add your own Refresh logic to a normal gump like this:

C#:
	public class MyGump : Gump
	{
		public Mobile User { get; private set; }

		public Mobile Target { get; set; }

		public MyGump(Mobile user, Mobile target)
			: base(0, 0)
		{
			User = user;
			Target = target;

			Build();
		}

		protected void Build()
		{
			AddPage(0);

			AddBackground(0, 0, 300, 200, 2620);

			if (Target == null)
			{
				return;
			}

			AddHtml(10, 10, 280, 40, String.Format("Status For {0}", Target.RawName), false, false);

			AddHtml(10, 50, 280, 40, String.Format("HITS: {0:#,0} / {1:#,0}", Target.Hits, Target.HitsMax), false, false);
			AddHtml(10, 100, 280, 40, String.Format("STAM: {0:#,0} / {1:#,0}", Target.Stam, Target.StamMax), false, false);
			AddHtml(10, 150, 280, 40, String.Format("MANA: {0:#,0} / {1:#,0}", Target.Mana, Target.ManaMax), false, false);
		}

		public void Refresh()
		{
			User.CloseGump(GetType());

			Entries.Clear();

			Build();

			User.SendGump(this);
		}
	}

Example:

C#:
var myGump = new MyGump( user, target );

user.SendGump( myGump );

Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), TimeSpan.FromSeconds( 1.0 ), myGump.Refresh );
 
Last edited:
Any SuperGump in VNc supports the Refresh( ) method :)

It is a case of clearing the gump's Entries list and rebuilding it, so you could add your own Refresh logic to a normal gump like this:

C#:
	public class MyGump : Gump
	{
		public Mobile User { get; private set; }

		public Mobile Target { get; set; }

		public MyGump(Mobile user, Mobile target)
			: base(0, 0)
		{
			User = user;
			Target = target;

			Build();
		}

		protected void Build()
		{
			AddPage(0);

			AddBackground(0, 0, 300, 200, 2620);

			if (Target == null)
			{
				return;
			}

			AddHtml(10, 10, 280, 40, String.Format("Status For {0}", Target.RawName), false, false);

			AddHtml(10, 50, 280, 40, String.Format("HITS: {0:#,0} / {1:#,0}", Target.Hits, Target.HitsMax), false, false);
			AddHtml(10, 100, 280, 40, String.Format("STAM: {0:#,0} / {1:#,0}", Target.Stam, Target.StamMax), false, false);
			AddHtml(10, 150, 280, 40, String.Format("MANA: {0:#,0} / {1:#,0}", Target.Mana, Target.ManaMax), false, false);
		}

		public void Refresh()
		{
			User.CloseGump(GetType());

			Entries.Clear();

			Build();

			User.SendGump(this);
		}
	}

Example:

C#:
var myGump = new MyGump( user, target );

user.SendGump( myGump );

Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), TimeSpan.FromSeconds( 1.0 ), myGump.Refresh );

thank you, been wondering how to make a gump refresh for a while now but never got around to looking into it
 
Can it dragable while refreshing?
It doesn't seems to be dragable while refreshing..

No.

Not sure why it is a big demand to have a movable gump while it refreshes, do you intend to drag that gump around the screen a lot? Seems odd to think that a gump would be dragged for more than a second or two.
 
No.

Not sure why it is a big demand to have a movable gump while it refreshes, do you intend to drag that gump around the screen a lot? Seems odd to think that a gump would be dragged for more than a second or two.

Because I'll replace original Skills and Status gumps.
Sometimes, users need to move it and when it happened, this method will stop moving because of refreshing.
That's the reason why I said 'Without close-open method'.
 
another option is to create a gump placement selection. it's a bit non-UO like but it works.

here's the one used in VitaNex: https://www.assembla.com/code/vita-...s/16/SuperGumps/UI/Misc/OffsetSelectorGump.cs

I also made one for my SpellBar system but it's ugly. Now that I understand for loops better though, it's going to get an update.

anyway, the player could just select where they want the gump to open if dragging while refreshing is causing problems.
 
  • Like
Reactions: ExX
The GumpButton class supports X and Y, which you can use to determine the approximate coords of a button click, given the gump is not movable; but you have to resolve the clicked button ID to the GumpButton instance that defined it, when you handle OnResponse, in order to get the X and Y values from it.
 
The GumpButton class supports X and Y, which you can use to determine the approximate coords of a button click, given the gump is not movable; but you have to resolve the clicked button ID to the GumpButton instance that defined it, when you handle OnResponse, in order to get the X and Y values from it.

good to know, i'll have to give it another shot then. thank you
 
Going back to OP's request, you could implement a 'placeholder' feature for your status gump, for example:

C#:
public bool IsPlaceholder { get; set; }

And if the property is true, the gump can be made non-movable, if false, it can be movable.
You would have to have a button that locks/unlocks the ability to move the gump and each time IsPlaceholder changes, you would have to Refresh the gump so that the client knows if it is movable or not.

While IsPlaceholder is true, you would prevent any other refreshes of the gump, until the user is satisfied with the new position and clicks the button to lock it in place.

Note, this placement does not persist over world saves; zerodowned mentioned the OffsetSelectorGump - that ggump allows the user to select coords on the screen by clicking a button on the grid. Each button is 20x20 pixels (IIRC), meaning when one is clicked, the relative screen coords can be extrapolated from the position of the button to within an accuracy of 10 pixels.
When you have the selected screen coords, you can store that data in a profile and persist it over world saves, loading that data as needed when a new gump is sent to the same user.

See this entire concept in action with the SpellCastBars VNc module;
http://core.vita-nex.com/svn/Modules/SpellCastBars/
It covers placeholders, offset selection, data persistence and a gump that refreshes every 100ms to update its information.

Have fun :)
 
Back