NWN:EE bat files

Hints and Guidelines, How To's on Registration, Activation, NWN, etc.

Moderators: Forum Moderators, Active DMs

User avatar
milkshake
Posts: 5
Joined: Tue Mar 13, 2018 6:01 am

Re: NWN:EE bat files

Post by milkshake » Tue Jun 05, 2018 8:33 am

*worked amazingly untill the update a fiew days ago; now gets "Could not translate error"*
Plays as: Ayuu

User avatar
triaddraykin
Arelith Silver Supporter
Arelith Silver Supporter
Posts: 735
Joined: Mon Sep 08, 2014 2:32 am

Re: NWN:EE bat files

Post by triaddraykin » Tue Jun 05, 2018 6:19 pm

See previous post. Which version are you using? If you post yours (remove and personal information if you want) I can adapt it so that it just launches the main NWN file without using the currently-broken +connect feature, so that it still produces logs.
Alia: The uncanny knack of Angela Amana to make the otherwise perpetually well-mannered girl lose her temper and be HORRIBLY ASHAMED afterwards.

Who on the Team to PM and When
Public Tower Discord
Tower Library
Scroll, Wand, & Potion Costs

Dragonovith
Contributor
Contributor
Posts: 600
Joined: Tue Sep 12, 2017 7:58 pm

Re: NWN:EE bat files

Post by Dragonovith » Tue Jun 05, 2018 7:50 pm

triaddraykin wrote:
Tue Jun 05, 2018 6:19 pm
See previous post. Which version are you using? If you post yours (remove and personal information if you want) I can adapt it so that it just launches the main NWN file without using the currently-broken +connect feature, so that it still produces logs.
It's working, thank you. Also, I think (I know it is obvious, but...) you should mention separately that you have to launch the fourth option in the .bat file, "NWN: Main", and not the other three, which connect directly to the specified server.

User avatar
El-Ravioli
Posts: 11
Joined: Tue Jul 17, 2018 1:13 pm

Re: NWN:EE bat files

Post by El-Ravioli » Wed Aug 22, 2018 12:24 am

I play Nwn: EE through steam and used the bat file to create a link to the nwn executable in the steam apps server. However, going that way, none of my workshop subscribed Overrides load ....

Is there a way of a) using the bat file and b) still get the overrides? Or are they mutually exclusive?

User avatar
Rigela
Posts: 211
Joined: Wed Jan 31, 2018 10:28 pm

Re: NWN:EE bat files

Post by Rigela » Wed Aug 22, 2018 12:58 am

I've manually placed the files in the correct folder (override in documents) and they work for me at least.
Isabella Isherwood - Priestess of Selune
Piper Barley - Joybringer of Lliira

User avatar
El-Ravioli
Posts: 11
Joined: Tue Jul 17, 2018 1:13 pm

Re: NWN:EE bat files

Post by El-Ravioli » Wed Aug 22, 2018 1:41 am

WHOOOT !!! Thanks @Symphony !!!!

In order to use the BAT for log rotation, as well as loading the steam workshop overrides and always have them up to date without having to manually put stuff in your overrides folder, the following steps need to be done:

- In steam, create a desktop shortcut for NWN
- in the BAT file, change everything that says nwnmain.exe to the URL of that shortcut
- that will cause the steam loader to launch NWN, rather than it being loaded without the launcher and it will correctly use the workshop subscription.

My BAT file looks as follows:

Code: Select all

@echo off
::Your NWNL:EE log directory location on the next line.
set EEDocDir="C:\Users\user\Documents\Neverwinter Nights"
::Your EE nwmain.exe install directory on the next line
set EEInstallDir="C:\Users\user\Desktop"
::The location of your logs folder of your 1.69 install on the next line
set NWN169Dir="E:\GalaxyClient\Games\NWN Diamond"
:: Your 1.69 nwmain.exe install directory on the next line, only modify if it's different location from your logs folder
set NWN169GameDir=%NWN169Dir%
echo Select a Server
echo 1. NWN: EE Distant Shores
echo 2. NWN: EE Cities and Planes
echo 3. NWN: EE Surface
echo 4. NWN: 1.69 PGCC Arena
echo 5. NWN: 1.69 FL
set /p servervar= Server Number:
if %servervar% lss 4 (
  set logdir=%EEDocDir%
  cd /D %EEInstallDir%
  if %servervar% == 1 start /wait steam://rungameid/704450 +connect game.arelith.com:5121
  if %servervar% == 2 start /wait steam://rungameid/704450 +connect game.arelith.com:5122
  if %servervar% == 3 start /wait steam://rungameid/704450 +connect game.arelith.com:5123
)


if %servervar% gtr 3 (
  set logdir=%NWN169Dir%
  cd /D %NWN169GameDir%

  if %servervar% == 4 start /wait steam://rungameid/704450 +connect arena.arelith.com:5121
  if %servervar% == 5 start /wait steam://rungameid/704450 +connect fl.arelith.com:5121

)

for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"
set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%"
set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%" & set "Sec=%dt:~12,2%"
set TODAY=%YYYY%-%MM%-%DD%
set NOW=%HH%-%Min%-%Sec%
move %logdir%\logs\nwclientLog1.txt %logdir%\logs\log-%TODAY%-%NOW%.txt


User avatar
triaddraykin
Arelith Silver Supporter
Arelith Silver Supporter
Posts: 735
Joined: Mon Sep 08, 2014 2:32 am

Re: NWN:EE bat files

Post by triaddraykin » Thu Aug 23, 2018 1:53 am

So it doesn't rotate the log until I start up the game next time, instead of right at the end of the session. It also doesn't connect directly to any server, instead launching the full game each time, so the +connect game.arelith.com:5121 might as well not be there.
Followed the instructions there. I have a shortcut on my desktop that's just "steam://rungameid/704450".
The code is:

Code: Select all

@echo off
::Your NWNL:EE log directory location on the next line.
set EEDocDir="C:\Users\Triaddraykin\Documents\Neverwinter Nights"
::Your EE nwmain.exe install directory on the next line
set EEInstallDir="C:\Users\Triaddraykin\Desktop" 
::The location of your logs folder of your 1.69 install on the next line
set NWN169Dir="E:\GalaxyClient\Games\NWN Diamond"
:: Your 1.69 nwmain.exe install directory on the next line, only modify if it's different location from your logs folder
set NWN169GameDir=%NWN169Dir%
echo Select a Server
echo 1. NWN: EE Distant Shores
echo 2. NWN: EE Cities and Planes
echo 3. NWN: EE Surface
echo 4. NWN: 1.69 PGCC Arena
echo 5. NWN: 1.69 FL
set /p servervar= Server Number:
if %servervar% lss 4 (
  set logdir=%EEDocDir%
  cd /D %EEInstallDir%
  if %servervar% == 1 start /wait steam://rungameid/704450 +connect game.arelith.com:5121
  if %servervar% == 2 start /wait steam://rungameid/704450 +connect game.arelith.com:5122
  if %servervar% == 3 start /wait steam://rungameid/704450 +connect game.arelith.com:5123
)


if %servervar% gtr 3 (
  set logdir=%NWN169Dir%
  cd /D %NWN169GameDir%

  if %servervar% == 4 start /wait steam://rungameid/704450 +connect arena.arelith.com:5121
  if %servervar% == 5 start /wait steam://rungameid/704450 +connect fl.arelith.com:5121

)

for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"
set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%"
set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%" & set "Sec=%dt:~12,2%"
set TODAY=%YYYY%-%MM%-%DD%
set NOW=%HH%-%Min%-%Sec%
move %logdir%\logs\nwclientLog1.txt %logdir%\logs\log-%TODAY%-%NOW%.txt
For reference, what I have that DOES work, it's slightly modified as I don't have any 1.69 installation anymore:

Code: Select all

@setlocal enableextensions enabledelayedexpansion
@echo off
::Your NWNL:EE docoument directory on the next line, the location of your logs directory and nwnplayer.ini
set EEDocDir="C:\Users\Triaddraykin\Documents\Neverwinter Nights"
::Your EE nwmain.exe install directory on the next line
set EEInstallDir="D:\SteamLibrary\steamapps\common\Neverwinter Nights\bin\win32" 
echo Select a Server
echo 1. NWN: EE Distant Shores
echo 2. NWN: EE Cities and Planes
echo 3. NWN: EE Surface
echo 4. NWN: Main
set /p servervar= Server Number:
if %servervar% lss 5 (
  set logdir=%EEDocDir%
  cd /D %EEInstallDir%
  if %servervar% == 1 start /wait nwmain.exe +connect game.arelith.com:5121
  if %servervar% == 2 start /wait nwmain.exe +connect game.arelith.com:5122
  if %servervar% == 3 start /wait nwmain.exe +connect game.arelith.com:5123
  if %servervar% == 4 start /wait nwmain.exe
)

for /f "tokens=2 delims==" %%a in ('wmic OS Get localdatetime /value') do set "dt=%%a"
set "YYYY=%dt:~0,4%" & set "MM=%dt:~4,2%" & set "DD=%dt:~6,2%"
set "HH=%dt:~8,2%" & set "Min=%dt:~10,2%" & set "Sec=%dt:~12,2%"
set TODAY=%YYYY%-%MM%-%DD%
set NOW=%HH%-%Min%-%Sec%
move %logdir%\logs\nwclientLog1.txt %logdir%\logs\log-%TODAY%-%NOW%.txt
Alia: The uncanny knack of Angela Amana to make the otherwise perpetually well-mannered girl lose her temper and be HORRIBLY ASHAMED afterwards.

Who on the Team to PM and When
Public Tower Discord
Tower Library
Scroll, Wand, & Potion Costs

Morderon
Technical Lead
Technical Lead
Posts: 1271
Joined: Mon Sep 08, 2014 2:24 am

Re: NWN:EE bat files

Post by Morderon » Sat Nov 17, 2018 12:42 pm

It's possible to get the game to remember your login AND get it to prompt you to change it.

Edit nwnplayer.ini

Set Player Name= to your most common login with a ? at the end, or any other character that's invalid in user names.

For example I could use Player Name=Morderon?

When logging into the server I'll be able to confirm I want to use Morderon or change it to something else.

Just saves you some time from typing your most common login while keeping it easy to change.

This works for any NWN: EE launching method.

User avatar
Mattamue
Arelith Silver Supporter
Arelith Silver Supporter
Posts: 468
Joined: Mon Dec 10, 2018 1:45 am

Re: NWN:EE bat files

Post by Mattamue » Sun Dec 16, 2018 7:49 pm

I have the steam version of the EE and I'm having some trouble finding nwnplayer.ini to enable logging. Where should this be located in a default install?

Who is the audience for this post?


Fionn
Posts: 237
Joined: Sun Apr 29, 2018 7:35 pm

Re: NWN:EE bat files

Post by Fionn » Mon Dec 17, 2018 1:22 am

I flipped this over to PS1 for those on Windows (or PowerShell Core). No 169 support. You'll want to verify/edit lines 1, 5 & 33. Let me know if I fat fingered anything.

Code: Select all

#Your NWNL:EE docoument directory on the next line, the location of your logs directory and nwnplayer.ini
$EEDocDir = Get-Item "$env:HOMEDRIVE$env:HOMEPATH\Documents\Neverwinter Nights"
$EELogDir = "$EEDocDir\logs"

#Your EE nwmain.exe install directory on the next line
$EEInstallDir = Get-Item "D:\SteamLibrary\steamapps\common\Neverwinter Nights\bin\win32" 
$nwmain = Get-Item "$EEInstallDir\nwmain.exe"

#set nwnplayer.ini & player name
$playerIni = 'nwnplayer.ini'
$playerBak = 'nwnplayer.bak'
Push-Location $EEDocDir
$playerName = (Get-Item $playerIni | Select-String '^Player Name=.*').Matches.Value.Split('=')[-1]
$newPlayerName = Read-Host -Prompt "Enter new player name (Enter to keep $playerName)"
if ($newPlayerName -eq '') {$newPlayerName = $playerName}
Pop-Location


#update player name
if($newPlayerName -ne $playerName){
    Rename-Item $playerIni $playerBak -ErrorAction Stop
    Get-Content $playerBak |%{
        if ($_ -match '^Player Name=.*'){
            Write-Output "Player Name=$newPlayerName"
        } else {
            Write-Output $_
        }
    } | Out-File -Encoding ascii -Append $playerIni
    if(Test-Path $playerIni) {Remove-Item $playerBak}
}

#backup logs
$numberToKeep = 50
$dateStamp = Get-Date -Format 'yyyyMMddHHmmss'
Push-Location $EELogDir
Rename-Item nwclientLog1.txt "nwclientLog_$dateStamp.txt"
$logs = (Get-ChildItem nwclientLog_*.txt)
if ($logs.Count -gt $numberToKeep){
    $numberToDelete = $logs.Count - $numberToKeep
    (0..(--$numberToDelete))|%{$logs[$_].Delete()}
}
Pop-Location

#select a server
$prompt = @"
Select a Server
1. NWN: EE Distant Shores
2. NWN: EE Cities and Planes
3. NWN: EE Surface

"@
$server = Read-Host -Prompt $prompt

#launch NWN
if ($server -lt 4) {
    Push-Location $nwmain.DirectoryName
    Start-Process -FilePath $nwmain.FullName -ArgumentList "+connect game.arelith.com:512$server"
}
~~~~~~
Badger
Wynn
RIP: Paddy

User avatar
Skarain
Posts: 467
Joined: Thu Sep 06, 2018 10:31 am

Re: NWN:EE bat files

Post by Skarain » Tue Apr 09, 2019 6:32 am

Hello. A friend guided me to this thread, when I asked about how to record chat logs in NWN.

However, I understand nothing about this. I tried reading the thread over and over, first post and comments, but I still have no idea where to put the file for it to work.

User avatar
Drowble Oh Seven
Posts: 427
Joined: Fri Sep 29, 2017 11:36 pm

Re: NWN:EE bat files

Post by Drowble Oh Seven » Tue Apr 09, 2019 7:50 am

Hullo!

I wrote a guide on setting this up for an older version of the bat files a while back. You'll need to replace the code you're copying and pasting with the bits from the first post of this topic to make sure you're getting the latest, but the principles should still be the same.

We probably don't need the 1.69 info in there anymore, but I don't think anyone's got around to tidying it up yet.

Aelryn Bloodmoon
Arelith Supporter
Arelith Supporter
Posts: 2028
Joined: Thu Sep 11, 2014 4:57 pm

Re: NWN:EE bat files

Post by Aelryn Bloodmoon » Fri Aug 09, 2019 5:15 am

Before I go and give this a try, I've noticed all the information in this thread references steam directories - other than changing my game directory to fit my personal machine and install, does the fact that I got the game directly from Beamdog and launch through the Beamdog client rather than the steam client require any changes to the .bat files?
Bane's tyranny is known throughout the continent, and his is the image most seen as the face of evil.
-Faiths and Pantheons (c)2002

User avatar
Drowble Oh Seven
Posts: 427
Joined: Fri Sep 29, 2017 11:36 pm

Re: NWN:EE bat files

Post by Drowble Oh Seven » Fri Aug 09, 2019 5:23 am

It shouldn't do - provided you're pointing it at whatever install directory it is that has your nwmain.exe in it. I'm not familiar with how it's laid out for the beamdog version, but the script pretty much bypasses launchers.

Post Reply