Leaderboard


Popular Content

Showing content with the highest reputation on 06/02/2021 in Posts

  1. 1 point
    It is my intent to create a character that will replace Bastila after she is captured aboard the Leviathan. I had a line in the script to create "0, "p_sarna"" Thank you for your help in making this possible. Sarna has the template n_sarna, but her Template ResRef is tar02_sarna021. That was an error. I still do not understand why the .utc file will not save with the portrait "po_psarna".
  2. 1 point
    I wrote my first NWScript in order to test the findings from the previous post. The script: I specifically chose to add a single local variable and return a vector (struct of three floats) to prove the results. Let's break down the test subroutine: Part 1 is where the local variable I is declared and initialized. Part 2 is where the vector is returned. Part 3 is where things get interesting. Part 3 (Original) clears the local variable. Part 3 (New) clears the return values and local variables. Since Part 3 (Original) is not removed there is a jump over it in Part 3 (New). That jump is followed by the compiler quirk, the MOVSP that clears the last expression from the stack. That expression is the result of GetPositionFromLocation(), a vector. It's good to finally understand this weird JMP/MOVSP business, but this is awesome for two other reasons. The first is code analysis can be simplified to look for this JMP/MOVSP combination, it's no longer necessary to calculate stack changes for each op code in order to determine if a subroutine returns values. This eliminates the majority of bugs. It's also faster, but that's not as much of a concern. The second reason is it fundamentally changes the reverse compiler construction. I'll explain more in an upcoming post, but the tl;dr is it's now possible to find the beginning and end of statements! Notice a pattern? 🤔