Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
The Attack Cat
retired moderator
Original Poster
#1 Old 28th Jan 2010 at 10:47 PM Last edited by Kolipoki : 29th Jan 2010 at 9:56 PM.
Default [Solved] Script Error causing game to not close
So i was recently trying out my mod and as I was leaving, it wouldn't close. I eventually got this error from the script

Code:
<?xml version="1.0" encoding="utf-8"?>
<ScriptError Version="6" Type="MiniScriptError" MaxRecursionDepth="0">
  <ExceptionData>simulating object is null
unable to obtain an interaction object

A null value was found where an object instance was required.
#0: 0x0000e callvirt   in KolipokiMod.KolipokiMod.Booclass:OnSelected (Sims3.Gameplay.EventSystem.Event) ([0B68B2A0] )
#1: 0x00000            in Sims3.Gameplay.EventSystem.Sims3.Gameplay.EventSystem.ProcessEventDelegate:Invoke (Sims3.Gameplay.EventSystem.Event) (2017CAA0 [0B68B2A0] )
#2: 0x00007 callvirt   in Sims3.Gameplay.EventSystem.Sims3.Gameplay.EventSystem.DelegateListener:ProcessEvent (Sims3.Gameplay.EventSystem.Event) (0B7AE0E0 [0B68B2A0] )
#3: 0x00054 callvirt   in Sims3.Gameplay.EventSystem.Sims3.Gameplay.EventSystem.EventTracker:ProcessEvent (Sims3.Gameplay.EventSystem.Event) (0ACDE7B0 [0B68B2A0] )
#4: 0x0000e callvirt   in Sims3.Gameplay.EventSystem.Sims3.Gameplay.EventSystem.EventTracker:SendEvent (Sims3.Gameplay.EventSystem.Event) ([0B68B2A0] )
#5: 0x0000e call       in Sims3.Gameplay.EventSystem.Sims3.Gameplay.EventSystem.EventTracker:SendEvent (Sims3.Gameplay.EventSystem.EventTypeId,Sims3.Gameplay.Interfaces.IActor,Sims3.Gameplay.Interfaces.IGameObject) ([2] [00000000] [1FF91000] )
#6: 0x00153 call       in Sims3.Gameplay.Core.Sims3.Gameplay.Core.PlumbBob:DoSelectActor (Sims3.Gameplay.Actors.Sim,bool) ([00000000] [1] )
#7: 0x00005 call       in Sims3.Gameplay.Core.Sims3.Gameplay.Core.PlumbBob:ForceSelectActor (Sims3.Gameplay.Actors.Sim) ([00000000] )
#8: 0x00007 call       in Sims3.Gameplay.Core.Sims3.Gameplay.Core.PlumbBob:Shutdown () ()
#9: 0x00000            in Sims3.Gameplay.Utilities.Initializers+InitializerType:Invoke () ()
#10: 0x00019 callvirt   in Sims3.Gameplay.Utilities.Initializers+Action:DoShutdown () ()
#11: 0x00025 callvirt   in Sims3.Gameplay.Utilities.Sims3.Gameplay.Utilities.Initializers:Shutdown () ()
#12: 0x0003f callvirt   in Sims3.Gameplay.Sims3.Gameplay.InWorldState:Shutdown () ()
#13: 0x00012 callvirt   in Sims3.SimIFace.Sims3.SimIFace.StateMachineStatus:ShutdownCurState () ()
#14: 0x0000a call       in Sims3.SimIFace.Sims3.SimIFace.StateMachineStatus:SetState (Sims3.SimIFace.StateMachineState) (0A9E2C40 [0A9EBCD0] )
#15: 0x0009c callvirt   in Sims3.SimIFace.Sims3.SimIFace.StateMachine:Update (single) (0A9FBEE0 [0] )
#16: 0x00017 callvirt   in Sims3.SimIFace.Sims3.SimIFace.StateMachine:Simulate () ()
</ExceptionData>
  <GameData>
    <BuildType>Release Mono</BuildType>
    <CommandLine>C:\Program Files\Electronic Arts\The Sims 3\Game\Bin\TS3.exe</CommandLine>
    <Game_Version>1.8.25.003001</Game_Version>
    <Code_Version>0.RL-2.0.79</Code_Version>
    <Content_Version>1.Content.rl.10</Content_Version>
    <Thumbnail_Version>1.Thumbnail.dl.933</Thumbnail_Version>
    <TCC_Version>1.TCC.dl.1209</TCC_Version>
    <Build_Version>0.2.0.79</Build_Version>
    <Type>Release</Type>
    <Timestamp>2009-12-14-1916</Timestamp>
    <CPU_Level>Medium</CPU_Level>
    <GPU_Level>UltraHigh</GPU_Level>
    <Game_Start>2010-01-28 14:43:12</Game_Start>
    <Data>C:\Program Files\Electronic Arts\The Sims 3/GameData\</Data>
    <Overrides>(none)</Overrides>
    <Exe_Path>C:\Program Files\Electronic Arts\The Sims 3\Game\Bin\</Exe_Path>
    <User>codebuilder</User>
    <Host>SIMS-BUILD134</Host>
  </GameData>
  <ObjectData>
  </ObjectData>
</ScriptError>


Here's the function of the code that it says it's having a problem with.

Code:
        protected static ListenerAction OnSelected(Event e)
        {
            try
            {
                Sim targetObject = e.TargetObject as Sim;

                if (targetObject != null)
                {
                    if (Sim.ActiveActor.Inventory.ContainsTypeNotInUse(typeof(Football), 1))
                    {
                        List<Sim> list = new List<Sim>(Sims3.Gameplay.Queries.GetObjects<Sim>());

                        foreach (Sim sim in list)
                        {

                            AddInteractions(sim);
                        }
                    }
                    else
                    {
                        List<Sim> list = new List<Sim>(Sims3.Gameplay.Queries.GetObjects<Sim>());
                        foreach (Sim sim in list)
                        {
                            if (sim != null)
                            {
                                RemoveInteractions(sim);
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Exception(exception);
            }

            return ListenerAction.Keep;
        }


Any thoughts/ideas on what's wrong? Also, any idea on how to make this function run smoother? When in game and you switch sims it takes away because it needs to be sure to remove the interactions so that if one sim has the football and you switch to someone else who doesn't the interactions won't be there anymore.
Advertisement
Top Secret Researcher
#2 Old 28th Jan 2010 at 11:58 PM
Tracking down those script errors is a nuisance. I usually open up my own mod in Reflector, and switch to viewing "IL" so I can get the line numbers.

In this case it failed "around" line 0e in your function. Check for any callvirt rows near that line of code and check which pointers they are running off.

My guess would be that "Sim.ActiveActor" is probably "null", and you need to add a conditional to check for such.

Cheers.

NRaas Industries: Sims 3 Mods for the Discerning Player, hosted by The Wikispaces.
The Attack Cat
retired moderator
Original Poster
#3 Old 29th Jan 2010 at 12:16 AM
Well it would be nice if there was an 0e but there isn't. I tried the if activeactor !=null but it didn't work as well.
Top Secret Researcher
#4 Old 29th Jan 2010 at 1:10 AM
Honestly, I don't think the use of Sim.ActiveActor in that function is the best choice.

You should probably use the "targetObject" that you have instead.

Cheers.

NRaas Industries: Sims 3 Mods for the Discerning Player, hosted by The Wikispaces.
The Attack Cat
retired moderator
Original Poster
#5 Old 29th Jan 2010 at 1:18 AM
Well I wont be able to do that because i need to check if the person that you are currently using has a certain item in their inventory for the interaction to appear on others. Using "targetObject" would check to see if that sim had the inventory item and then add the interaction to that sim.
Top Secret Researcher
#6 Old 29th Jan 2010 at 4:51 AM
Got it. In this event, e.TargetObject is the previously selected sim, and e.Actor is the new one.

Still, you'll need to check to ensure that the new selection is "!= null", as when the game closes, the active actor is invalidated.

Not sure why checking against null failed to solve your issue.

Good Luck.

NRaas Industries: Sims 3 Mods for the Discerning Player, hosted by The Wikispaces.
The Attack Cat
retired moderator
Original Poster
#7 Old 29th Jan 2010 at 5:01 AM
Yes, that still works, but it doesn't fix the problem. Here is my latest code

Code:
protected static ListenerAction OnSelected(Event e)
        {
            try
            {
                Sim targetObject = e.TargetObject as Sim;
                if (targetObject != null)
                {
                    if (e.Actor != null)
                    {
                        if (e.Actor.Inventory != null)
                        {
                            if (e.Actor.Inventory.ContainsTypeNotInUse(typeof(Football), 1))
                            {
                                List<Sim> list = new List<Sim>(Sims3.Gameplay.Queries.GetObjects<Sim>());
                                foreach (Sim sim in list)
                                {
                                    AddInteractions(sim);
                                }
                            }
                            if (!e.Actor.Inventory.ContainsTypeNotInUse(typeof(Football), 1))
                            {
                                List<Sim> list = new List<Sim>(Sims3.Gameplay.Queries.GetObjects<Sim>());
                                foreach (Sim sim in list)
                                {
                                    if (sim != null)
                                    {
                                        RemoveInteractions(sim);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Exception(exception);
            }
            return ListenerAction.Keep;
        }
Top Secret Researcher
#8 Old 29th Jan 2010 at 4:58 PM
Still getting the script error at the same location? Because that would be odd, as the code has changed.

Which line is it busting out on now?

Cheers.

NRaas Industries: Sims 3 Mods for the Discerning Player, hosted by The Wikispaces.
The Attack Cat
retired moderator
Original Poster
#9 Old 29th Jan 2010 at 8:23 PM
Here is the error script i got from it.

Code:
<?xml version="1.0" encoding="utf-8"?>
<ScriptError Version="6" Type="MiniScriptError" MaxRecursionDepth="0">
  <ExceptionData>simulating object is null
unable to obtain an interaction object

A null value was found where an object instance was required.
#0: 0x0000e callvirt   in KolipokiMod.KolipokiMod.Booclass:OnSelected (Sims3.Gameplay.EventSystem.Event) ([2684D810] )
#1: 0x00000            in Sims3.Gameplay.EventSystem.Sims3.Gameplay.EventSystem.ProcessEventDelegate:Invoke (Sims3.Gameplay.EventSystem.Event) (0ABDBDC0 [2684D810] )
#2: 0x00007 callvirt   in Sims3.Gameplay.EventSystem.Sims3.Gameplay.EventSystem.DelegateListener:ProcessEvent (Sims3.Gameplay.EventSystem.Event) (0AABD820 [2684D810] )
#3: 0x00054 callvirt   in Sims3.Gameplay.EventSystem.Sims3.Gameplay.EventSystem.EventTracker:ProcessEvent (Sims3.Gameplay.EventSystem.Event) (0AAB23F0 [2684D810] )
#4: 0x0000e callvirt   in Sims3.Gameplay.EventSystem.Sims3.Gameplay.EventSystem.EventTracker:SendEvent (Sims3.Gameplay.EventSystem.Event) ([2684D810] )
#5: 0x0000e call       in Sims3.Gameplay.EventSystem.Sims3.Gameplay.EventSystem.EventTracker:SendEvent (Sims3.Gameplay.EventSystem.EventTypeId,Sims3.Gameplay.Interfaces.IActor,Sims3.Gameplay.Interfaces.IGameObject) ([2] [00000000] [0BFCF330] )
#6: 0x00153 call       in Sims3.Gameplay.Core.Sims3.Gameplay.Core.PlumbBob:DoSelectActor (Sims3.Gameplay.Actors.Sim,bool) ([00000000] [1] )
#7: 0x00005 call       in Sims3.Gameplay.Core.Sims3.Gameplay.Core.PlumbBob:ForceSelectActor (Sims3.Gameplay.Actors.Sim) ([00000000] )
#8: 0x00007 call       in Sims3.Gameplay.Core.Sims3.Gameplay.Core.PlumbBob:Shutdown () ()
#9: 0x00000            in Sims3.Gameplay.Utilities.Initializers+InitializerType:Invoke () ()
#10: 0x00019 callvirt   in Sims3.Gameplay.Utilities.Initializers+Action:DoShutdown () ()
#11: 0x00025 callvirt   in Sims3.Gameplay.Utilities.Sims3.Gameplay.Utilities.Initializers:Shutdown () ()
#12: 0x0003f callvirt   in Sims3.Gameplay.Sims3.Gameplay.InWorldState:Shutdown () ()
#13: 0x00012 callvirt   in Sims3.SimIFace.Sims3.SimIFace.StateMachineStatus:ShutdownCurState () ()
#14: 0x0000a call       in Sims3.SimIFace.Sims3.SimIFace.StateMachineStatus:SetState (Sims3.SimIFace.StateMachineState) (0A9E2C00 [0A9EBC30] )
#15: 0x0009c callvirt   in Sims3.SimIFace.Sims3.SimIFace.StateMachine:Update (single) (0A9FBEE0 [0] )
#16: 0x00017 callvirt   in Sims3.SimIFace.Sims3.SimIFace.StateMachine:Simulate () ()
</ExceptionData>
  <GameData>
    <BuildType>Release Mono</BuildType>
    <CommandLine>C:\Program Files\Electronic Arts\The Sims 3\Game\Bin\TS3.exe</CommandLine>
    <Game_Version>1.8.25.003001</Game_Version>
    <Code_Version>0.RL-2.0.79</Code_Version>
    <Content_Version>1.Content.rl.10</Content_Version>
    <Thumbnail_Version>1.Thumbnail.dl.933</Thumbnail_Version>
    <TCC_Version>1.TCC.dl.1209</TCC_Version>
    <Build_Version>0.2.0.79</Build_Version>
    <Type>Release</Type>
    <Timestamp>2009-12-14-1916</Timestamp>
    <CPU_Level>Medium</CPU_Level>
    <GPU_Level>UltraHigh</GPU_Level>
    <Game_Start>2010-01-29 12:19:25</Game_Start>
    <Data>C:\Program Files\Electronic Arts\The Sims 3/GameData\</Data>
    <Overrides>(none)</Overrides>
    <Exe_Path>C:\Program Files\Electronic Arts\The Sims 3\Game\Bin\</Exe_Path>
    <User>codebuilder</User>
    <Host>SIMS-BUILD134</Host>
  </GameData>
  <ObjectData>
  </ObjectData>
</ScriptError>
Top Secret Researcher
#10 Old 29th Jan 2010 at 9:43 PM
Yeah, I don't get that. The added conditionals should have changed the position of the error, unless the error is occurring prior to your new additions.

Old code: The erroneous callvirt would probably have been the get_Inventory() call on a "null" value returned from get_ActiveActor()

Code:
    L_000c: ldloc.0 
    L_000d: brfalse L_009c
    L_0012: call class [Sims3GameplaySystems]Sims3.Gameplay.Actors.Sim [Sims3GameplaySystems]Sims3.Gameplay.Actors.Sim::get_ActiveActor()
    L_0017: callvirt instance class [Sims3GameplaySystems]Sims3.Gameplay.Inventory [Sims3GameplaySystems]Sims3.Gameplay.Abstracts.GameObject::get_Inventory()


New code: There is no callvirt that is applicable. arg.0 is obviously not null (it is listed in the stack dump as [2684D810]).

Code:
    L_000c: ldloc.0 
    L_000d: brfalse L_00d5
    L_0012: ldarg.0 
    L_0013: callvirt instance class [Sims3GameplaySystems]Sims3.Gameplay.Interfaces.IActor [Sims3GameplaySystems]Sims3.Gameplay.EventSystem.Event::get_Actor()
    L_0018: brfalse L_00d5


Provided the old mod is not still somehow installed, I'm unclear why the error is still occurring.

Intriguing.

NRaas Industries: Sims 3 Mods for the Discerning Player, hosted by The Wikispaces.
The Attack Cat
retired moderator
Original Poster
#11 Old 29th Jan 2010 at 9:55 PM
I'd have to say this was one of the most stupidest mistakes in my modding career. So I was using a package that had a name that made no sense to the actually mod. So I decided to change it and save it as a new package but keep the old one to have a template for other stuff. As you can guess I never removed the old one, so i was running two packages and the other one was coming up with the problem. I'm also excited about this finding in the fact that in my game my mod randomly made two interactions appear. If that shouldn't have been an indicator of my mistake I don't know what would. But now, my interactions only come up once, and they work better then i thought they were because i was trying to run the old interactions.

Thanks so much for the help, I'm sure the new package still had the problem so I still would have had to change it.
Top Secret Researcher
#12 Old 29th Jan 2010 at 10:16 PM
Glad you resolved the problem.

Cheers.

NRaas Industries: Sims 3 Mods for the Discerning Player, hosted by The Wikispaces.
Back to top