Jump to content

Pass Variable to Function


Recommended Posts

Hi, sorry if I've missed some tutorial but I'm stuck doing the most basic thing.

 

Consider this:

ScriptName MenuModeNotifier

Short CurrentGameMode

Begin MenuMode
	Set CurrentGameMode to GetActiveMenuMode
	MessageBox CurrentGameMode
End

I've declared a variable `CurrentGameMode` which I want to assign the current MenuMode to, then print it to the screen.

 

But: Printing to the screen does not work. Instead of printing the variable, the MessageBox simply says "CurrentGameMode".

 

Apparently TESScript uses unquoted stings which is weird, but then how can I possibly pass a variable to a function?

 

_____

 

What am I trying to do?

 

Maybe this should be a seperate question but I'll ask anyway, I'm sure to you folks this is easy :tongue:. I'm playing on an ultrawide monitor but want to stream 1080p to my friends, and Oblivion menus are awkwardly placed all the way to the left. I want to create a mod that triggers a streamlabs transition everytime I change menus ingame, to only show what's relevant on stream. I thought this would be as good an excuse as any to look into modding.

 

For this, I need to communicate the MenuMode to the "outside world", where a nodejs script will pick it up. I've looked through the Function Reference and the only way to leave the godhead I have found is to set a setting in the Oblivion.ini file, using OBSE `con_SetINISetting` or Pluggy `IniWriteInt`. Is there another way (like, making a HTTP request from inside the quest script)?

Link to comment
Share on other sites

I've figured out how to successfully write the MenuMode to a ini file, using lots of copy paste:

Set IniFile To CreateString -1 "SlobsNotifier.ini"
Set Section To CreateString -1 "SLOBS"
Set SettingName To CreateString -1 "MenuMode"

Begin MenuMode 1001
	Set CurrentGameMode To 1001
	IniWriteInt IniFile Section SettingName CurrentGameMode
End

Begin MenuMode 1002
	Set CurrentGameMode To 1002
	IniWriteInt IniFile Section SettingName CurrentGameMode
End

Begin MenuMode 1003
	Set CurrentGameMode To 1003
	IniWriteInt IniFile Section SettingName CurrentGameMode
End

Begin MenuMode 1004
	Set CurrentGameMode To 1004
	IniWriteInt IniFile Section SettingName CurrentGameMode
End

Begin MenuMode 1005
	Set CurrentGameMode To 1005
	IniWriteInt IniFile Section SettingName CurrentGameMode
End

Begin MenuMode 1006
	Set CurrentGameMode To 1006
	IniWriteInt IniFile Section SettingName CurrentGameMode
End

Begin MenuMode 1007
	Set CurrentGameMode To 1007
	IniWriteInt IniFile Section SettingName CurrentGameMode
End

.......

All The way to 1051

I'm happy for suggestions on how to make this a bit leaner :P

Link to comment
Share on other sites

  • Recently Browsing   0 members

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