Author Topic: "Exception has been thrown by the target of an invocation." when editing a plan  (Read 3943 times)

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
I cannot reproduce this error in a blank project, but I can when I'm working on TVSGDK2.  If you want the .sgdk2 file, I can upload it.

Steps to reproduce:

Open SGDK2
Open TVSGDK2.sgdk2
Expand Maps
Expand Level 2
Expand Layers
Expand Foreground
Open Editor
Go to Plans Tab
Click New Plan button
Select the Plan ("Level 2 Plan 1")
Rename it ("Magnet Message")
Scroll down in the map to 76x1984
Enable Snap To Tiles (CTRL+T)
Add plan points at 76x1984 and 192x2000
Click Edit Selected Plan button
Click New Rule
Error shows up: "Exception has been thrown by the target of an invocation."

If you click New Rule again, it will show up again.  Every time you select a rule in that list, it will show up.  Build the project, and it goes away.

Side note: I think it would be a neat idea to automatically name rules based on the function they call if the user didn't add their own name.  Just split the words of the function based on capitalization and use that as the name of the rule (if the current name of the rule is "Rule x" or the name of the previously selected function).  I've seen XCode do something like this when working with layouts for the iPhone.
Edward Dassmesser

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
The version of TVSGDK2.sgdk2 that I have does not have a level 2.  Did you post that somewhere?  If not, can you upload it as you said you could?

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Yeah, I've been working on it.  I uploaded it to http://sgdk2.enigmadream.com/support/
Edward Dassmesser

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
I fixed the problem locally.  You can work around it by compiling the project after creating the plan (press F7) I think.  The problem is that the currently compiled version of the project doesn't know about the new plan yet, and now that it is reflecting on this specific plan instance instead of PlanBase to see what functions are available, it needed the specific plan to be available.  I changed the code to reflect on PlanBase when the specific plan is not available yet.

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
So this was introduced by the ability to move rules into code, right?

I wonder why I wasn't able to reproduce it with the template.  Maybe I just didn't try hard enough.
Edward Dassmesser

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
So this was introduced by the ability to move rules into code, right?

Yes

I wonder why I wasn't able to reproduce it with the template.  Maybe I just didn't try hard enough.

Maybe it's because the problem only occurs if you rename the plan before editing it.  When you create a new plan, I think the map editor compiles the project with the new plan in it in order to reflect on it to see what properties the plan has.