Jump to content

[JIP NVSE] ReadArrayFromFile


Maxandmov

Recommended Posts

Hello, guys. I'm back with another issue w/my code >:C

I need to read the file from a certain location so I do it. The issue is, though, that it refuses to be read.

if GetGameLoaded == 1;ÐÑи каждой загÑÑзке игÑÑ ÑÑиÑÑваем Ñайл заного.
		let cItem := ReadArrayFromFile "Data\menus\MoltenCloudsMCItemDescriptions.ini"
		let sItem := Ar_Size cItem
		printC "%.0f" sItem
endif

I check whether game loaded (this check passes since I get PrintC outputs), then I read the array from designed .ini file and check its size. Size is -1 always, no matter whether I rename the file, change its extension or whatever. I even rewrote the contents of the file once.

What is wrong? Why it refuses to read? This code is in begin GameMode block.

The function is JIP's creation in his JIP NVSE plugin; its page on GECK wiki roughly describes on how-to and my only idea was to use let. :/

Edited by Maxandmov
Link to comment
Share on other sites

Nope, it starts just like 'Begin GameMode'. Actually, I never even HEARD of overrides.

begin GameMode

	if GetGameLoaded == 1;При каждой загрузке игры считываем файл заного.
		let cItem := ReadArrayFromFile "Data\menus\MoltenCloudsMCItemDescriptions.ini"
		let sItem := Ar_Size cItem
		printC "%z" ItemDesc
		printC "%.0f" sItem
		let sItem /= 2
		let sItem -= 1;Эл-ты массива от 0 до Size-1
		printC "%.0f" sItem
	endif
end

Here's the code for you - nothing special, @PushTheWinButton

Edited by Maxandmov
Link to comment
Share on other sites

Just some general coding suggestions. (I don't do mod creation for FNV.)

 

Generally the game engine is expecting things related to mods to be in the "Data" folder. See if that path works without "Data", as in "menus\MoltenCloudsMCItemDescriptions.ini". That filename has "relative" pathing (which is required). Make sure your default (working) folder when you test is the correct starting point for that path. For the path to start with "Data" you need to be in the "common\Fallout New Vegas" folder. With my suggestion you should be in "Data". (I know the wiki page says "relative to the game installation path", but it's been wrong before. Worth a test.)

 

ReadArrayFromFile requires the file contents to be "tab" separated. As this is a non-printing character it is easy to miss one. Make sure you have at least one tab for each "array value", even if there is none. You might want to use a "placeholder" for visual verification of "null content" (like "~") and then remove them once you have verified the format of each line.

 

[Edit: Ninja'd by RoyBatterian, so it looks like you fixed it.]

 

-Dubious-

Edited by dubiousintent
Link to comment
Share on other sites

  • Recently Browsing   0 members

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