Jump to content

Perform script operations on lists from another ESP?


Recommended Posts

I'm trying to update Myopia to work with MannyGT's Realistic Eyeglasses. As there are several hundred of the things I'd rather not bring them all in individually, so I'm trying to import the FormList from the Eyeglasses mod and use it to populate the Myopia FormList:

	if Game.GetModByName("manny_eyeglasses.esp")!=255
		FormList property manny_List_EyeGlasses Auto
		int FormNo = GetSize(manny_List_EyeGlasses)
		while FormNo
			FormNo -= 1
			Form glasses = Game.GetFormFromFile(FormNo, "manny_eyeglasses.esp")
			MyopiaGlassesList.AddForm(glasses)
		endWhile
	endIf

Trouble is the compiler won't let me declare manny_List_Eyeglasses as a FormList:

 

C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\source\scripts\myopiaPlayerAlias.psc(95,2): no viable alternative at input 'FormList'
C:\Program Files (x86)\Steam\steamapps\common\Skyrim Special Edition\Data\source\scripts\myopiaPlayerAlias.psc(95,20): no viable alternative at input 'manny_List_EyeGlasses'

 

Line 95 is 'FormList property manny_List_EyeGlasses Auto'. I assume the problem is because I'm trying to import something from a different esp, but I'm not sure how to fix this and can't seem to find any information on Google or the Wiki. Is there a way to do this? Is it so blindingly simple that nobody's ever bothered to write down how to do it? Please say yes...

Edited by AdmiralAlbia
Link to comment
Share on other sites

You are trying to define a property while inside a function. That cannot happen. Properties must be declared within the empty state and outside all events and functions.

 

For what you want to accomplish use GetFormFromFile on the FormList from the other mod itself. Also your usage of GetFormFromFile where you currently have it is incorrect. I do not have the Eyeglasses mod in front of me thus I do not know the correct data but what you are wanting to accomplish should be something more as follows:

 

 

If Game.GetModByName("manny_eyeglasses.esp") != 255
  FormList manny_List_EyeGlasses = Game.GetFormFromFile(0x00123456,"manny_eyeglasses.esp") as FormList
  Int iSize = GetSize(manny_List_EyeGlasses)
  While iSize > 0
    iSize -= 1
    Form glasses = manny_List_EyeGlasses.GetAt(iSize)
    MyopiaGlassesList.AddForm(glasses)
  EndWhile
EndIf

Change the hexadecimal value in the GetFormFromFile statement to the FormID of the FormList in the manny_eyeglasses.esp file. Make sure to use only the last 6 digits. The first two digits correspond with load order and for the purposes of GetFormFromFile all calls will be relative to the associated ESP and just need to remain 00

Link to comment
Share on other sites

  • Recently Browsing   0 members

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