Aller au contenu

Photo

Script Error: UNDEFINED STRUCTURE


  • Veuillez vous connecter pour répondre
10 réponses à ce sujet

#1
Psionic-Entity

Psionic-Entity
  • Members
  • 195 messages

I'm getting this script error when I'm attempting to compile some of my scripts that have database entries. The line in question is in the "nwnx_sql" include with the following function:

string SQLVectorToString(vector vVector)
{
	float fX = vVector.x;
	float fY = vVector.y;
	float fZ = vVector.z;
    return "#POSITION_X#" + FloatToString(fX) + "#POSITION_Y#" + FloatToString(fY) +
        "#POSITION_Z#" + FloatToString(fZ) + "#END#";
}

Never had problems using this exact setup for SQL before. Any ideas?

 

EDIT

 

This seems to be affecting only the compilation of parametrized scripts (ie. ones built for use with ExecuteScriptEnhanced).



#2
kevL

kevL
  • Members
  • 4 070 messages

I'd guess vVector hasn't been defined, before it's passed to SQLVectorToString()


here's some other thoughts though:
i notice the error is not listed at Lexicon's Compiler Error Messages

Are you using Skywing's compiler? If not, its errors are more helpful, might even sort things out by itself.


not familiar with NwNx or SQL, and didn't have much luck w/ ExecuteScriptEnhanced() the one time I tried it. But,

1. are your parameters set up before the call, and is it the return from SQLVectorToString() that's getting passed in, as a parameter?

2. could try testing things with a straightforward string def'n, like

string sTest = "does_this_work";

3. could try defining all parameters ( all types ), or calling ClearScriptParams() first.

4. fall back on locals + ExecuteScript()


--
I'm guessing UNDEFINED STRUCTURE means that ExecuteScriptEnhanced references a struct, and maybe its variables - or the hardcoded struct itself - haven't been set up quite right before the call,

- perhaps ExecuteScriptEnhanced, being a late (2009) function, never really got a good debugging ... possible?



#3
Psionic-Entity

Psionic-Entity
  • Members
  • 195 messages

Just to be clear, this isn't a problem with the scripts. The thing calling the error has been in nwnx for half a decade without problems. The problem I'm having is that I can take a fully functional, compiling script, and make it not compile by replacing void main() with void main(int i = 0). This isn't any crashing ingame, it's just whether or not the script compiles. I am using the advanced compiler.



#4
kevL

kevL
  • Members
  • 4 070 messages

yeh, compiler error ...

 

well, try replacing (int i = 0) with (int i)

 

 

Skywing's says let the engine assign a default, which will be 0 in this case, on its own.



#5
Psionic-Entity

Psionic-Entity
  • Members
  • 195 messages

Didn't work, but I do think I've roughly sourced the error now.

 

For some reason, when compiling parametrized scripts the compiler outright stops recognizing vectors as a structure that exists once the amount of includes gets to a certain point. In one case I was able to make the difference between compiling/failing be the inclusion of a four-line include with a function that did nothing but multiply a couple floats (the error wasn't even detected here). For now I'm going to try a workaround but if anyone has an idea for a solution I'd love to hear it.



#6
kevL

kevL
  • Members
  • 4 070 messages

try the stand-alone compiler (?)

 

I think there's subtle differences to the plug-in. A long shot, but caps on includes *might* be one of them -- it's possible that one of its commandline switches would remove said cap ...



#7
Psionic-Entity

Psionic-Entity
  • Members
  • 195 messages

No luck with the standard compiler, that was the first thing I tried. I'm only seeing this "cap" behavior when I add in parameters, so maybe it uses a different setup for parametrized scripts?



#8
kevL

kevL
  • Members
  • 4 070 messages

... but did you try Advanced Script Compiler's stand-alone version? command-line app by Skywing, packaged with the standard compiler's replacement plug-in

 

or, alternately, try the stock compiler

 

Speaking of Sky .... methinks you'll need to contact him to resolve this, one way or the other


Modifié par kevL, 07 août 2014 - 02:26 .


#9
Psionic-Entity

Psionic-Entity
  • Members
  • 195 messages

I ended up resolving it. 90% of the problem scripts worked after I wrote a new vector-free database header. The others I sourced back and used local objects, which will do as a patchwork solution. Whether or not the standalone compiler works (I tried stock) is kind of irrelevant because I need these to function on a compile all.



#10
kevL

kevL
  • Members
  • 4 070 messages

ah, sounds cool.

 

btw, the stand-alone can work in batchmode if you persuade it ... nm



#11
Psionic-Entity

Psionic-Entity
  • Members
  • 195 messages

Thanks for the tip. I might give it a shot some time just to see, but for now making a batch compile all is a bit much.