I have made a plugin that brightens torches in caves and mines. Simple plugin. But I don't want to keep opening the CS to adjust the brightness to where I want it. So I made a batch file and told the script to run it. But I'm unsure about how to script the actual implementation.
My batch file:
Set aaaTorchBrightnessQuest.Brightness to 1292
This one looks good. When run, it sets your Brightness variable to 1292 (assuming the quest is named aaaTorchBrightnessQuest).
My script:
RunScriptLine "Set Cave to LocationType.Type"
What are you trying to do with this line? Do you have another quest named LocationType with a variable named Type? And you need to fully qualify your local variable Cave with its quest name too, e.g. "aaaTorchBrightnessQuest.Cave".
RunBatchScript "Data\Brighter Torches.ini"
This will make the batch script being read in every time your script run, every second. That is a complete waste of game resources. Change it to:
If GetGameLoaded RunBatchScript "Data\Brighter Torches.ini"EndIf
I will also encourage you to use "Data\Ini" as folder for ini files, it makes it less cluttered that way, and easier to find ini files, but this is subjective.
If DoOnce < 3PrintC "Brighter Torches Initialized"set DoOnce to DoOnce + 1EndIf
This seems wrong too. It will write out "Brighter Torches Initialized" three times the first time you run it, and then never again. I'd ditch the DoOnce variable completely, and just move the PrintC line up to the GetGameLoaded block, making it write the message each time you load a savegame and read the ini file.
If Cave == 2 SetLightRadius 1292 Torch02EndIfEnd
This probably works, but replace "1292" with your variable ("Brightness").
How do I implement the reading of the batch file variable into the script? Because of the nature of the "SetLightRadius" function, you have to give it a value after calling it. So, I can't put...
Set Brightness to SetLightRadius
...because it needs a value after the function. I know I could make a different batch file that says...
SetLightRadius 1292
...and leave it at that, but I don't want to do that. If I have to, I will, but I'd rather use the batch file format that everybody else uses.
The radius parameter in the SetLightRadius command can take a variable, so a change from "SetLightRadius 1292 Torch02" to "SetLightRadius Brightness Torch02" does what you want.
With all those changes, the script should be something like:
ScriptName TorchBrightnessScriptfloat fQuestDelayTimefloat Brightnessshort CaveBegin GamemodeIf GetGameLoaded Set fQuestDelayTime to 1 RunBatchScript "Data\Ini\Brighter Torches.ini" PrintC "Brighter Torches Initialized"EndIfRunScriptLine "Set aaaTorchBrightnessQuest.Cave to LocationType.Type"If Cave == 2 SetLightRadius Brightness Torch02EndIfEnd