Author Topic: Unique key problems  (Read 3750 times)

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Unique key problems
« on: 2007-04-04, 09:49:36 PM »
While editing a test project (stickman battle arena!), I was using simple names, often repeating the same name in different places.  I got to a point to try to compile it and it showed up with an error that the tileset m_Tiles was already in use when trying to compile.  Then, when I tried again, it gave an object reference error. Then, loading the project again, I got a unique key violation error.  I didn't do any editing of the .sgdk2 file directly.  I've attached the project for reference.
Edward Dassmesser

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Unique key problems
« Reply #1 on: 2007-04-05, 05:48:20 AM »
The frames in the "Tiles" frameset are somehow referring to a non-existent graphic sheet "New Sheet 1".  In notepad I replaced "New Sheet 1" with "Tiles" and the project loads fine.  You could probably do the same to fix your copy.  Let me know if you know how to reproduce that problem.

Also, I haven't finished implementing name validation (although I'm not sure I'll remember without help like this).  The following names are invalid for a tileset (they are like "reserved words"):
Tiles
nTileWidth
nTileHeight
strFrameset

Also, I don't know how you got a lowercase "animate" in the "Else animate by velocity" rule, but that had to be fixed before the project would compile too.

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Unique key problems
« Reply #2 on: 2007-04-05, 05:57:01 AM »
1) I suspect the reason you have a lowercase "animate" is because you had to type it in manually when the project wouldn't compile.

2) I renamed the Code Generator object from "m_Tiles" to "m_arTiles" so now the reserved word is "arTiles", which is less likely to collide with a random name the user would pick.

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: Unique key problems
« Reply #3 on: 2007-04-05, 08:48:29 AM »
Well, I had originally created the New Sheet 1, and had a bunch of different windows open, then I renamed it to Tiles (still with windows open), but everything seemed to update just fine.  Apparently not.

Also:

Code: [Select]
   public bool IsInState([Editor("SpriteState", "UITypeEditor")] int FirstState, [Editor("SpriteState", "UITypeEditor")] int LastState)
   {
      Debug.Assert(this.isActive, "Attempted to execute IsInState on an inactive sprite");
      return (state <= FirstState) && (state >= LastState);
   }

Does this seem backwards to you?
Edward Dassmesser

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Unique key problems
« Reply #4 on: 2007-04-05, 04:35:34 PM »
Does this seem backwards to you?

Quite.  Guess I'll just go ahead and switch that then.