Jump to content

God dammit Bethesda, or: why the Lakeview Manor weapon rack can't be fixed


Sclerocephalus

Recommended Posts

The compiler does little or no error checking. We learned that with value(less) returns in value returning functions. My guess is this is a relatively smart guy, who had heard of recursive descent compilers, but never formally took a class.

 

Errr... actually, the valueless "return" works in the same way as you probably know it from other programming languages. I recently needed to have a look at this myself because I was somewhat confused about the use of it in some scripts from recent mods. I also remember that I had read a comment on the CK Wiki stating that "return" without a return value passes only due to a bug in the papyrus compiler (and saying between the lines that this actually won't work). Though, this comment doesn't exist anymore. Instead, it does now read as follows (implying that it does work anyway):

 

http://www.creationkit.com/Return_%28Papyrus%29#Return_Statement

Link to comment
Share on other sites

Unless I'm missing something it's saying an empty return in a function that, for example, should return bool will instead return None. Which would be bad, yes?

Link to comment
Share on other sites

Unless I'm missing something it's saying an empty return in a function that, for example, should return bool will instead return None. Which would be bad, yes?

 

"If a function with a return type exits without a return statement, then None will be returned"

 

The case of a function with a return type exiting with an empty return is not covered by the comment, but I remember vaguely that this resulted in a compiler error.

Link to comment
Share on other sites

The case of a function with a return type exiting with an empty return is not covered by the comment, but I remember vaguely that this resulted in a compiler error.

You can of course test this yourself, but no -- there is no compiler error. I submitted a whole raft of these hand checked for bool, and they've been fixed. That immediately fixed a bunch of oddball bugs!

 

Someday, I'll look for missing int returns....

Link to comment
Share on other sites

  • 2 weeks later...
[08/17/2013 - 01:48:42AM] Error: Unable to call RegisterForSingleUpdate - no native object bound to the script object, or object is of incorrect type
stack:
    [None]._StarMain.RegisterForSingleUpdate() - "<native>" Line ?
    [None]._StarMain.OnUpdate() - "_StarMain.psc" Line ?

I triple dog dare someone to come up with an explanation for that. Hana just got it in a log tonight.

Link to comment
Share on other sites

Where is "_StarMain.psc" from ?

 

I can't find any vanilla script that starts with an underscore.

Link to comment
Share on other sites

Turned out to be from a mod - Shooting Stars. So just another infamous [None] error.

Link to comment
Share on other sites

EDIT: My mistake, I was reading it the wrong way. But a good example of correct usage of single update preventing an infinite loop during an error!

Link to comment
Share on other sites

Heh, well I'd hope by now that most folks understand that using the single update registrations is the only sane choice.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...