"Unknown reference" checking when saving ??

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

"Unknown reference" checking when saving ??

Post by jph_wacheski »

Unknown reference: (D:\Data\Delphi32\ZzDC_Public\ZClasses.pas, line 2816)
I have unfortunatly generated this error a few times now,. and it is a tad frustrating. I belive it arrises when I rename, move, or delete a component and leave some hanging reference to it,. ? Should not the editor run a check when saving to point out or fix any problem left like this created while editing the game file?
Also is there any way to fix the broken file I have now,. it has a couple hours work on it and I would rather fix the XML in a text editor then rebuild all the structures of components,. . the line referance makes no sence in my text editor,. . I'm not sure it is actually refering to the XML file.
iterationGAMES.com
User avatar
Kjell
Posts: 1883
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hi jph,

This looks more like a source code error then something you've done wrong in your project. Any idea what component is causing the error? Perhaps you could copy your project file and start deleting components until the error disappears in order to isolate the problem. Are you using Ville's most recent Beta build, or did you build a version of your own?

You have to be careful with references though as it's not entirely bullet proof. For instance, when you try to delete a DefineVariable component that is referenced elsewhere in a ZExpression, you get the "Cannot delete, other components refers* to this component." error, but when you try the same with a DefineConstant, you won't get a warning and the component will be deleted ( During playback you then get the "Unknown identifier Constant" error. ). And not sure if a full node tree validation is done upon saving a file, I doubt it though.

*Typo: Should be "refer" :wink:

K
Last edited by Kjell on Mon Nov 17, 2008 4:19 pm, edited 1 time in total.
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

oh, I should have said it's the editor that throws this error when loading the file,. and then it refuses to load it!

I had just built the project and posted it here;

viewtopic.php?t=236&postdays=0&postorder=asc&start=15

Filaments_038.zip it is,. and as you ca nsee the game runs perfectly well,. however today when I try to open the project file,. the editor fails,. . I guess I can cut and past the changes to the last ver. from the XML if need be, just hopeing for a simpler solution.
iterationGAMES.com
User avatar
Kjell
Posts: 1883
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hey jph,

Build executables act a little different then playback in the Editor as far as I know .. no error / warning messages are shown, and it will just try to continue playback when a error occurs ( unless it crashes ). So there could have been a problem with the project at the time you saved it .. and I guess files do get validated upon loading. I haven't encountered this problem myself though, so I don't have much of a guess what could be causing it either :?

K
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

Well it was much easier to salvage the work by just cuting and pasting the components from the 'broken' XML file to last stable ver. it was only a handfull of components and I suppose the 'hours of work' where the tweeking to get it working/looking like I wanted,. so this one is ok now :)
I have however had this same error few times in the past, and think that a check of some sort for this type of error when saving the xml could save people much posible frustration. I almost sure it is something to do with renaming components,. but not sure exactly why/how it happens,. . (ville- I can send you the broken .zgeproj if you are interested)

On an interesting note for other hackers needing to cut and past from a .zgejroj file open in a text/code editor,. one needs to include the string;

Code: Select all

ZZDC<?xml version="1.0" encoding="iso-8859-1" ?>


Insert this at the top of the cut text,. for the editor to recognize the buffered XML as a ZGE component,.
iterationGAMES.com
User avatar
VilleK
Site Admin
Posts: 2277
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

This error has never happened to me either, so I'd like to fix it if I can. Please send me the broken file jph.
User avatar
VilleK
Site Admin
Posts: 2277
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

JPH, in your file the following line was the problem:

<StartAnimator Animator=""/>

(line 1228)

I found a way to reproduce this:
1. Reference a component, for instance StartAnimator Animator="Test"
2. Change the name of animator "Test" to blank.
3. Save the project.

The correct way to handle this is to make the same check as when trying to remove a referenced component, and not allow set name to blank. Also the error message when reading a file should display the linenr for making it easier to find the problem. I'll try to add both.
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

Thanks Ville you roc! If there is a way to brake it I'm the monkey for the job,. LOL.
iterationGAMES.com
Post Reply