Jump to content

How does this code work?


gooser

Recommended Posts

Posted

I was just looking over Jaxonz latest "Diagnostics" mod and I ran across these lines in the MCM script:

bool bValidateSKSE = true
state optValidateSKSE
	event OnSelectST()
		bValidateSKSE = !bValidateSKSE
		SetToggleOptionValueST(bValidateSKSE)
		((Self as Quest) as JaxonzDiagnosticsQuest).bValidateSKSE = bValidateSKSE
	endEvent

	event OnHighlightST()
		 SetInfoText("When selected, Jaxonz Diagnostics will test for valid SKSE installation on each game load and display a warning if there is a problem.")
	endEvent
endState

This is an MCM State inside the script JaxonzDiagnosticsMCM (Scriptname JaxonzDiagnosticsMCM extends ski_configbase if you are wondering) script.

 

JaxonzDiagnosticQuest is a separate script (derives from Quest).

 

I have no idea how 

 

 

((Self as Quest) as JaxonzDiagnosticsQuest).bValidateSKSE = bValidateSKSE

 

works. Cast Self to Quest, then to a different script type and then access a property on that script. 

 

Is there some arcane rule about how the "as" operator works between object (script) types?

 

Thanks

Posted

UIExtensions dev did the same trick. It-Just-Works

It seems that the one quest have few scripts attached thus the cast returns another script instance

 

Btw

function blabla()
  t = 0
  int t = 1
endfunction
Posted

 

UIExtensions dev did the same trick. It-Just-Works

It seems that the one quest have few scripts attached thus the cast returns another script instance

 

Btw

function blabla()
  t = 0
  int t = 1
endfunction

 

Papyrus is about as a fucking crazy as Javascript.

Posted

 

 

UIExtensions dev did the same trick. It-Just-Works

It seems that the one quest have few scripts attached thus the cast returns another script instance

 

Btw

function blabla()
  t = 0
  int t = 1
endfunction

 

Papyrus is about as a fucking crazy as Javascript.

 

 

I heard of Javascript issues, but I wish it would Javascript instead

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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