ThatDudeJBob
Sorceror
How can i call on an item in 'OnTick'
Here is the Basics of the timer i am using.
When i do 'if (this is FirstItem)', 'this' is refering to SomeTimer and not the item.
and if i try this(below)
I get this Error...
Line 136:
I'm at a loss at what to try now.
Any suggestions?
Here is the Basics of the timer i am using.
C#:
private class SomeTimer : Timer
{
private readonly Mobile m_From;
private readonly int m_SoundID;
private int m_Count;
public SomeTimer(Mobile from, int soundID) : base(TimeSpan.Zero, TimeSpan.FromSeconds(1.0))
{
m_From = from;
m_SoundID = soundID;
Priority = TimerPriority.TenMS;
}
protected override void OnTick()
{
m_Count++;
if (this is FirstItem)
{
}
else if (this is SecondItem)
{
}
else if (this is ThirdItem)
{
}
}
}
When i do 'if (this is FirstItem)', 'this' is refering to SomeTimer and not the item.
and if i try this(below)
C#:
private class SomeTimer : Timer
{
private readonly Mobile m_From;
private readonly Item m_Item;
private readonly int m_SoundID;
private int m_Count;
public SomeTimer(Mobile from, Item item, int soundID) : base(TimeSpan.Zero, TimeSpan.FromSeconds(1.0))
{
m_From = from;
m_Item = item;
m_SoundID = soundID;
Priority = TimerPriority.TenMS;
}
protected override void OnTick()
{
m_Count++;
if (m_Item is FirstItem)
{
}
else if (m_item is SecondItem)
{
}
else if (m_Item is ThirdItem)
{
}
}
}
I get this Error...
Code:
CS1729: Line 136: 'Server.Items.BaseSomthing.SomeTimer' does not contain a constructor that takes 2 arguments
Line 136:
C#:
public SomeTimer(Mobile from, Item item, int soundID) : base(TimeSpan.Zero, TimeSpan.FromSeconds(1.0))
I'm at a loss at what to try now.
Any suggestions?