Fallout 3
0 of 0

File information

Last updated

Original upload

Created by

DaveLessnau

Uploaded by

DaveLessnau

Virus scan

Safe to use

About this mod

A mod that illustrates a scripting method to display a warning if FOSE is not found (or a message telling the player what version of FOSE they have if it is found).

Permissions and credits
Changelogs
Name: DALCO FOSE Check
Version: 1.2
Date: 19 December 2013
Category: Modder's Resource
Requirements: Fallout 3
Author: DaveLessnau
Location: http://www.nexusmods.com/fallout3/mods/19970/?

Description
===========
- A mod that illustrates a scripting method to display a warning if FOSE is not found (or a message telling the player what version of FOSE they have if it is found).
- The point of the mod isn't the message (though that can be useful for players to figure out why a mod that needs FOSE isn't working correctly). The point is to show a scripting method that will actually display a message if FOSE isn't found.
- I wrote this because the checks I had added (IF GetFOSEVersion, THEN [do stuff], ELSE [tell the player]) to my scripts in other mods weren't working: even though messages were supposed to pop-up when FOSE was missing, they weren't. I needed to find out why. This mod was the result. Since, I'd done the work, I figured other modders might be able to use the method to make sure their own checks in their own scripts worked. Or, if they wanted, they could just recommend this mod to their players to help troubleshoot problems.

Location
========
This mod takes effect immediately after activating it.

Details
=======
About 5 seconds after starting a game, a message will pop up in the upper left corner of the screen telling the player the full FOSE version they have. For most people that should be v1.2 b2 (the latest version). After a few seconds, the message will fade away and won't re-appear until a game has been exited and is reloaded. If FOSE is not running, a message will pop up telling the player that and offering advice.

Install
=======
Either manually download the mod or tell Nexus Mod Manager to download it. If you manually download it and want to manually install it, just unzip it and put the "DALCO FOSE Check.esp" file in your game's DATA folder. If you want NMM to install it, go to NMM's Mod tab and select the top, Add Mod from File icon, and point it to where you downloaded the mod's .7z file. If you had NMM download the mod, it should shortly show up under NMM's Mod tab. In either NMM case, click the 2nd NMM icon to Activate the mod. Then, go back to the Plugins tab and make sure the .esp file is checked. It can go anywhere in your load order without fear of conflict.

Uninstall
=========
To uninstall using NMM, go to it's Mod tab, highlight the mod, and select the 2nd icon to Deactivate it. You can delete it if you want.

To uninstall manually, just delete it from your games DATA folder.

Upgrade
=======
1. Uninstall the old mod.
2. Install the new mod.
3. Start Fallout 3 and play.

Incompatibility
===============
None.

Known Issues or Bugs
====================
None.

History
=======
- 1.2, 19 December 2013: luthienanarion informed me that my method would only display the message once. Once the game had been saved, any future loads would not display any message. This would be bad if the player had run the mod with FOSE loaded, saved, exited, unloaded FOSE, and restored from that save. He suggested a different method that uses only the main, driving quest, a result script in a quest stage for that quest, and a global constant variable (a global variable that's marked Constant and returns to it's default value the next time the game is loaded). I revised the mod as he suggested.
- 1.1, 17 December 2013: Thanks to pkleiss, the mod now displays the message when FOSE is not present. It does this by isolating the code that uses the FOSE function GetFOSEVersion in its own Quest Script so that when it fails because FOSE isn't present, the still functioning rest of the mod can display the message. I've also replaced the message box that displayed when FOSE was present to a short message at the upper left corner of the screen that shows the full FOSE version.
- 1.0, 16 December 2013: Initial public release.

Programming Notes
=================
- I'm going to be especially verbose here since this might be the only way for others to get this functionality into their own mods. The mod consists of one Quest (DALCOFCCheckQuest and DALCOFOSECheckIsolatedQuest) that run at the start of the game, two Messages to display (DALCOFOSECheckPresent and DALCOFOSECheckAbsent), and two Quest Scripts (DALCOFOSECheckScript and DALCOFOSECheckCheckScript) attached to the Quests. These are as follows:

-- DALCOFCGameRestartedGlobal: Under Gameplay | Globals, I set up a new global variable of type Short, with a default value of 0, and checked the Constant box. No matter how the variable is changed during a game session, when the game next restarts, the variable will be reset to it's default value.

-- DALCOFCFosePresentMessage: A standard Message that appears at the top left corner of the screen if FOSE is found. It accepts three parameters (the FOSE version, revision, and beta number) and looks like this:

"FOSE v%.0f.%.0f b%.0f found (latest is v1.2 b2)"

-- DALCOFCFoseAbsentMessage: A standard Message box that appears if FOSE is not found. It accepts no parameters and looks like this:

"FOSE is either not present or not configured properly. If you have mods that require FOSE, you MUST either install FOSE or remove those mods.

If you haven't installed FOSE yet, visit the FOSE home page:

http://fose.silverlock.org/

If you have installed it, check that the FOSE files are in your game directory (where Fallout3.exe is located) and not in your game's Data directory (where your .esm and .esp files are located).

If all of that is true and it's still not working, make sure you're launching the game with fose_loader.exe. See the fose_readme.txt in your game directory."

-- DALCOFCDriverScript: A Quest Script attached to DALCOFCDriverQuest. This quest does most of the work in the mod. It declares the variable to hold the status of whether FOSE is on or off. Depending on that, either it puts the FOSE version, revision, and beta into some variables and displays them via the DALCOFCFosePresentMessage (if FOSE is present), or, if FOSE is absent, it displays a warning via DALCOFCFoseAbsentMessage. It only does the work once per game session because it checks (and sets) the global constant variable. It looks like:

"ScriptName DALCOFCDriverScript

;This script is attached to the DALCOFCDriverQuest.
;It declares a variable (bIsFoseOn) and leaves it at the default of 0 (FALSE) and expects a script in a stage of the calling quest to change it if FOSE is not running.
;If FOSE is NOT running, that other script will fail, the variable won't be changed, and this script will display messages depending on whether it is on or not.

short bIsFoseOn;this is defaulting to FALSE (0) and will be set (or not) in the script attached to Stage 10 of this script's calling quest
short iFOSEVersion
short iFOSERevision
short iFOSEBeta

Begin GameMode
if DALCOFCGameRestartedGlobal == 0;this checks a global constant variable defaulting to 0 at start of a game session (reverts to 0 at end of session)
set DALCOFCGameRestartedGlobal to 1;after first game session run-through, set this so this block won't process until next game session starts
SetStage DALCOFCDriverQuest 10;goes to Stage 10 of this quest to do the isolated FOSE function checks -- if it returns, bIsFoseOn will be set to true, if it doesn't, FOSE isn't on and it will remain false
if bIsFoseOn;checks to see if FOSE is present

set iFOSEVersion to GetFOSEVersion
set iFOSERevision to GetFOSERevision
set iFOSEBeta to GetFOSEBeta

ShowMessage DALCOFCFosePresentMessage iFOSEVersion iFOSERevision iFOSEBeta

else;FOSE isn't running

ShowMessage DALCOFCFoseAbsentMessage

endif;done with displaying the appropriate message for the state of FOSE

endif;done with the check for FOSE for this game session
End"

-- DALCOFCIsolatedScript: The quest isn't really name this. I've just attached a handle to it for ease of use. It's just a result quest attached to a Quest Stage for the main DALCOFCDriverQuest. Its purpose is to isolate the FOSE function from everything else so that when it fails, the rest of the mod can display the needed information. It consists of two lines and looks like this:

"set DALCOFCDriverQuest.bIsFoseOn to 0;just to make sure it assumes FOSE is missing
set DALCOFCDriverQuest.bIsFoseOn to GetFOSEVersion;if FOSE is present, that FOSE function will set the variable to 1. Otherwise, the whole statement (and script) will fail without changing anything"

-- DALCOFCDriverQuest: I set up a new quest, named it "Is FOSE Running?" and gave it the noted ID. I saved it and re-opened it, checked the "Start Game Enabled" and "Allow Repeated Stages" boxes. In the script area, I selected DALCOFCDriverScript from the list. I then went to the Quest Stages tab, entered a stage of 10, added an empty log entry, opened its Result Script box and entered those two line of DALCOFCIsolatedScript. I closed the script entry box, hit the Compile button, and then the OK button.

- ***Note: this mod checks for FOSE at the game level. Most of the work is here to drive that FOSE check. If, instead, you want to use checks just within some of your scripts (i.e., you want your mod to work at a reduced level if FOSE isn't present and just want to let the player know whenever they try to use a FOSE-specific activity), that's very similar to what's shown here except there's no need for the global (delete it or don't add it) or a quest stage (remove it or don't add it). Instead, the quest script (DALCOFCDriverScript in this mod) consists of just the two lines that were put in the quest stage result script (artificially called DALCOFCIsolatedScript here) with one addition (a declaration). IOW:

"short bIsFoseOn

set bIsFoseOn to 0
set bIsFoseOn to GetFOSEVersion"

and, in your script where you need to make the check, you would add the line:

"if DALCOFCDriverQuest.bIsFoseOn"

No state is saved (well, bIsFoseOn is, but it's reset to 0 each time), so each run will give current results. Most of the work goes away because your mod's script that's actually doing something is what's driving the check.

- After working through this, I realized that the key to the whole thing is that I had to isolate that FOSE function someplace where it could fail without taking down the script that needed it. Since the GECK doesn't have subroutines or user-defined functions, quests scripts need to be used to do that. I searched the web in vain for that information. Hopefully, by documenting it here, when someone else needs it, they can find it.

Credits
=======
- luthienanarion: Another big thanks to luthienanarion who pointed out my first method would only show the messages once. He also gave me a revised method.
- pkleiss: A big thanks to pkleiss who explained why my original code to display the Message "DALCOFOSECheckAbsent" wasn't working. He also provided the method of isolating the FOSE function GetFOSEVersion so that the mod can display its warning Message when FOSE isn't present: http://forums.nexusmods.com/index.php?/topic/1271071-getfoseversion-not-working-as-expected/

Tools Used
==========
- Notepad++ (http://notepad-plus-plus.org/): I did all my script editing in this.
- Fallout Script Extender (FOSE) by Ian Patterson (ianpatt), Stephen Abel (behippo), and Paul Connelly (scruggsywuggsy the ferret): http://fose.silverlock.org/
- Garden of Eden Creation Kit (GECK - http://geck.bethsoft.com/index.php/Main_Page)
- Cipscis' Script Validator: http://www.cipscis.com/fallout/utilities/validator.aspx
- FO3Edit by ElminsterAU: http://www.nexusmods.com/fallout3/mods/637/?tab=1&navtag=http%3A%2F%2Fwww.nexusmods.com%2Ffallout3%2Fajax%2Fmoddescription%2F%3Fid%3D637%26preview%3D&pUp=1
- Nexus Mod Manager (NMM): http://www.nexusmods.com/fallout3/mods/modmanager/

Licensing/Legal
===============
Feel free to use this mod and modify it as you need. I'm making this a Modder's Resource.