GetFormFromFile() difficulties.

Post » Sat Sep 21, 2013 3:20 pm

Hey everyone,

I'm trying to remove the need for a compatibility plugin by using http://www.creationkit.com/GetFormFromFile_-_Game in my script to check for a formlist from Dawnguard, then alter it if present. However, I'm getting some errors and I can't figure out how to get this working. Any help is appreciated.

;check for formlist from dawnguardFormList Property RidableWorlds = Game.GetFormFromFile(0x0100099B, "Dawnguard.esm") As FormList;ensure formlist is not NONEEvent OnInit()   If ( RidableWorlds )     RideableWorlds.AddForm(Falskaar)   EndIfEndEventWorldSpace Property Falskaar Auto 

When trying to compile I get these errors:

Any ideas?

Thanks,

AV

User avatar
Charlie Ramsden
 
Posts: 3434
Joined: Fri Jun 15, 2007 7:53 pm

Post » Sat Sep 21, 2013 6:23 am

1. You haven't declared the FormList property properly. You don't even need to use a property as you can just use a regular FormList variable.

2. The second argument when calling Game.GetFormFromFile() is missing a quotation mark.

Event OnInit()	;check for formlist from dawnguard	FormList RideableWorlds = Game.GetFormFromFile(0x0100099B, "Dawnguard.esm") As FormList	;ensure formlist is not NONE	If(RideableWorlds)     		RideableWorlds.AddForm(Falskaar)   	EndIfEndEventWorldSpace Property Falskaar Auto 
User avatar
marie breen
 
Posts: 3388
Joined: Thu Aug 03, 2006 4:50 am

Post » Sat Sep 21, 2013 11:25 am

1. Ah, that was just something I put in to try to get it to compile, I've tried without it as well.

2. I actually have that quotation in the script, it just pasted weird into the browser and I had to manually type stuff and I forgot it. xD (I've added it above)

Even if I try this exact line it won't compile, same errors:

FormList RidableWorlds = Game.GetFormFromFile(0x0100099B, "Dawnguard.esm") As FormList

I've tried adding parenthesis, property, tweaking formatting. Nothing seems to get rid of these errors.

EDIT: Hold on I may be doing something silly and not reading properly, let me try something.

User avatar
Emily Graham
 
Posts: 3447
Joined: Sat Jul 22, 2006 11:34 am

Post » Sat Sep 21, 2013 9:26 am

Okay yes, MrJack your suggestion worked I'm just being silly right now. (dealing with some other stuff too :P)

Thank you very much!

User avatar
W E I R D
 
Posts: 3496
Joined: Tue Mar 20, 2007 10:08 am

Post » Sat Sep 21, 2013 10:52 am

Just did a quick test and for future reference the problem was that a function (in this case GetFormFromFile) was being called outside of an event.

User avatar
Glu Glu
 
Posts: 3352
Joined: Sun Apr 01, 2007 5:39 am

Post » Sat Sep 21, 2013 8:40 am

Yeah this was it, I just totally blanked and didn't compute the fact that you had moved it into the event in your posted script. Moved it in and all is well. :thumbsup:

User avatar
Rik Douglas
 
Posts: 3385
Joined: Sat Jul 07, 2007 1:40 pm

Post » Sat Sep 21, 2013 4:41 am

You'll want to be sure you only ever call that once, otherwise your initialization will end up adding multiple copies of the same thing to the formlist each time the game starts. You may already be doing this but I figured it wouldn't hurt to b sure :)

User avatar
GEo LIme
 
Posts: 3304
Joined: Wed Oct 03, 2007 7:18 pm

Post » Sat Sep 21, 2013 7:38 am

I did a simple OnInit check with some game update calls that checks for the form. If the form is valid (I.e. DG is loaded) it does it's thing then stops forever. If the form is not valid, it waits a period then tries again. This way if someone loads Falskaar without Dawnguard, then later buys/installs/activates Dawnguard, the fix still takes effect.

User avatar
Elle H
 
Posts: 3407
Joined: Sun Aug 06, 2006 3:15 am

Post » Sat Sep 21, 2013 2:07 pm

An FLST won't bear the same form twice via AddForm. The CK won't allow addition of duplicate entries either, but doesn't remove them in the event they've been added with a third party app, nor does the game at runtime.

User avatar
Je suis
 
Posts: 3350
Joined: Sat Mar 17, 2007 7:44 pm


Return to V - Skyrim