firefox

Initiate
Hello servuo i was looking or a way to make a gump autorefresh, today i was surfing runuo forums and i saw a thread about it, i tried that script, for some reason the gump doesnt refresh or anything it is supposed to refresh every 20 seconds?,

this is what i have:



Code:
namespace Server.Gumps
{
    public class HungerThirst : Gump
    {
     
        public HungerThirst(Mobile from) : base(2,30)
        {
     
this.Closable=false;
this.Disposable=false;
this.Dragable=false;
this.Resizable=false;
this.AddPage(0);
this.AddLabel(24, 0, from.Hunger < 6 ? 33 : 1149, string.Format( "Hunger: {0}/20", from.Hunger));
this.AddButton(0, 0, 210, 211, 1, GumpButtonType.Reply, 0);
this.AddLabel(25, 24, from.Thirst < 6 ? 33 : 1149, string.Format( "Thirst: {0}/20", from.Thirst));
this.AddButton(0, 24, 210, 211, 2, GumpButtonType.Reply, 0);
Timer.DelayCall(TimeSpan.FromSeconds(20), new TimerStateCallback(Change), from);
        }
     

        private void Change( object state )
{
     Mobile from = state as Mobile;

            ((Mobile)from).CloseGump(typeof(HungerThirst));
            ((Mobile)from).SendGump(new HungerThirst(from));
            ((Mobile)from).SendMessage("Refresh");
        }
     
    }
}

im new to this, i made a timer, but i dont know how to start it, i want to players to get a GUMP and refresh that gump when they are in X region of the map.

I was thinking of call the gump and close it on OnMovement method but maybe thats worse than a timer running.

Thanks
 
Last edited:
Why don't you just send the gump whenever Hunger/Thirst changes?

Also, the code provided looks like it should work, have you made sure to change the Hunger/Thirst values before the next refresh?
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back