Go Back   RunUO - Ultima Online Emulation > RunUO > Script Support

Script Support Get support for modifying RunUO Scripts, or writing your own!

Reply
 
Thread Tools Display Modes
Old 02-06-2004, 01:26 PM   #1 (permalink)
Timea Shard Owner
 
dean968's Avatar
 
Join Date: Jun 2003
Location: Decatur Alabama
Age: 31
Posts: 379
Send a message via ICQ to dean968
Default part of a script

does anyone see something wrong with this?

[code:1]private class newTimer2 : Timer
{
private Mobile a;
public newTimer2( Mobile m ) : base( TimeSpan.FromSeconds( 5 ) )
{
a = m;
}

protected override void OnTick()
{
a.SendMessage( "Your score has reduced by one" );
}
}
}
}[/code:1]
dean968 is offline   Reply With Quote
Old 02-06-2004, 01:33 PM   #2 (permalink)
 
Join Date: Jan 2004
Posts: 753
Send a message via ICQ to Crack177 Send a message via AIM to Crack177 Send a message via Yahoo to Crack177
Default

I might see a problem, but u can't trust me.
[code:1]
public newTimer2( Mobile m ) : base( TimeSpan.FromSeconds( 5 ) )[/code:1]

Here there is usually another time span
Crack177 is offline   Reply With Quote
Old 02-06-2004, 01:34 PM   #3 (permalink)
 
Join Date: Jan 2004
Posts: 753
Send a message via ICQ to Crack177 Send a message via AIM to Crack177 Send a message via Yahoo to Crack177
Default

That's probably wrong but I tried. Take a look at this part of a script like I was talking about.
[code:1]public IdleTimer( serventofakasha owner ) : base( TimeSpan.FromSeconds( 6.0 ), TimeSpan.FromSeconds( 6.5 ) )
[/code:1]
Crack177 is offline   Reply With Quote
Old 02-06-2004, 01:37 PM   #4 (permalink)
Timea Shard Owner
 
dean968's Avatar
 
Join Date: Jun 2003
Location: Decatur Alabama
Age: 31
Posts: 379
Send a message via ICQ to dean968
Default

ok so whats the reason for the second time to set up a time frame? like from 6mins -6.5 mins
dean968 is offline   Reply With Quote
Old 02-06-2004, 02:06 PM   #5 (permalink)
 
Join Date: Jan 2004
Posts: 753
Send a message via ICQ to Crack177 Send a message via AIM to Crack177 Send a message via Yahoo to Crack177
Default

It would be so it had a distance of time. Like I told you, you should not trust me i'm not the greatest at this.
Crack177 is offline   Reply With Quote
Old 02-06-2004, 04:45 PM   #6 (permalink)
Moderate
 
David's Avatar
 
Join Date: Nov 2002
Location: USA
Posts: 6,598
Default

I don't see anything wrong, what is it doing or not doing, or any compile errors?

The first (or only) TimeSpan will cause the Timer to fire after that amount of time. An optional second TimeSpan will cause the Timer to repeat at whatever interval the second TimeSpan states.
__________________
David Forum Moderator
The RunUO.com Forum Moderator Team

Forum Rules and Guidelines
RunUO Forum Search Engine
Download RunUO 2.0 RC2
David is offline   Reply With Quote
Old 02-06-2004, 08:04 PM   #7 (permalink)
Forum Expert
 
Join Date: Oct 2003
Location: Calhoun, Ga
Age: 44
Posts: 1,008
Send a message via AIM to roadmaster
Default

If there is something wrong with your script you need to post the entire script with the errors you are receiving, this will help us to help you.

your problem may be in how you are calling the timer, we dont know since you didnt post your script.


roadmaster
roadmaster is offline   Reply With Quote
Old 02-06-2004, 09:34 PM   #8 (permalink)
Timea Shard Owner
 
dean968's Avatar
 
Join Date: Jun 2003
Location: Decatur Alabama
Age: 31
Posts: 379
Send a message via ICQ to dean968
Default

heres the crash

Quote:
Error:
System.NullReferenceException: Object reference not set to an instance of an obj
ect.
at Server.Items.newTimer2.OnTick()
at Server.Timer.Slice()
at Server.Core.Main(String[] args)
Crash: Backing up...done
Crash: Generating report...done
Crash: Restarting...done
Warning:
System.Threading.ThreadAbortException: Thread was being aborted.
at System.Threading.Thread.Sleep(Int32 millisecondsTimeout)
at Server.TimerThread.TimerMain()
dean968 is offline   Reply With Quote
Old 02-06-2004, 09:36 PM   #9 (permalink)
Timea Shard Owner
 
dean968's Avatar
 
Join Date: Jun 2003
Location: Decatur Alabama
Age: 31
Posts: 379
Send a message via ICQ to dean968
Default

its a town war script and the crash happen when 2 diffrent town members went out hunting together and one got killed by a dragon they were both fighting together
dean968 is offline   Reply With Quote
Old 02-07-2004, 06:26 AM   #10 (permalink)
 
Join Date: Oct 2002
Age: 23
Posts: 4,689
Default

[code:1]if (a != null && !a.Deleted)[/code:1]

add that check.
XxSP1DERxX is offline   Reply With Quote
Old 02-07-2004, 09:17 AM   #11 (permalink)
Timea Shard Owner
 
dean968's Avatar
 
Join Date: Jun 2003
Location: Decatur Alabama
Age: 31
Posts: 379
Send a message via ICQ to dean968
Default

so like this?

[code:1]private class newTimer2 : Timer
{
private Mobile a;
public newTimer2( Mobile m ) : base( TimeSpan.FromSeconds( 5 ) )
{
a = m;
}

protected override void OnTick()
if (a != null && !a.Deleted)
{
a.SendMessage( "Your score has reduced by one" );
}
}
}
}[/code:1]


or
[code:1]
private class newTimer2 : Timer
{
private Mobile a;
public newTimer2( Mobile m ) : base( TimeSpan.FromSeconds( 5 ) )
{
if (a != null && !a.Deleted)
a = m;
}

protected override void OnTick()
{
a.SendMessage( "Your score has reduced by one" );
}
}
}
}
[/code:1][/code]
dean968 is offline   Reply With Quote
Old 02-07-2004, 11:17 AM   #12 (permalink)
Moderate
 
David's Avatar
 
Join Date: Nov 2002
Location: USA
Posts: 6,598
Default

Like this
[code:1]private class newTimer2 : Timer
{
private Mobile a;
public newTimer2( Mobile m ) : base( TimeSpan.FromSeconds( 5 ) )
{
a = m;
}

protected override void OnTick()
{
if (a != null && !a.Deleted)
a.SendMessage( "Your score has reduced by one" );
}
}
}
}[/code:1]
__________________
David Forum Moderator
The RunUO.com Forum Moderator Team

Forum Rules and Guidelines
RunUO Forum Search Engine
Download RunUO 2.0 RC2
David is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5