Jump to content

I need Scripting help (beginner)


Recommended Posts

My Knowledge (you can skip)
I have very beginner knowledge when it comes to anything scripting, I know how to compile scripts and have only made a few activator and key press scripts anyway that's my knowledge lol


Why? (you can skip)
What im trying to learn really is trying to change the default values for some of my most used mods that don't update so this way I don't have to refill the values every time i start a new game.

 

Question

I want to edit the default values for a mod called Better Vampires, I read that you didn't even need to edit the scripts and you could go into the global variables in the .esp and just edit it there, however when i do that it doesn't apply the changes when load it in game? Anyway idea why that would be?

image.png.0dc8065cc80aa0381b58bfb6cfc53ea4.png

does setsliderdialogdefaultvalue mean like the on start value when you load the menu?

 

Edited by tamai
fixed
Link to comment
8 minutes ago, tamai said:

global variables in the .esp and just edit it there, however when i do that it doesn't apply the changes when load it in game? Anyway idea why that would be?

 

Because they are already set.  You can use the console to do it though.

Link to comment
1 hour ago, Seijin8 said:

 

Because they are already set.  You can use the console to do it though.

 

the whole point is not to use the mcm menu I want to set the default values to my preference upon starting a new game

Link to comment
2 hours ago, tamai said:

I read that you didn't even need to edit the scripts and you could go into the global variables in the .esp and just edit it there, however when i do that it doesn't apply the changes when load it in game? Anyway idea why that would be?

 

I answered the question you asked.

 

2 hours ago, tamai said:

does setsliderdialogdefaultvalue mean like the on start value when you load the menu?

 

If the value you select falls within the min/max set elsewhere in that script, then yes.  Otherwise it gets ignored.

Link to comment
1 hour ago, Seijin8 said:

 

I answered the question you asked.

 

 

If the value you select falls within the min/max set elsewhere in that script, then yes.  Otherwise it gets ignored.

 

 

I answered the question you asked.

 

am i not allowed to ask anyomre questions?

 

you may of answered it but you're being vague the whole point of me explaining "my knowledge" was to let anyone know that I dont have the knowledge to understand without a good explanation; which yours was not very helpful (sorry)

Because they are already set.  You can use the console to do it though.

What console? How do i unset them? What does that even mean?

 

If the value you select falls within the min/max set elsewhere in that script, then yes.  Otherwise it gets ignored.

 

So you're saying that i have to change the global and also any references in the script as well?

 

Edited by tamai
Link to comment

The Value of a Variable is baked into the savegame when that variable is first loaded and after that can only be changed directly through script, not through re-declaration of the default value

 

To change a value in an existing game, you change the value through the MCM. Thats what the thing is there for

 

If you want the default value of the option to change when starting a new game, you go into the .psc of that Script and usually at the very top there should be a (long) list with Variables typed like this: [int/float/bool/string] Property [weird name] = [value] Auto (+ Hidden) (+ Conditional)

Whatever stands in [value] will be the Options default value when the Menu is first initialized, thats the Value you want to change to whatever you want the default value to be. If there is no "= [Value]" the Value will be [0 / 0.0 / false / ""] respectively, make sure that the initial Value isnt set in some OnConfigInit Event though

If the author uses Global Variabales (why ever anyone would build their entire Menu with GlobalVar Objects), you need to check at which GlobalVariable the Property points at and change the Value of that Global

 

The Option you want to edit in your startpost has nothing to do with the default Option of that Value, ideally you want to match it with the default value of your script as its the vaue the menu displays (after the first time you edit that value, this default value will become the value represented by that option)

Edited by Scrab
Link to comment
17 minutes ago, Scrab said:

The Value of a Variable is baked into the savegame when that variable is first loaded and after that can only be changed directly through script, not through re-declaration of the default value

 

To change a value in an existing game, you change the value through the MCM. Thats what the thing is there for

 

If you want the default value of the option to change when starting a new game, you go into the .psc of that Script and usually at the very top there should be a (long) list with Variables typed like this: [int/float/bool/string] Property [weird name] = [value] Auto (+ Hidden) (+ Conditional)

Whatever stands in [value] will be the Options default value when the Menu is first initialized, thats the Value you want to change to whatever you want the default value to be. If there is no "= [Value]" the Value will be [0 / 0.0 / false / ""] respectively, make sure that the initial Value isnt set in some OnConfigInit Event though

If the author uses Global Variabales (why ever anyone would build their entire Menu with GlobalVar Objects), you need to check at which GlobalVariable the Property points at and change the Value of that Global

 

The Option you want to edit in your startpost has nothing to do with the default Option of that Value, ideally you want to match it with the default value of your script as its the vaue the menu displays (after the first time you edit that value, this default value will become the value represented by that option)

 

Yes I am only doing this on a newly saved games so that wont be an issue for me

 

thanks im going to try to read this over and over until i understand it :D ill just keep poking around and see if I get all this right thanks!!~

One thing though, if i change the script value then does that also mean i have to change the global?

Link to comment
10 minutes ago, tamai said:

One thing though, if i change the script value then does that also mean i have to change the global?

I dont understand what global you mean

 

If the MCM Structure is as I described it with [type] Property [name]  = [value] Auto (...)

Then this Property IS the "global"

 

A GlobalVariable is another thing, an Object in the .esp that stores a Number and in  the MCM script would be referenced with GlobalVariable Property [Name] Auto

and if that is the case, then youd have to change the GlobalVariabel object in the esp. To figrue out which you need to first find out which GLobalVariable this Name is pointing to though, which you do by looking for the MCM Script and checking the Properties

 

Link to comment
On 8/8/2021 at 8:53 AM, tamai said:

I answered the question you asked.

am i not allowed to ask anyomre questions?

 

you may of answered it but you're being vague the whole point of me explaining "my knowledge" was to let anyone know that I dont have the knowledge to understand without a good explanation; which yours was not very helpful (sorry)

Because they are already set.  You can use the console to do it though.
What console? How do i unset them? What does that even mean?

 

If the value you select falls within the min/max set elsewhere in that script, then yes.  Otherwise it gets ignored.

So you're saying that i have to change the global and also any references in the script as well?

 

 

1) Just ignore them... they are just sad idiots and they always answer in stupid way so u dont understand :)

 Thats like half of LL... 

 

2) 

 If You want to change Global Variable in Skyrim You need to open Console, You do it by pressing "~" on Your Keyboard

 then in Console You can type commands You want Game to execute, to change Global Variable You type:

 

Set <GlobalName> to <New Value>

 

In place of <GlobalName> You need to type Name of Variable You want to change

in Place of <New Value> You need to type new value... as name says :)... 

 

so for example:

 

Set Cookies to 5

 

im 99% sure there is no Global Called "Cookies" in Skyrim... but u can try ^_^ anywaa...

 This Command will try to set Cookies Value to 5 ( but will fail because there is no Global with that name )

 

 

 

About Your question...

 I was never using Better Vamipres but if You want to edit some values

 

 

When You change values in Creation Kit they may get overwrited by Scripts when game Loads... Thats why its pointless to change them in CK

 for example when i make my mods i always have Starting value for all Globals = 0 

 

and then in Scripts OnInit i change their values... so editing my Globals in CK will not change a thing...

I'm gonna ask You question... Do You know names of Global Variables You want to change?...

 

 

If You do have names of Globals You want to change, use my "mini tutorial" how to edit Global Variables in game

If You DONT have names of Global You want to change...

 

Quote my msg ( because u can't ping me xD - its rly difficult to ping me here ) and ill give u little longer way

but we will search for Globals with other program and then You will edit them in game

 

 

//Edit:

Its best if You join here: -> discord.gg/CDkcv22

 

Just type to any Cardinals or to me and ill try to help u ^_^...

atm. i don't have Skyrim installed... but we will try on ur Skyrim ( with ScreenShare if possible :) )

 

Edited by -̒̈́̕?̖̪̼?̒̈́̕??̒̈́̕?-
Link to comment
8 hours ago, -̒̈́̕?̖̪̼?̒̈́̕??̒̈́̕?- said:

 

1) Just ignore them... they are just sad idiots and they always answer in stupid way so u dont understand :)

 Thats like half of LL... 

 

2) 

 If You want to change Global Variable in Skyrim You need to open Console, You do it by pressing "~" on Your Keyboard

 then in Console You can type commands You want Game to execute, to change Global Variable You type:

 

Set <GlobalName> to <New Value>

 

In place of <GlobalName> You need to type Name of Variable You want to change

in Place of <New Value> You need to type new value... as name says :)... 

 

so for example:

 

Set Cookies to 5

 

im 99% sure there is no Global Called "Cookies" in Skyrim... but u can try ^_^ anywaa...

 This Command will try to set Cookies Value to 5 ( but will fail because there is no Global with that name )

 

 

 

About Your question...

 I was never using Better Vamipres but if You want to edit some values

 

 

When You change values in Creation Kit they may get overwrited by Scripts when game Loads... Thats why its pointless to change them in CK

 for example when i make my mods i always have Starting value for all Globals = 0 

 

and then in Scripts OnInit i change their values... so editing my Globals in CK will not change a thing...

I'm gonna ask You question... Do You know names of Global Variables You want to change?...

 

 

If You do have names of Globals You want to change, use my "mini tutorial" how to edit Global Variables in game

If You DONT have names of Global You want to change...

 

Quote my msg ( because u can't ping me xD - its rly difficult to ping me here ) and ill give u little longer way

but we will search for Globals with other program and then You will edit them in game

 

 

//Edit:

Its best if You join here: -> discord.gg/CDkcv22

 

Just type to any Cardinals or to me and ill try to help u ^_^...

atm. i don't have Skyrim installed... but we will try on ur Skyrim ( with ScreenShare if possible :) )

 

 

Yea he wasnt very helpful, after i said that he basically called me an idiot and saying there was no helping me at all.. so I had to get a mod to remove what he said since it was really just insulting since as i said im a beginner i need to learn somehow its not stupid to want to learn and try to figure things out.

wow thanks for all the help and I seee, so definitely changing it at script level is the way to go then but I am kind of stuck when it comes to better vampires i may have to speak with the author since his script isnt compiling for me x_x so even if i figured it out i cant really do anything about it but its okay there are other mods i want to change.

But if this is something you know maybe you can help me I have the source files for skyui5.1sdk, bettervampires and skse.... but im still gettting this compiling error any idea what this might be?
image.png.0af7e6859126280adca76632c339f9cf.png

 

and yes i know the names which are
image.png.de69b7d93547b562485c885440d0937a.png

 

Basically everytime i create a new game i have to set up the MCM settings and move the widget bloodmeter to the perfect spot eachtime so i am basically so tired of doing it since i forget the values that make it jsut right x_x

 

also thanks again for the help!

 


 

Edited by tamai
Link to comment
22 hours ago, tamai said:

 

and yes i know the names which are
image.png.de69b7d93547b562485c885440d0937a.png

 

Basically everytime i create a new game i have to set up the MCM settings and move the widget bloodmeter to the perfect spot eachtime so i am basically so tired of doing it since i forget the values that make it jsut right x_x

 

also thanks again for the help!

 


 

 

Have You tried: ( in Console - in game )

Set BetterVampiresBloodMeterX to <newValue>
Set BetterVampiresBloodMeterY to <newValue>

 

In place of new Value You need to type value You want to have...

 

However You also talking about Widgets... You mean like UI Elements on Your Screen?

are those two values X and Y for UI Widget on Screen?

 

If You change Global Variables in Console thats not gonna change anything in game unless You call Widget to update...

 

So i have question... do You have access to BetterVampires Source Files?...

 If You don't have it You will have to decompile them ( in order to recompile them )

 

You can decompile PEX to PSC with -> https://www.nexusmods.com/skyrim/mods/35307/

 

1) decompile PSC files

2) open BetterVampires Widget Script ( that will be the one that extends SKI_WidgetBase )

3) Search for Function that change X/Y position for Widget 

 IF You dont have function for that in Widget Mod You can create one... it will look like this:

s1.png.92aaa5a4d3398c30278e715ecefb774c.png

Open spoiler to copy / paste Code !...

 

4) create new Scritp ( you can attach it to Quest or ObjectReference or anything You want )

5) create Reference to Widget Script inside Your script

6) call ChangeXY from Your Script

 

It will look like this:

( You dont need to create X and Y Variables, they comes from Ski_WidgetBase Script !... )

s1.png.fc402aa36d64f6736837f30e4f76e80f.png

 

Code You can find in Spoiler !...

 Click to make it Bigger !...

 

//Edit:

 LoversLab is broken...

Why i can't change Picture Size?

 

@Ashal @CPU

 

That was removed or LL have Lags?...

 I'm unable to click Picture to change its size...

Spoiler
; Thats what You need to find in BetterVampires Widget ;
; Or create if there is no Function like this ;

Function ChangeXY( int newX, int newY )
	X = newX
	Y = newY
	Paren.OnWidgetReset()
EndFunction

; ============================================= ;
; Thats Your own Script ;

SKI_WidgetBase Property BetterVampires_Widget Auto

Event OnInit()
	BetterVampires_Widget.ChangeXY( 500 , 500 )
	; this line will change widget position to 500 px for X and Y
EndEvent

; remember to re-compile and overwrite better vampires PEX !...

 

 

Can You describe more detailed what You trying to do with Better Vampires?...

 

 

Because first you were talking about Global Varaibles and now You talking about Widgets...

 so plz describe what u trying to do as detailed as u can ^_^

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use