Global functions?

Post » Fri Jan 30, 2015 8:17 am

Suppose we have this function:

 string Function GetGreeting()       string Greet = ""   float Time = Utility.GetCurrentGameTime()   Time -= Math.Floor(Time) ; Remove "previous in-game days passed" bit   Time *= 24 ; Convert from fraction of a day to number of hours   if Time < 13   Greet = "Morning"   elseif Time > 17   Greet = "Evening"       else   Greet = "Afternoon"   endif   Return Greet EndFunction 

In the light of what is discussed http://www.creationkit.com/Function_Reference#Method_One:_Setting_up_the_Target_Script_as_a_Filled_Property,

Is there any way to make the function Greeting "global" in the sense:

Is there any way to access this function via a papyrus script box?

Is there any way to access this function through a condition?

Is there any we can make it a "property" of an alias so that Bendu.GetGreeting is equivalent to "Good Morning" from Bendu in-game?

User avatar
Oscar Vazquez
 
Posts: 3418
Joined: Sun Sep 30, 2007 12:08 pm

Post » Thu Jan 29, 2015 8:49 pm

1. Global as in accessible from any script, yes. Using the method that was described in your own link.

2. Yes, again. Same method.

3. http://www.creationkit.com/GetVMQuestVariable and http://www.creationkit.com/GetVMScriptVariable are the functions you're looking for. But you would need to make your script conditional - and also make the Greet string a conditional property instead of just a variable.

4. Not sure what you mean. But it should be possible to condition Bendu's greetings to play depending on either the GetVM functions above -or simpler: Just use the http://www.creationkit.com/GetCurrentTime condition.

User avatar
Betsy Humpledink
 
Posts: 3443
Joined: Wed Jun 28, 2006 11:56 am

Post » Fri Jan 30, 2015 7:47 am

Thanks Wormple,

2: Suppose our script is "timescript" added in the scripts tab, and we have at the beginning of a scene with this tif created:

SF_GSQ01BenduGilfreSceneBefo_01003DFD

SF_GSQ01BenduGilfreSceneBefo_01003DFD property timescript auto

Adding properties in the script box doesn't work, and declaring a property in the tif as timescript fails

B:\Steam\steamapps\common\skyrim\Data\Scripts\Source\SF_GSQ01BenduGilfreSceneBefo_01003DFD.psc(16,24): cannot name a variable or property the same as a known type or script
Missing something here?
User avatar
Elle H
 
Posts: 3407
Joined: Sun Aug 06, 2006 3:15 am


Return to V - Skyrim