RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

confused about this one

Madogi

Squire
this has royaly stumpted me im only new to scripting ive tried for a for the past day to figure this out and im lost so im asking for help

another thing i dont get why it is going to g:\ when there is no g drive on the server there is on my home pc were the files backups are kept

i have custom SA content as well as xml daat99 and fs animal taming

thanks in advance madogi


Code:
System.NullReferenceException: Object reference not set to an instance of an object.
   at Server.Items.AbyssBarrier.OnMoveOver(Mobile m) in c:\path\AbyssBarrier.cs:line 28
   at Server.Mobile.Move(Direction d) in g:\path\Mobile.cs:line 3251
   at Server.Mobiles.BaseAI.DoMoveImpl(Direction d) in c:\path\BaseAI.cs:line 2065
   at Server.Mobiles.BaseAI.DoMove(Direction d, Boolean badStateOk) in c:\path\BaseAI.cs:line 2030
   at Server.Mobiles.BaseAI.MoveTo(Mobile m, Boolean run, Int32 range) in c:\path\BaseAI.cs:line 2321
   at Server.Mobiles.MeleeAI.DoActionCombat() in c:\path\MeleeAI.cs:line 86
   at Server.Mobiles.BaseAI.Think() in c:\path\BaseAI.cs:line 795
   at Server.Mobiles.BaseAI.AITimer.OnTick() in c:\path\BaseAI.cs:line 2777
   at Server.Timer.Slice() in g:\path\Timer.cs:line 386
   at Server.Core.Main(String[] args) in g:\path\Main.cs:line 522
 

Attachments

  • AbyssBarrier.cs
    1.3 KB · Views: 9
  • BaseAI.cs
    75.1 KB · Views: 0
  • Main.cs
    19.9 KB · Views: 0
  • MeleeAI.cs
    4.3 KB · Views: 0
  • Mobile.cs
    255 KB · Views: 1
  • Timer.cs
    14.7 KB · Views: 0

Soteric

Knight
It crashes in OnMoveOver method of AbyssBarrier class because you don't check 'mobile' for null. It is null when NPC is crossing the barrier.
 

Madogi

Squire
got any tips for learning about the OnMoveOver or any places i should look to learn :D search function is down and certain websites wont load on my laptop ty in advance
 

Soteric

Knight
You can use google search.
Code:
site:runuo.com onmoveover
Nice alternative to local search function.
 

daat99

Moderator
Staff member
Hi,

You should also know that RunUO uses a real programming language called C#.

You can read some basic C# tutorials and in order to learn more about it.

What you got is a "NullReferenceException" which means a C# object is null but you are trying to access it like it isn't.

You need to do null checks so reading more about C# and null checks (and why you need to do them) will help you a bit more than searching the RunUO website.
 

Madogi

Squire
haha thanks daat still trying to fix this but not having much luck might have to start from the basics :p and start the relearning process again
 

daat99

Moderator
Staff member
You don't need to start from scratch.

Can you post the relevant code inside [code] tags so we can look at it?
 

Mikey

Sorceror
Code:
        public override bool OnMoveOver(Mobile m)
        {
            PlayerMobile mobile = m as PlayerMobile;
 
            if (m.AccessLevel > AccessLevel.Player)
                return true;
            {
 
                if (mobile.AbyssEntry == false)
                {
                    m.SendLocalizedMessage(1112226);
                    return false;
                }
                else
                {
                    m.SendLocalizedMessage(1113708);
                    return true;
                }
            }
        }
I'm not exactly sure what you're doing here, but all you need to do is do a check of mobile is not null (i.e. the mobile IS a playermobile and not an NPC). So you're going to want to do something like this:
Code:
        public override bool OnMoveOver(Mobile m)
        {
            PlayerMobile pm = m as PlayerMobile;
            if ( pm == null )
                return false;
 
            if (m.AccessLevel > AccessLevel.Player)
                return true;
            {
                if (pm.AbyssEntry == false)
                {
                    m.SendLocalizedMessage(1112226);
                    return false;
                }
                else
                {
                    m.SendLocalizedMessage(1113708);
                    return true;
                }
            }
        }
 

Madogi

Squire
now that ive fixed that one ive got a lovly new error and this one has me gone maybe i should of learn more before i jumped in head first

Code:
RunUO Version 2.1, Build 4797.18420
Operating System: Microsoft Windows NT 6.1.7601 Service Pack 1
.NET Framework: 4.0.30319.1
Time: 20/02/2013 9:24:00 AM
Mobiles: 40878
Items: 209388
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
   at Server.Network.NetState.Receive_Process(SocketAsyncEventArgs e) in c:\path\NetState.cs:line 716
   at Server.Network.NetState.Receive_Completion(Object sender, SocketAsyncEventArgs e) in c:\path\NetState.cs:line 693
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Net.Sockets.SocketAsyncEventArgs.FinishOperationSuccess(SocketError socketError, Int32 bytesTransferred, SocketFlags flags)
   at System.Net.Sockets.SocketAsyncEventArgs.CompletionPortCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
   at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
 
Clients:
- Count: 0
 

Attachments

  • NetState.cs
    28.6 KB · Views: 5

Murzin

Knight
if you are getting a netstate error, it is not a netstate issue.

what you are getting is a gump error.

unless of course you DID modify that netstate file.

either post your gump file throwing the error, or your netstate file in code tags with the portion you changed flagged somehow so we know where your changes were.
 

Soteric

Knight
How did you compile the Core? What options did you use?

How did you get this error? Is it reproducable or happens by accident? How often do you get it?
 

Murzin

Knight
soteric, thats a gump issue i am willing to bet. look at a gump, the gump design itself has all the design/layout stuff, and then at the bottom of the gump where the switch cases is for the reply buttons, it passes "Netstate state" which is the mobile that accessed the gump.

what i am willing to bet, is that either they designed the gump and forgot a default or case 0 reply, or did not verify if that "state" variable ( which is actually a mobile reference for the player "using" the gump is valid. or they are doing a cast and not making sure that the value works. thats where the problem actually lies i bet. in the gump "reply" code.
 

Soteric

Knight
The gump would be mentioned in stack trace then.

I assume it is a bug in RunUO core. It happens in "#if Framework_4_0" section which is disabled by default. If you compare it with OnReceive which serves the same purposes on non Framework_4_0 environment you see that it's protected by try-catch and just ignores any errors. I assume the NetState was disposed (client disconnected or something like that), then Receive_Process called (probably we read some data left in network tcp buffer for this socket). Then it tries to invoke "m_Buffer.Enqueue( buffer, 0, byteCount );" but m_Buffer is already null because it becomes null when you dispose NetState instance. Here you get NullReferenceException. It's just an assumption though. That's why I'd like to see details.
 

Pure Insanity

Sorceror
The error he got above is related to what is marked off as the NewAsyncSockets, which has already been verified to be buggy. Why it was changed to not be included when compiling with Framework_4_0 a while back. Now you must compile with NewAsyncSockets to enable this method and bug test it further. I'm guessing that he has an older svn copy.

This patch should actually fix the bug he was getting if he wanted to go back and try NewAsyncSockets again.

http://www.runuo.com/community/thre...onths-with-a-live-server.532096/#post-3960831
 

Madogi

Squire
actualy i found out what was causing this a user was macroing on the Daat99 token stone to buy 2billions worth of items and then he clicked buy and it caused this error temporarly disabled the stone and so far have been fine
 

Pure Insanity

Sorceror
No, you think that's what caused it. Your issue was clearly related to the async sockets, as the crash log stated. You had the core compiled to use a newer "experimental" socket setup. If you've compiled the core with 2.0 now instead, then it would of fixed the issue as the new feature is a .net 4.0 feature.
 
Top