Jump to content

CK script compiler error


Recommended Posts

Recently, I've been getting this kind of error message when trying to compile a script:

"Attempting to add temporary variable named ::templeScript_var to free list multiple times"

 

I have never previously had this compile error occur.

The error message references the line with the If statement:

GnW_TempleOperationsScript property templeScript auto

Event OnDeath(Actor akKiller)
    Actor player = Game.GetPlayer()
    Faction f = templeScript.TempleFaction
    If (akKiller == player && player.IsInFaction(f)) 
        templeScript.ExpelFromTemple()
    EndIf
EndEvent

And here is the GnW_TempleOperationsScript script:

Scriptname GnW_TempleOperationsScript extends Quest  Conditional

Faction property TempleFaction auto conditional 

Basically, if I try to reference the script variable "templeScript" twice in the same function, the compiler throws an error. (I cast TempleFaction to a local variable, because that was previously the way to get around this error, but no dice this time)

This same error has also been appearing for me in relation to variable arrays on scripts, where unless I cast the variable into a temp local variable at the spot I want to use it, I can't compile the script.

 

 

I am using the latest version of SSE CK fixes, and I also have SKSE64 installed.

 

Has anyone run into this before? Google has no results for this error.

Edited by steelfeathers
Link to comment
Share on other sites

I never had this issue but I also don't use the SSE CK fixes. I also compile all my scripts where possible with Sublime Text rather than in the Creation Kit.

 

If you can recreate the issue with two simple scripts (so you don't have to post large amounts of code), I could try compiling and see what results I end up with.

 

If nothing else you can use SKSE's mod event features instead of calling the function directly. Basically, convert the function into a mod event. The script triggering it would send the event while the one with the code to run would register for the event and then run it when the event gets sent.

For mod events with custom parameters: https://www.creationkit.com/index.php?title=ModEvent_Script

For mod events with generic parameters: https://www.creationkit.com/index.php?title=SendModEvent

For both types: https://www.creationkit.com/index.php?title=RegisterForModEvent_-_Form

Link to comment
Share on other sites

I never had this issue but I also don't use the SSE CK fixes. I also compile all my scripts where possible with Sublime Text rather than in the Creation Kit.

 

If you can recreate the issue with two simple scripts (so you don't have to post large amounts of code), I could try compiling and see what results I end up with.

 

The two examples I posted are complete (the first is just missing the header). The first script is just attached to a referenceAlias on a quest; the second is attached to the quest itself.

It would be so great if you could try compiling these to see what happens. It would be really good to know if this occurs for other people, or if it's a problem with my setup.

Link to comment
Share on other sites

If those are complete, you are missing the ExpelFromTemple function on the script referenced by the variable TempleScript. If that is not where the function is stored, then you need to adjust your code accordingly.

Whoops, my bad. Just put an empty ExpelFromTemple() function in then.

 

(It's present in the original code, but no errors are thrown from the script it lives on...also, I'm at my work computer right now, so I can't post the real full scripts)

Edited by steelfeathers
Link to comment
Share on other sites

I got the same results. Interesting. Guess I never referenced other script variables and functions like that. I know I have referenced multiple other script variables within a single function but I guess I haven't mixed function calls and variables like this before. Anyway, came up with a workaround solution that you might want to consider.

Quest script

 

 

Scriptname GnW_TempleOperationsScript extends Quest Conditional

Faction property TempleFaction auto Conditional

Function ExpelFromTemple()
  Debug.Trace("Kick this guy out!")
EndFunction 

 

 

 

ReferenceAlias script

 

 

ScriptName GnW_SomeAliasScript Extends ReferenceAlias

GnW_TempleOperationsScript property templeScript auto

Event OnDeath(Actor akKiller)
  Faction myF = templeScript.TempleFaction
  If (akKiller == Game.GetPlayer())
    CheckExpulsion(akKiller,myF)    
  EndIf
EndEvent

Function CheckExpulsion(Actor Dude, Faction myFaction)
  If Dude.IsInFaction(myFaction)
    TempleScript.ExpelFromTemple()
  EndIf
EndFunction 

 

 

Link to comment
Share on other sites

 

If those are complete, you are missing the ExpelFromTemple function on the script referenced by the variable TempleScript. If that is not where the function is stored, then you need to adjust your code accordingly.

Whoops, my bad. Just put an empty ExpelFromTemple() function in then.

 

(It's present in the original code, but no errors are thrown from the script it lives on...also, I'm at my work computer right now, so I can't post the real full scripts)

 

Thank you! It helps tremendously to know that I didn't screw up my libraries or compiler code somewhere, and also that SSE fixes isn't the culprit.

And also thanks for the workaround. :)

Link to comment
Share on other sites

steelfeathers wrote: "Attempting to add temporary variable named ::templeScript_var to free list multiple times",

this error message references the line with the If statement.

If (akKiller == player && player.IsInFaction(f))

maybe this could work

If (akKiller == player) && player.IsInFaction(f)

Here is a small adjusted version of IsharaMeradins scripts. I think it would be a good idea to put all functions inside the quest script, like this:

GnW_TempleOperationsScript

 

Scriptname GnW_TempleOperationsScript extends Quest Conditional
; https://forums.nexusmods.com/index.php?/topic/9582163-ck-script-compiler-error/

  Faction PROPERTY TempleFaction auto Conditional        ; faction new created by mod, 
; Keep in mind: "conditional" is only useful by using this property for conditions within CreationKit


; -- FUNCTIONs -- 2

;--------------------------------------
FUNCTION CheckExpulsion(Actor akKiller)  ; called from referenceAlias scripts
;--------------------------------------
    IF akKiller.IsInFaction(TempleFaction)
        ExpelFromTemple()
    ENDIF
ENDFUNCTION


;-------------------------
FUNCTION ExpelFromTemple()
;-------------------------
    Debug.Trace("Kick this guy out!")
ENDFUNCTION

 


GnW_SomeAliasScript

 

Scriptname GnW_SomeAliasScript extends ReferenceAlias
; https://forums.nexusmods.com/index.php?/topic/9582163-ck-script-compiler-error/

  GnW_TempleOperationsScript PROPERTY ps auto    ; ps = pointer to script, here "GnW_TempleOperationsScript.psc"


; -- EVENTs --

EVENT OnInit()
    Debug.Trace(" OnInit() - has been called for " +self)
ENDEVENT


EVENT OnDeath(Actor akKiller)
IF (akKiller == Game.GetPlayer())
    ps.CheckExpulsion(akKiller)
ENDIF
ENDEVENT

 

 

Edited by ReDragon2013
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...