Jump to content

Looking for a function that can return HUD settings


trashgarbage666

Recommended Posts

I'd like to make the pipboy light match the color of the player's HUD. I found a spell in the GECK called PipBoyLight. It uses a magic effect called PipLight, which seems to be the thing responsible for emitting PipboyLight640. Since magic effects can have conditions, you could theoretically have a quest script determine the player's current HUD color settings, set a variable, and then have the PipBoyLight spell check the variable to determine which light to emit.

 

My problem is that I don't know of any "get menu setting" type variables. They may not even exist. I'm using JIP LN NVSE, if that helps!

 

Thanks for reading!

Link to comment
Share on other sites

I think either GetStringSetting or GetStringIniSetting will have the pipboy light color setting in there somewhere. If you wanna instead read the contents of the HUD, you can use GetUIString, but that won't give you the color of the HUD.
Edit: Ok the INI has the UI and pipboy colors there, so you're gonna use the GetStringIniSetting function.

Fallout_default.ini

iSystemColorPipboyRed=26
iSystemColorPipboyGreen=255
iSystemColorPipboyBlue=128


iSystemColorHUDAltRed=255
iSystemColorHUDAltGreen=67
iSystemColorHUDAltBlue=42


iSystemColorHUDMainRed=26
iSystemColorHUDMainGreen=255
iSystemColorHUDMainBlue=128
Edited by WarMachineDD7
Link to comment
Share on other sites

Thank you for the response! Although, I have to admit, I'm a little lost here because the GetStringIniSetting example code looks nothing like the code I'm used to dealing with.

 

The iSystemColor settings appear to be RGB values, so they're probably not what I'm looking for. I scrolled down a little further and found uPipboyColor and uHUDColor. The good news is that they change whenever I alter my pipboy / HUD color!

 

Amber
uPipboyColor=4290134783

Blue
uPipboyColor=785383423

Green
uPipboyColor=452952319

White
uPipboyColor=3321888767

 

(Specifically, I'm looking at FalloutPrefs.Ini because I'm pretty sure Fallout_default.ini is only used to restore the default settings when you select "Restore Defaults" on the main menu.)

 

The bad news is that whenever I bind them to a variable, it only returns a value of 1. But again, this is likely because I'm a dumb baby when it comes to string variables. Maybe someone can tell me what I'm doing wrong?

String_Var nPipboyColor;
Let nPipboyColor := GetStringIniSetting "Interface:uPipboyColor"

;Amber
If (nPipboyColor == 4290134783);
	PrintToConsole "Amber";

;Blue
ElseIf (nPipboyColor == 785383423);
	PrintToConsole "Blue";

;Green
ElseIf (nPipboyColor == 452952319);
	PrintToConsole "Green";

;White
ElseIf (nPipboyColor == 3321888767);
	PrintToConsole "White";

Else;
	PrintToConsole "Didn't Work...";
	PrintToConsole "Value: %g" nPipboyColor;

EndIf;

I'm not sure if it matters, but I'm currently running this in a GameMode block, and plan to move it to an appropriate MenuMode block whenever I get it running.

Link to comment
Share on other sites

The second line seems correct to me, I don't know why it won't store anything other than a 1, but your if-statements are definitively wrong, you should be using eval and then compare against a string, not a number. Like this:

string_var my_string

let my_string := "76"

if eval my_string == "76"
    ;this should return true
endif
Link to comment
Share on other sites

So! I made the corrections to my if-statements, and wrote this test script to toggle between setting nMyString to "Interface:uPipboyColor" and "76". Depending on which one I have commented out, different things happen.

String_Var nMyString;
;Let nMyString := GetStringIniSetting "Interface:uPipboyColor"
Let nMyString := "76"

If Eval nMyString == "4290134783"
	PrintToConsole "Amber";

ElseIf Eval nMyString == "785383423"
	PrintToConsole "Blue";

ElseIf Eval nMyString == "452952319"
	PrintToConsole "Green";

ElseIf Eval nMyString == "3321888767"
	PrintToConsole "White";

ElseIf Eval nMyString == "76"
	PrintToConsole "76";
	PrintToConsole "Value: %g" nMyString;

Else;
	PrintToConsole "Didn't Work...";
	PrintToConsole "Value: %g" nMyString;

EndIf;

Setting nMyString to "Interface:uPipboyColor" shows this

"Didn't Work..."

"Value: 2"

 

But setting nMyString to "76" shows this

"76"

"Value: 2"

 

So the script is fine with me setting numbers manually, but doesn't play well with uPipboyColor, or %g. So out of curiosity, I opened up Fallout_default.Ini, and sure enough, uPipboyColor isn't there. It's only in FalloutPrefs.Ini. I assumed GetStringIniSetting is pulling from the .ini that doesn't have uPipboyColor, which is what's causing my problem. So I tried setting nMyString to something that actually is in the default.ini, and %g still returns a value of 2.

 

The GECK wiki says "%g - This usually works just like "%.0f", displaying 0 decimal places. When the number is 1000000 or larger, though, the game diplays it in scientific notation (1E+006)". The values I'm trying to get it to spit out are 9 digits long, and instead of scientific notation, it's just giving me ...2.

 

I'm stumped, and I've been at this all day. String variables suck.

Edited by punchbattle
Link to comment
Share on other sites

PrintToConsole is an old function from FOSE, so maybe it doesn't play well with string_vars since they came much later on NVSE, try using the ToString function ($) there:

PrintToConsole "Value: %g" $nMyString ;I just added the '$' sign.

That might fix the problem of the print out being "2".

 

As for the 2nd line, I don't know what it could be other than it's not finding the setting you're asking for, but let me know if you get anything different on the print to console with the change I just mentioned.

 

Also, you might wanna give the string_var tutorial a read:

 

https://geckwiki.com/index.php?title=Tutorial:_String_Variables

Link to comment
Share on other sites

  • Recently Browsing   0 members

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