SkjoldBjorn Posted August 23, 2015 Author Share Posted August 23, 2015 Ah, i think i understand it. When it comes to parameters, does a list of function types and parameters exist that i can use and refer to? I have gone through the creation kit wiki, but i find it a little messy. Though i found this page : http://mod.gib.me/skyrim/functions.html which could work, but i think the wiki again is more informative. Thanks for the indepth explanation! Link to comment Share on other sites More sharing options...
scrivener07 Posted August 23, 2015 Share Posted August 23, 2015 There is the bottom of this wiki page but everything is spread around. You can also try this reference though a little dated with some minor errors such as ActiveMagicEffect. Its hyperlinked to the wiki so it really does have everything. Link to comment Share on other sites More sharing options...
SkjoldBjorn Posted August 25, 2015 Author Share Posted August 25, 2015 Thanks! Funny, I always thought functions was something that had to be named correctly to what it's function would be.The fact that you can call a function "whatever" and just call upon "whatever" to unleash it later was news to me...and an eye opener, made this make more sense. I should have started by reading a beginner to programing book or something. If i want to say..put a toggle box in MCM to disable the weather function I've added, that is something I'm not sure you can do?This is why i asked if it was best practice to have a quested script or the script lying on an Xmarker and if i should seperate the weather function of the script to another script and just link them. Also, I've been trying to see if Papyrus or SKSE has parameters to change Radius or strength on lights in Skyrim, but so far nothing have turned up, so am I right to assume this does not exist? Thanks again! :) Link to comment Share on other sites More sharing options...
scrivener07 Posted August 25, 2015 Share Posted August 25, 2015 Also, I've been trying to see if Papyrus or SKSE has parameters to change Radius or strength on lights in Skyrim, but so far nothing have turned up, so am I right to assume this does not exist?I dont think there are any functions for interacting with lights like that. You can work around it by setting up multiple light sources or varying intensity in the CK. Then use scripts to only enable a certain group at a time. I dont think you would be able to have an MCM slider and adjust the brightness freehand. I would save something like that for when you have a single group of lights working first. If i want to say..put a toggle box in MCM to disable the weather function I've added, that is something I'm not sure you can do?You can use a GlobalVariable to keep track of the toggle state from an MCM. Then have your XMarker script behave according to the stored GlobalVariable value. Like if MyGlobal == 1 then do weather stuff, else if MyGlobal == 0 then do non-weather stuff. This is why i asked if it was best practice to have a quested script or the script lying on an Xmarker and if i should seperate the weather function of the script to another script and just link them.Well its actually good programmer instinct to want to separate this functionality. I just wouldnt do that by creating a whole other script and having them talk to each other. This could be done very well through inheritance. You would still be using to separate source files but functionally they would behave as a single instance of one script. Inheritance is used to extend the functionality of existing scripts. Scriptname LightSwitchWeatherScript extends LightSwitchScript Event OnInit Parent.OnInit() ; you can call the parents version too if needed EndEvent Parent here is not a required thing to do with extending scripts, just wanted to point out that its a thing to watch out for. Inheritance works kinda like the rule of one with plugins/loadorder except that you can ask for which version you want to call. Thats what the 'Self' and "Parent" keywords are used for. Link to comment Share on other sites More sharing options...
KunoMochi Posted August 26, 2015 Share Posted August 26, 2015 Funny, I always thought functions was something that had to be named correctly to what it's function would be.The fact that you can call a function "whatever" and just call upon "whatever" to unleash it later was news to me...and an eye opener, made this make more sense. I should have started by reading a beginner to programing book or something.Although functions, like variables, can be named whatever you like, it is best programming practice and a good habit to get into by naming functions with leading caps for every word and with meaningful names (e.g., ActiveMagicEffects). Variables tend to have a lowercase first word while the rest of the words have leading caps (e.g., loopCount). It's a good way to differentiate between variables and functions while you work on them. :) Also, comment well on what each important step does and what each function does. This is usually an often disregarded practice that will most likely help you in the future whenever you need to go back to the script weeks, months, or even years later (it also helps other people understand your logic to debug and/or modify easier). Those are the things I was taught in class and read in programming books. Some may disagree but I personally think these practices has merit, especially when you are still learning the language. :) Link to comment Share on other sites More sharing options...
scrivener07 Posted August 26, 2015 Share Posted August 26, 2015 Speaking of convention I try to use the following..Events, Functions, and Properties I use PascalCaseVariables I use camelCaseParameters I use HungarianAutoReadOnly/Constants I use ALLCAPS I super hate underscores :laugh:I have mixed feelings about comments and documenting code. :ermm: Everyone has their own style in one way or another but its important to always be consistent. Link to comment Share on other sites More sharing options...
Mattiewagg Posted August 26, 2015 Share Posted August 26, 2015 Yeah, it's whatever you prefer. I like camelCase: camelCasepasswordnewIntrandomNumplayerREF But you can do as you like. Also, yeah. Underscores - I see no need. Just taking up space. Link to comment Share on other sites More sharing options...
SkjoldBjorn Posted October 6, 2015 Author Share Posted October 6, 2015 Hello People!I released the mod, credit to you is served. Would not be much of an MCM menu without the help.Here is the mod, if you want to check it out: http://www.nexusmods.com/skyrim/mods/68454/?Also I have a small question about weather scripting..tried adding something to my script, but it does not seem to fire, might be that I'm to tired to do this...just became a dad, so sleep ddeprived I am... Anyways, I thought I'd make a function, but since it's a simple command that should run in the OnInit with the rest i just did'nt see the need.And I have to admit that calling functions are a little foggy for me still, but I have come far in scripting since Post #1 here, or at least i feel more comfortable with it, all thanks to you people! Scriptname ImmersiveContentLightMasterParent extends ObjectReference {Controls a set of lights with a master enable parent marker with this script attached to turn on and off at the times of the day specified by the properties LightsOffTime and LightsOnTime} float Property LightsOffTime = 6.0 auto {The time at which lights should be turned off} float Property LightsOnTime = 20.0 auto {The time at which lights should be turned on} float Function GetCurrentHourOfDay() global {Returns the current time of day in hours since midnight} 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 Return Time EndFunction Function RegisterForSingleUpdateGameTimeAt(float GameTime) {Registers for a single UpdateGameTime event at the next occurrence of the specified GameTime (in hours since midnight)} float CurrentTime = GetCurrentHourOfDay() If (GameTime < CurrentTime) GameTime += 24 EndIf RegisterForSingleUpdateGameTime(GameTime - CurrentTime) EndFunction Event OnInit() If Weather.GetCurrentWeather().GetClassification() >= 2 debug.notification("Bad weather is happening") GoToState("LightsOn") ElseIf (GetCurrentHourOfDay() > LightsOffTime) GoToState("LightsOff") Else GoToState("LightsOn") EndIf EndEvent State LightsOff Event OnBeginState() Disable() RegisterForSingleUpdateGameTimeAt(LightsOnTime) EndEvent Event OnUpdateGameTime() GoToState("LightsOn") EndEvent EndState State LightsOn Event OnBeginState() Enable() RegisterForSingleUpdateGameTimeAt(LightsOffTime) EndEvent Event OnUpdateGameTime() GoToState("LightsOff") EndEvent EndState Thanks again. :) Link to comment Share on other sites More sharing options...
scrivener07 Posted October 7, 2015 Share Posted October 7, 2015 Yay, I love happy mod endings. Your OnInit() will only ever check the weather once the first time the game starts because thats the only time OnInit() fires. You need to check the weather on an interval using Register/OnUpdate() or try to find some kind of "weather has changed" event if there is one. Im a bit over tired too :P right now. Congrats on a fruitful script adventure. Link to comment Share on other sites More sharing options...
SkjoldBjorn Posted October 7, 2015 Author Share Posted October 7, 2015 Yeah i can use RegisterSingleUpdate with OnUpdate, though one wrong turn here and i risk wrecking peoples savegames. I can't se any other event i can use so i guess I'm stuck with OnUpdate here. Link to comment Share on other sites More sharing options...
Recommended Posts