Curious Error, would like to know what is causing it?
by Doctor Fail · in Torque 2D Beginner · 11/09/2013 (9:45 am) · 5 replies
Ok, so I'm attempting to figure out working with the GUI system in T2D and I figured I would start by determining what was ABSOLUTELY necessary to create a basic GuiControl, and then the derivatives thereof. I came across this error:
Field value cannot be NULL
I took this as a small success, as it appears that there is some information I have not provided which is crucial to the creation of a control.
So... here is the culprit file:
<GuiControl
Name="Nope"
Profile="GuiDefaultProfile"
HorizSizing="relative"
VertSizing="relative"
Position="0 0"
Extent="1024 30"
MinExtent="220 30"
Visible="1"
/>
A taml which I was attempting to use to see all of the available fields for each control via the taml manipulation code now offered in torquescript. Now, when I load this object, the game asserts a fatal error. the one you see above. You should know that I have defined GuiDefaultProfile elsewhere.
My question, and indeed the key to my future success or failure with these, is this:
What exactly is missing, and more importantly, why?
In addition, if you wish, I should very much like to know if the required fields are the same for every gui control, such as GuiWindowCtrl? If not, is there anywhere I can find out which fields MUST be filled out?
Field value cannot be NULL
I took this as a small success, as it appears that there is some information I have not provided which is crucial to the creation of a control.
So... here is the culprit file:
<GuiControl
Name="Nope"
Profile="GuiDefaultProfile"
HorizSizing="relative"
VertSizing="relative"
Position="0 0"
Extent="1024 30"
MinExtent="220 30"
Visible="1"
/>
A taml which I was attempting to use to see all of the available fields for each control via the taml manipulation code now offered in torquescript. Now, when I load this object, the game asserts a fatal error. the one you see above. You should know that I have defined GuiDefaultProfile elsewhere.
My question, and indeed the key to my future success or failure with these, is this:
What exactly is missing, and more importantly, why?
In addition, if you wish, I should very much like to know if the required fields are the same for every gui control, such as GuiWindowCtrl? If not, is there anywhere I can find out which fields MUST be filled out?
#2
if(!isObject(GuiDefaultProfile)) new GuiControlProfile (GuiDefaultProfile)
{
Modal = true; // can someone explain this field?
};
If this is where I've made a mistake, I would appreciate knowing. And more importantly, why.
Thanks for responding so quickly.
11/09/2013 (10:03 am)
As I have no idea where to begin, as it is right now, I'm using this:if(!isObject(GuiDefaultProfile)) new GuiControlProfile (GuiDefaultProfile)
{
Modal = true; // can someone explain this field?
};
If this is where I've made a mistake, I would appreciate knowing. And more importantly, why.
Thanks for responding so quickly.
#3
11/09/2013 (10:24 am)
It might be due to me being tired, but I don't a problem with your definition on the surface. Are you executing the script that has the GuiDefaultProfile definition? Are you able to debug from a compiler (Visual Studio or Xcode) to see what it breaks on?
#4
I have gone throught the code and found that the error I see comes from the function:
11/09/2013 (10:39 am)
I don't have ready access to a compiler/debugger at the current momentI have gone throught the code and found that the error I see comes from the function:
const char *SimObject::getPrefixedDataField(StringTableEntry fieldName, const char *array)
{
// Sanity!
AssertFatal( fieldName != NULL, "Cannot get field value with NULL field name." );
// Fetch field value.
const char* pFieldValue = getDataField( fieldName, array );
// Sanity.
AssertFatal( pFieldValue != NULL, "Field value cannot be NULL." );
// Return without the prefix if there's no value.
if ( *pFieldValue == 0 )
return StringTable->EmptyString;
// Fetch the field prefix.
StringTableEntry fieldPrefix = getDataFieldPrefix( fieldName );
// Sanity!
AssertFatal( fieldPrefix != NULL, "Field prefix cannot be NULL." );
// Calculate a buffer size including prefix.
const U32 valueBufferSize = dStrlen(fieldPrefix) + dStrlen(pFieldValue) + 1;
// Fetch a buffer.
char* pValueBuffer = Con::getReturnBuffer( valueBufferSize );
// Format the value buffer.
dSprintf( pValueBuffer, valueBufferSize, "%s%s", fieldPrefix, pFieldValue );
return pValueBuffer;
} within the T2D source, however, I have not spent enough time with the engines code to find out where this is used.
#5
this is my guiProfiles.cs:
Now that I've beaten my head against the wall thinking it was gui formatting issues... I realise must be using the taml object incorrectly.
11/09/2013 (2:16 pm)
ok, the code I used to manipulate the taml files appears to be the problem. not the gui. Sorry for the headache, but now I need to figure out what I have done wrong with the taml.this is my guiProfiles.cs:
if(!isObject(GuiDefaultProfile)) new GuiControlProfile (GuiDefaultProfile)
{
Modal = true;
};
new GuiControl(Nope)
{
Name="Nope";
Profile="GuiDefaultProfile";
HorizSizing="relative";
VertSizing="relative";
Position="0 0";
Extent="1024 30";
MinExtent="220 30";
Visible="1";
};
%taml = new Taml()
{
WriteDefaults = true;
Format = Xml;
};
%taml.write(Nope, "./log.gui.taml");
%taml.delete();Now that I've beaten my head against the wall thinking it was gui formatting issues... I realise must be using the taml object incorrectly.
Employee Michael Perry
ZombieShortbus