Papyrus Error "GetReference is not a function or does no

Post » Wed Jun 20, 2012 9:23 am

I have the following code:

Spoiler
Scriptname SCoLTheLuggageInnsActivatorScript extends ObjectReferenceSCoLTheLuggageQuestScript Property QuestRef AutoQuest Property SCoLTheLuggageQuest AutoObjectReference bedObjectReference theLuggageEvent OnCellAttach()RegisterForUpdate(1)EndEventEvent OnUpdate()bed = QuestRef.SCoLBedAlias.GetReference()theLuggage = QuestRef.SCoLTheLuggageAlias.GetReference()if(bed.GetActorOwner() == Game.GetPlayer().GetActorBase())theLuggage.enable()UnregisterForUpdate()endifEndEvent

Which references the quest SCoLTheLuggageQuest, which has the following script, as well as appropriate alias'

Spoiler

Scriptname SCoLTheLuggageQuestScript extends QuestAlias Property SCoLTheLuggageAlias  AutoAlias Property SCoLBedAlias  Auto  

Which gives me the following error:

Spoiler
Starting 1 compile threads for 1 files...Compiling "SCoLTheLuggageInnsActivatorScript"...c:\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\SCoLTheLuggageInnsActivatorScript.psc(18,29): GetReference is not a function or does not existc:\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\SCoLTheLuggageInnsActivatorScript.psc(19,43): GetReference is not a function or does not existNo output generated for SCoLTheLuggageInnsActivatorScript, compilation failed.Batch compile of 1 files finished. 0 succeeded, 1 failed.Failed on SCoLTheLuggageInnsActivatorScript

Even though http://www.creationkit.com/GetReference_-_ReferenceAlias is clearly a function of a http://www.creationkit.com/ReferenceAlias_Script script.

Any idea what's up? I'm stumped.
User avatar
joannARRGH
 
Posts: 3431
Joined: Mon Mar 05, 2007 6:09 am

Post » Wed Jun 20, 2012 1:30 pm

theLuggage = QuestRef.SCoLTheLuggageAlias.GetReference() 

You're calling GetReference() on ''QuestRef.SCoLTheLuggageAlias'', which is a property of type Alias. GetReference(), however, is a function of the ReferenceAlias script which extends Alias.

So instead you should try this:

theLuggage = (QuestRef.SCoLTheLuggageAlias As ReferenceAlias).GetReference()
User avatar
DeeD
 
Posts: 3439
Joined: Sat Jul 14, 2007 6:50 pm

Post » Wed Jun 20, 2012 8:46 am

Wonderful, that compiled, now to see if it works in game :)
User avatar
rebecca moody
 
Posts: 3430
Joined: Mon Mar 05, 2007 3:01 pm

Post » Wed Jun 20, 2012 11:03 am

You're coding The Luggage? Any chance of an Orangutan Librarian?
User avatar
IM NOT EASY
 
Posts: 3419
Joined: Mon Aug 13, 2007 10:48 pm

Post » Wed Jun 20, 2012 3:39 pm

An Orangutan Librarian??

As for the script, it simply doesn't enable The Luggage, and it also doesn't disable it if set it to initially enabled and add the line "theLuggage.disable()".

I've checked the cell is being attached, and I've checked to make sure the OnUpdate block is being run with debug.notification messages, but nothing gets enabled or disabled. I'll double check my alias'.
User avatar
Roy Harris
 
Posts: 3463
Joined: Tue Sep 11, 2007 8:58 pm

Post » Wed Jun 20, 2012 10:34 am

An Orangutan Librarian??

http://wiki.lspace.org/wiki/The_Luggagehttp://wiki.lspace.org/wiki/Librarian
User avatar
Farrah Lee
 
Posts: 3488
Joined: Fri Aug 17, 2007 10:32 pm

Post » Wed Jun 20, 2012 9:46 am

http://wiki.lspace.org/wiki/The_Luggagehttp://wiki.lspace.org/wiki/Librarian

http://wryemusings.com/Cobl.html#TheLuggageandPratchett

:P
User avatar
Enie van Bied
 
Posts: 3350
Joined: Sun Apr 22, 2007 11:47 pm

Post » Wed Jun 20, 2012 4:55 pm

Turns out I'm a numpty.

The script now looks like this:


Spoiler
Scriptname SCoLTheLuggageInnsActivatorScript extends ObjectReferenceSCoLTheLuggageQuestScript Property QuestRef AutoQuest Property SCoLTheLuggageQuest AutoObjectReference bedEvent OnCellAttach()Debug.Notification("Cell has attached")RegisterForUpdate(5)EndEventEvent OnUpdate()Debug.Notification("Updated")bed = QuestRef.SCoLBedAlias.GetReference()if(bed.GetActorOwner() == Game.GetPlayer().GetActorBase())  self.enable()else  self.disable()endifEndEvent

And I've changed the Alias in to a ReferenceAlias, to avoid the need for casting. But it doesn't ever seem to find a bed owned by the player.
User avatar
Jonathan Egan
 
Posts: 3432
Joined: Fri Jun 22, 2007 3:27 pm

Post » Wed Jun 20, 2012 9:06 am

So I've decided to forgo the quest and the alias', but now my OnUpdate block doesn't run more than once.

EDIT: To clarify, the OnUpdate runs once, every time to OnCellAttach block runs, but after that it doesn't run.

Current code:


Spoiler
Scriptname SCoLTheLuggageInnsActivatorScript extends ObjectReferenceObjectReference Property bed AutoEvent OnCellAttach()Debug.Notification("Cell has attached")RegisterForUpdate(1)EndEventEvent OnCellDettach()Debug.Notification("Cell has dettached")UnregisterForUpdate()EndEventEvent OnUpdate()Debug.Notification("Updated")if(bed.GetActorOwner() == Game.GetPlayer().GetActorBase())  ;if(self.isDisabled() == 1)   self.enable()  ;endifelseif(bed.GetActorOwner() != Game.GetPlayer().GetActorBase())  ;if(self.isDisabled() == 0)   self.disable()  ;endifendifEndEvent
User avatar
kirsty williams
 
Posts: 3509
Joined: Sun Oct 08, 2006 5:56 am

Post » Wed Jun 20, 2012 3:21 pm

Ok, well i figured out the problem. I had two scripts attached to the object, which both had OnUpdate blocks in, screwing eveything up. All is well.
User avatar
Sierra Ritsuka
 
Posts: 3506
Joined: Mon Dec 11, 2006 7:56 am


Return to V - Skyrim