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 01-14-2004, 01:48 AM   #1 (permalink)
Thunderfall
Guest
 
Posts: n/a
Default Ugh, another error

Exception:
System.NullReferenceException: Object reference not set to an instance of an object.

just when i thought the code was working perfectly, i got the above error from the preceeding crash log :?

and here's the code where it originates from.
[code:1]public override void OnRemoved( object o )
{
m_mob.SendMessage( "The power vanishes..." );
m_mob.EndAction( typeof( InternalTimer ) );
}[/code:1]
  Reply With Quote
Old 01-14-2004, 01:50 AM   #2 (permalink)
Forum Expert
 
Ravenal's Avatar
 
Join Date: Oct 2003
Location: Spokane Valley, WA
Age: 24
Posts: 1,528
Default

Okay your trying to do something to when they equip the item a timer starts and then when they remove it the timer stops?
__________________
Creator of Genesis :: genesisworlds.com
-- Genesis is the next replacement program for UO Landscaper & Dragon
Ravenal is offline   Reply With Quote
Old 01-14-2004, 01:53 AM   #3 (permalink)
Thunderfall
Guest
 
Posts: n/a
Default

yeah, that's exactly what i'm trying to do :P
  Reply With Quote
Old 01-14-2004, 02:02 AM   #4 (permalink)
Forum Expert
 
Ravenal's Avatar
 
Join Date: Oct 2003
Location: Spokane Valley, WA
Age: 24
Posts: 1,528
Default

hmm let me think for a min umm try this m_mob.Stop();

if that fails then umm let me think again!
__________________
Creator of Genesis :: genesisworlds.com
-- Genesis is the next replacement program for UO Landscaper & Dragon
Ravenal is offline   Reply With Quote
Old 01-14-2004, 02:04 AM   #5 (permalink)
Forum Expert
 
Ravenal's Avatar
 
Join Date: Oct 2003
Location: Spokane Valley, WA
Age: 24
Posts: 1,528
Default

Hey post me the whole script and let me see if i can figure it out!
__________________
Creator of Genesis :: genesisworlds.com
-- Genesis is the next replacement program for UO Landscaper & Dragon
Ravenal is offline   Reply With Quote
Old 01-14-2004, 02:04 AM   #6 (permalink)
Thunderfall
Guest
 
Posts: n/a
Default

nope, that one gives the error
[code:1]'Server.Mobile' does not contain a definition for 'Stop()'[/code:1]
  Reply With Quote
Old 01-14-2004, 02:23 AM   #7 (permalink)
Account Terminated
 
Join Date: Sep 2002
Age: 26
Posts: 3,846
Send a message via ICQ to Phantom Send a message via AIM to Phantom Send a message via MSN to Phantom
Default

Quote:
Originally Posted by Thunderfall
nope, that one gives the error
[code:1]'Server.Mobile' does not contain a definition for 'Stop()'[/code:1]
Post the script, until you do, I can't help you.

If you don't post the script, don't post in this thread again K?
Phantom is offline   Reply With Quote
Old 01-14-2004, 02:25 AM   #8 (permalink)
Forum Expert
 
Ravenal's Avatar
 
Join Date: Oct 2003
Location: Spokane Valley, WA
Age: 24
Posts: 1,528
Default

aye
__________________
Creator of Genesis :: genesisworlds.com
-- Genesis is the next replacement program for UO Landscaper & Dragon
Ravenal is offline   Reply With Quote
Old 01-14-2004, 04:34 AM   #9 (permalink)
 
Join Date: Oct 2002
Age: 23
Posts: 4,689
Default

Stupid thread name.. :\
Im not in my nice mood anymore, so I wont help you.
XxSP1DERxX is offline   Reply With Quote
Old 01-14-2004, 07:33 AM   #10 (permalink)
 
Join Date: Jul 2003
Posts: 207
Default

you can't Stop() a mobile, thats a timer method duuh. but I agree with phantom (omg) wud be very useful to see the complete code or at least the OnEquip and OnRemoved overrides + the timer class itself.
Haramis is offline   Reply With Quote
Old 01-14-2004, 08:11 AM   #11 (permalink)
 
Join Date: Oct 2003
Posts: 27
Send a message via ICQ to abyssknight Send a message via AIM to abyssknight Send a message via Yahoo to abyssknight
Default err

just taking a stab at this, I'm a real newbie but...

m_mob doesnt refer to anything in that function, does it?

o is the object, so wouldn't you have to refer to it as ((Mobile)parent) ?

that is if a mobile is the parent of the item.

that would explain why you're getting a null reference exception error, because you're not using the parameter.

just guessing. really, don't think I actually know what I'm saying. lol.
abyssknight is offline   Reply With Quote
Old 01-14-2004, 11:22 AM   #12 (permalink)
Thunderfall
Guest
 
Posts: n/a
Default

[code:1]using Server;
using System;
using System.Collections;
using Server.Mobiles;

namespace Server.Items
{
public class AntiGravityBoots : Boots
{
public Mobile m_mob;

[Constructable]
public AntiGravityBoots() : base( 0x170b )
{
Name = "Anti-Gravity Boots";
Hue = 2029;
}

public override bool OnEquip( Mobile from )
{
m_mob = from;

from.SendMessage( "You feel a powerful force begin to lift you from the ground!" );
new InternalTimer( from ).Start();
return true;
}

public override void OnRemoved( object o )
{
base.OnRemoved( o );

m_mob.SendMessage( "The power vanishes..." );
InternalTimer( m_mob ).Stop();
}

private class InternalTimer : Timer
{
private Mobile mfrom;
private int adr = 0;

public InternalTimer( Mobile from ) : base( TimeSpan.FromSeconds( 0.2 ), TimeSpan.FromSeconds( 0.2 ) )
{
mfrom = from;
}

protected override void OnTick()
{
mfrom.Z++;
adr++;
if( adr == 30 )
{
Stop();
}
}
}

public AntiGravityBoots( Serial serial ) : base( serial )
{
}

public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 );
}

public override void Deserialize(GenericReader reader)
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}[/code:1]

There. that's the entire script, i hope it helps.
  Reply With Quote
Old 01-14-2004, 12:26 PM   #13 (permalink)
Master of the Internet
 
Join Date: Aug 2003
Posts: 5,688
Default

when you create your timer you need to assign it to a variable like this
[code:1]
if(m_internaltimer != null) m_internaltimer.Delete();

m_internaltimer = new InternalTimer( from );
m_internaltimer.Start();
[/code:1]
then in your OnRemoved

you can do
[code:1]
if(m_internaltimer != null) m_internaltimer.Stop();[/code:1]

and, of course you have to define m_internaltimer up by your m_mob definition.
ArteGordon is offline   Reply With Quote
Old 01-14-2004, 12:30 PM   #14 (permalink)
Thunderfall
Guest
 
Posts: n/a
Default

ahh, thank you my friend. that worked
  Reply With Quote
Old 01-14-2004, 02:58 PM   #15 (permalink)
Forum Expert
 
Join Date: Oct 2003
Location: Calhoun, Ga
Age: 44
Posts: 1,008
Send a message via AIM to roadmaster
Default

just out of curiosity are you planning on using a Decrement option with those boots so when someone removes them they dont just hang there in the air???

roadmaster

im just curious cause i like your idea.
roadmaster is offline   Reply With Quote
Old 01-14-2004, 06:21 PM   #16 (permalink)
Thunderfall
Guest
 
Posts: n/a
Default

yes i am. but i'm already done making 'em now :P
  Reply With Quote
Old 01-20-2004, 10:26 AM   #17 (permalink)
Forum Expert
 
milt's Avatar
 
Join Date: Nov 2003
Location: Lancaster, PA
Age: 20
Posts: 1,606
Send a message via AIM to milt Send a message via Yahoo to milt Send a message via Skype™ to milt
Default

So can somebody please post that final script because i want those boots lol
__________________
--Milt, AKA Pokey
milt 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