|
||
|
|||||||
| Script Support Get support for modifying RunUO Scripts, or writing your own! |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Timea Shard Owner
|
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] |
|
|
|
|
|
#6 (permalink) |
|
Moderate
Join Date: Nov 2002
Location: USA
Posts: 6,598
|
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 |
|
|
|
|
|
#7 (permalink) |
|
Forum Expert
|
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 |
|
|
|
|
|
#8 (permalink) | |
|
Timea Shard Owner
|
heres the crash
Quote:
|
|
|
|
|
|
|
#11 (permalink) |
|
Timea Shard Owner
|
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] |
|
|
|
|
|
#12 (permalink) |
|
Moderate
Join Date: Nov 2002
Location: USA
Posts: 6,598
|
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 |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|