Results 1 to 7 of 7

Thread: [2005] System.NullReferenceException: Object reference not set to an instance of an

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2007
    Posts
    4

    [2005] System.NullReferenceException: Object reference not set to an instance of an

    Hi i am trying to make a proxy for a mmorpg but i get the following errors.

    at TBot.TBot.TCharBot.ParseThingMove(NetworkMessage& msg) in C:\Documents and Settings\All Users\Documents\Tibia\TBot\TBot\TCharBot.vb:line 1097
    at TBot.TBot.TCharBot.ParseMessage(NetworkMessage& msg) in C:\Documents and Settings\All Users\Documents\Tibia\TBot\TBot\TCharBot.vb:line 982
    at TBot.TBot.TCharBot.SocketThreadProc() in C:\Documents and Settings\All Users\Documents\Tibia\TBot\TBot\TCharBot.vb:line 1176
    ParseMessage: System.NullReferenceException: Object reference not set to an instance of an object.
    at TBot.TBot.TCharBot.ParseThingAppear(NetworkMessage& msg) in C:\Documents and Settings\All Users\Documents\Tibia\TBot\TBot\TCharBot.vb:line 1077
    at TBot.TBot.TCharBot.ParseMessage(NetworkMessage& msg) in C:\Documents and Settings\All Users\Documents\Tibia\TBot\TBot\TCharBot.vb:line 982
    at TBot.TBot.TCharBot.SocketThreadProc() in C:\Documents and Settings\All Users\Documents\Tibia\TBot\TBot\TCharBot.vb:line 1176
    Unknown byte 41.
    errors are displayed by this
    Code:
    Me.Trace(("ParseMessage: " & exception1.ToString))
    the errors are occurring in this code
    Code:
            Private Sub SocketThreadProc()
                Dim message1 As New NetworkMessage
                Dim list1 As New ArrayList
                Dim list2 As New ArrayList
                Dim list3 As New ArrayList
                Do While (Me.ClientSocket.Connected AndAlso Me.ServerSocket.Connected)
                    Dim bot1 As TCharBot
                    list1.Clear()
                    list1.Add(Me.ClientSocket)
                    list1.Add(Me.ServerSocket)
                    list3.Clear()
                    list3.Add(Me.ClientSocket)
                    list3.Add(Me.ServerSocket)
                    Socket.Select(list1, list2, list3, 20)
                    If list1.Contains(Me.ClientSocket) Then
                        'send messages from client to server without using xtea
                        message1.ReadStraightFromSocket(Me.ClientSocket)
                        message1.WriteStraightToSocket(Me.ServerSocket)
                    End If
                    If list1.Contains(Me.ServerSocket) Then
                        message1.ReadFromSocket(Me.ServerSocket)
                        Try
                            bot1 = Me
                            SyncLock bot1
                                Me.ParseMessage(message1)
                            End SyncLock
                        Catch exception1 As Exception
                            Me.Trace(("ParseMessage: " & exception1.ToString))
                        End Try
                        message1.WriteToSocket(Me.ClientSocket)
                    End If
                    Try
                        bot1 = Me
                        SyncLock bot1
                            Me.DoBot()
                            Continue Do
                        End SyncLock
                        Continue Do
                    Catch exception2 As Exception
                        Me.Trace(("DoBot: " & exception2.ToString))
                        Continue Do
                    End Try
                Loop
                If Me.ClientSocket.Connected Then
                    Me.ClientSocket.Close()
                End If
                If Me.ServerSocket.Connected Then
                    Me.ServerSocket.Close()
                End If
                If ((Not MyBase.Parent Is Nothing) AndAlso (Not MyBase.Parent.Parent Is Nothing)) Then
                    CType(MyBase.Parent.Parent, TBot).StopTCharBot(Me)
                End If
            End Sub

    how i initialize the parseprocs
    Code:
            Public Sub New(ByVal serverSocket As Socket, ByVal clientSocket As Socket)
                Me.Map = New Map
                Me.ParseProcs = New ParseProc(256  - 1) {}
                Me.LootItems = New Hashtable
                Me.Attackers = New Queue
                Me.CheckBodyPositions = New Queue
                Me.AttackedCreature = 0
                Me.Inventory = New Item(10  - 1) {}
                Me.Waypoints = New ArrayList
                Me.OpenContainers = New Hashtable
                Me.NextDance = 0
                Me.NextFishing = 0
                Me.NextLoot = 0
                Me.NextWayCheck = 0
                Me.ScheduledSteps = 0
                Me.NextWayPoint = Nothing
                Me.rand = New Random
                Me.doBotMsg = New NetworkMessage
                Me.CId = 0
                Me.MapCenterPosInitial = Nothing
                Me.MapCenterPos = New Position
                Me.LightLevel = 0
                Me.InitializeComponent
                Me.ParseProcs(10) = New ParseProc(AddressOf Me.ParseOwnId)
                Me.ParseProcs(11) = New ParseProc(AddressOf Me.ParseBanOptions)
                Me.ParseProcs(30) = New ParseProc(AddressOf Me.ParsePing)
                Me.ParseProcs(50) = New ParseProc(AddressOf Me.ParseReportOption)
                Me.ParseProcs(100) = New ParseProc(AddressOf Me.ParseMapComplete)
                Me.ParseProcs(101) = New ParseProc(AddressOf Me.ParseMapNorth)
                Me.ParseProcs(102) = New ParseProc(AddressOf Me.ParseMapEast)
                Me.ParseProcs(103) = New ParseProc(AddressOf Me.ParseMapSouth)
                Me.ParseProcs(104) = New ParseProc(AddressOf Me.ParseMapWest)
                Me.ParseProcs(105) = New ParseProc(AddressOf Me.ParseMapTile)
                Me.ParseProcs(106) = New ParseProc(AddressOf Me.ParseThingAppear)
                Me.ParseProcs(107) = New ParseProc(AddressOf Me.ParseThingChange)
                Me.ParseProcs(108) = New ParseProc(AddressOf Me.ParseThingRemove)
                Me.ParseProcs(109) = New ParseProc(AddressOf Me.ParseThingMove)
                Me.ParseProcs(110) = New ParseProc(AddressOf Me.ParseContainerOpen)
                Me.ParseProcs(111) = New ParseProc(AddressOf Me.ParseContainerClose)
                Me.ParseProcs(112) = New ParseProc(AddressOf Me.ParseContainerAddItem)
                Me.ParseProcs(113) = New ParseProc(AddressOf Me.ParseContainerChangeItem)
                Me.ParseProcs(114) = New ParseProc(AddressOf Me.ParseContainerRemoveItem)
                Me.ParseProcs(120) = New ParseProc(AddressOf Me.ParseInventoryItem)
                Me.ParseProcs(121) = New ParseProc(AddressOf Me.ParseClearInventoryItem)
                Me.ParseProcs(130) = New ParseProc(AddressOf Me.ParseLightLevel)
                Me.ParseProcs(131) = New ParseProc(AddressOf Me.ParseMagicEffect)
                Me.ParseProcs(132) = New ParseProc(AddressOf Me.ParseAnimatedText)
                Me.ParseProcs(133) = New ParseProc(AddressOf Me.ParseDistanceShoot)
                Me.ParseProcs(134) = New ParseProc(AddressOf Me.ParseBlackBox)
                Me.ParseProcs(140) = New ParseProc(AddressOf Me.ParseCreatureHealth)
                Me.ParseProcs(141) = New ParseProc(AddressOf Me.ParseCreatureLight)
                Me.ParseProcs(142) = New ParseProc(AddressOf Me.ParseCreatureOutfit)
                Me.ParseProcs(143) = New ParseProc(AddressOf Me.ParseCreatureSpeed)
                Me.ParseProcs(144) = New ParseProc(AddressOf Me.ParseCreatureSkull)
                Me.ParseProcs(145) = New ParseProc(AddressOf Me.ParseCreatureShield)
                Me.ParseProcs(160) = New ParseProc(AddressOf Me.ParsePlayerStats)
                Me.ParseProcs(161) = New ParseProc(AddressOf Me.ParsePlayerSkills)
                Me.ParseProcs(162) = New ParseProc(AddressOf Me.ParsePlayerStatus)
                Me.ParseProcs(163) = New ParseProc(AddressOf Me.ParseCancelAttack)
                Me.ParseProcs(170) = New ParseProc(AddressOf Me.ParseCreatureSpeak)
                Me.ParseProcs(172) = New ParseProc(AddressOf Me.ParseOpenChannel)
                Me.ParseProcs(180) = New ParseProc(AddressOf Me.ParseTextMessage)
                Me.ParseProcs(181) = New ParseProc(AddressOf Me.ParseCancelWalk)
                Me.ParseProcs(190) = New ParseProc(AddressOf Me.ParseMapUp)
                Me.ParseProcs(191) = New ParseProc(AddressOf Me.ParseMapDown)
                Me.ParseProcs(210) = New ParseProc(AddressOf Me.ParseVipEntry)
                Me.ParseProcs(211) = New ParseProc(AddressOf Me.ParseCreatureId)
                Me.ServerSocket = serverSocket
                Me.ClientSocket = clientSocket
                Me.SocketThread = New Thread(New ThreadStart(AddressOf Me.SocketThreadProc))
                Me.SocketThread.Start()
    
                'Extra Added By Me
                Me.HP = 0
                Me.MaxHP = 0
                Me.Capacity = 0
                Me.Exp = 0
                Me.Level = 0
                Me.MP = 0
                Me.MaxMP = 0
                Me.MagLvl = 0
                Me.Soulpoints = 0
                Me.Stamina = 0
            End Sub
    Last edited by dudeman501; Mar 18th, 2007 at 07:23 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width