What does the food decay timers represent?

ExX

Citizen
So I am making changes to a food system I found online. Just something basic that works well. I was just curious as to what these timers represented?

public FoodDecayTimer() : base( TimeSpan.FromMinutes( 60 ), TimeSpan.FromMinutes( 60 ) )
{
this.Priority = TimerPriority.OneMinute;
}

I am not used to there being 2 timers. So i am unsure what these 2 do.base( TimeSpan.FromMinutes( 60 ), TimeSpan.FromMinutes( 60 ) )? I would like food to decay every 30 minutes do I just do

base( TimeSpan.FromMinutes( 30 ), TimeSpan.FromMinutes( 30 ) )?

Thanks for nay help.
 

Po0ka

Rookie
I think it's more in the lines of "min/max", like: decay in 10 or 30 min (between 60 min and 60 min in this case).
Would you be able to post the link where you found it?
 

ExX

Citizen
It was a peice of this script.

http://www.playuo.org/emu/index.php?threads/hunger-and-thirst.354/

I simplified it greatly and got rid of everything except the fooddecay.sc file. The full file I have is this.

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

namespace Server.Misc
{
	public class FoodDecayTimer : Timer
	{

        // keep player from dying from hunger?
        public static bool KeepAlive { get { return true; } }

        // if true, staff hunger/thirst will not decay below 20.
        public static bool StaffImmune { get { return true; } }

		public static void Initialize()
		{
            new FoodDecayTimer().Start();
		}

		public FoodDecayTimer() : base( TimeSpan.FromMinutes( 60 ), TimeSpan.FromMinutes( 60 ) )
		{
			this.Priority = TimerPriority.OneMinute;
		}

		protected override void OnTick()
		{
            FoodDecay();
		}

		public static void FoodDecay()
		{
			foreach ( NetState state in NetState.Instances )
			{
				if ( state.Mobile != null && state.Mobile.AccessLevel == AccessLevel.Player ) // Check if player
				{
					HungerDecay( state.Mobile );
					ThirstDecay( state.Mobile );
				}
			}
		}

		public static void HungerDecay( Mobile m )
		{
			if ( m != null )
			{

                // new additions
                bool keepAlive = KeepAlive;	// keep player from dying from this

                // bool staffImmune = StaffImmune;
                if (StaffImmune && (m.AccessLevel > AccessLevel.Player) && (m.Hunger < 20))
                    m.Hunger = 20;

				if ( m.Hunger >= 1 )
				{
					m.Hunger -= 1;
                    if (m.Hunger < 0)
                    {
                        m.SendMessage("You are starving to death.");
                    }
                    else if (m.Hunger < 5)
                    {
                        m.SendMessage("You are extremely hungry.");
                    }
                    else if (m.Hunger < 10)
                    {
                        m.SendMessage("You are getting very hungry.");
                    }
                    else if (m.Hunger < 15)
                    {
                        m.SendMessage("You are slightly hungry.");
                    }
				}	
				else
				{
                    if (m.Hits > 5)
                    {
                        m.Hits -= 2;
                        m.SendMessage("You are starving to death! You desperately need food.");
                    }
				}
			}
		}
		
		
		
		
		
		
		

		public static void ThirstDecay( Mobile m )
		{
			if ( m != null )
			{
                // new additions:
                bool keepAlive = KeepAlive;	// keep player from dying from this

                // bool staffImmune = StaffImmune;
                if (StaffImmune && (m.AccessLevel > AccessLevel.Player) && (m.Thirst < 20))
                    m.Thirst = 20;

				if ( m.Thirst >= 1 )
				{
					m.Thirst -= 1;
                    if (m.Thirst < 0)
                    {
                        m.SendMessage("You are exhausted from thirst.");
                    }
                    else if (m.Thirst < 5)
                    {
                        m.SendMessage("You are extremely thirsty.");
                    }
                    else if (m.Thirst < 10)
                    {
                        m.SendMessage("You are getting thirsty.");;
                    }
                    else if (m.Thirst < 15)
                    {
                        m.SendMessage("You are slightly thirsty.");
                    }
				}
				else
				{
                    if (m.Stam > 5)
                    {
                        m.Stam -= 2;
                        m.SendMessage("You are exhausted from thirst! You desperately need something to drink.");
                    }
				}
			}
		}
	}
}

It works really well from my little testing I have done so far, but not positive on those timers yet.
 
First time is "delay" second time is "interval". So, When you create a timer you can tell it the time you want before it starts, in this case 60 minutes, and the second time is how often it ticks, and in this case again 60 mins. if you had base( TimeSpan.FromMinutes( 5 ), TimeSpan.FromMinutes( 30)), it means start the "ticking" in 5 minutes, then tick every 30 minutes after that.