Functions claiming to not exist.

Post » Sun Jun 17, 2012 11:18 pm

I have been unable to get the Dispel and SetEssential functions to compile. Every time I just get the "is not a function or does not exist" error reported, regardless of of the fact that the functions actually do exist in scripts I've assigned as parents or imported. I can even define the function within the same script (sticking "Function SetEssential(bool abEssential = true) native" in it) and it still claims it doesn't exist.

Has anyone been able to compile scripts using these functions?
User avatar
Laura Tempel
 
Posts: 3484
Joined: Wed Oct 04, 2006 4:53 pm

Post » Sun Jun 17, 2012 7:15 pm

ugh, functions in an existential crisis. :huh:

Don't worry, it's just a phase.
User avatar
Laura Cartwright
 
Posts: 3483
Joined: Mon Sep 25, 2006 6:12 pm

Post » Mon Jun 18, 2012 1:39 am

Can you post the script you're trying to compile?
User avatar
Tom Flanagan
 
Posts: 3522
Joined: Sat Jul 21, 2007 1:51 am

Post » Sun Jun 17, 2012 8:55 pm

What about you show us the script?
User avatar
LittleMiss
 
Posts: 3412
Joined: Wed Nov 29, 2006 6:22 am

Post » Sun Jun 17, 2012 2:51 pm

My shiny dollar is saying that you may not have your properties set up, assuming this is in Papyrus? Make sure your recipient target is a property.

I get the same thing for "SetStage(5)" in the quest papyrus block. It says "SetStage" is not a function but what it wants is "GetCurrentQuest().SetStage(5)" or something of the like and it works great.
User avatar
Dark Mogul
 
Posts: 3438
Joined: Tue Feb 20, 2007 11:51 am

Post » Sun Jun 17, 2012 9:16 pm

I ended up just using other methods. This is what the script looks like now:

Scriptname TransformationSafetyScript extends Actor  import ActiveMagicEffect;Setting an NPC's race will fail if the NPC is currently bleeding out. This means it's possible to get stuck in a transformation if bleeding out while it ends.;This small script will revert the NPC back to their normal form after Bleeding Out ends if the transformation duration already expired.Race Property NPCRace autoMagicEffect Property TransformMagicEffect autoEvent OnEnterBleedout()	if GetRace() != NPCRace			registerForUpdate(0.5)	endifendEventEvent OnUpdate()	if HasMagicEffect(TransformMagicEffect) == false		if IsBleedingOut() == false			if GetRace() != NPCRace				SetRace(NPCRace)			endif		endif;This is separated as a final safety measure		if GetRace() == NPCRace			UnregisterForUpdate()		endif	endifendEvent


I use this as a safety measure for the werewolf and insect swarm transformations I've given Aela and Illia, repectively. As explained in the script comments, if an NPC is in BleedingOut status, any SetRace functions called on it will fail. This was causing an error where if Aela or Illia were downed while the effect ended, they'd just stay in their shifted forms forever.
User avatar
Tinkerbells
 
Posts: 3432
Joined: Sat Jun 24, 2006 10:22 pm

Post » Mon Jun 18, 2012 1:35 am

I can’t be sure, since you didn’t post your original script, but http://www.creationkit.com/SetEssential_-_ActorBase is defined on ActorBase, and http://www.creationkit.com/Dispel_-_ActiveMagicEffect is defined on ActiveMagicEffect. Since your script extends Actor, and an actor is not an ActorBase or an ActiveMagicEffect, the compiler is complaining that it doesn’t know what function you are referring to. Simply defining the functions yourself in your script might end up making the compiler happy, but the game will complain because the function you defined as “native” doesn’t exist on Actor.

For SetEssential, you probably wanted the following:

GetActorBase().SetEssential()

And for Dispel, you would need the ActiveMagicEffect you wanted to dispel, which you then call Dispel on, like so:

MyActiveEffect.Dispel()
User avatar
carly mcdonough
 
Posts: 3402
Joined: Fri Jul 28, 2006 3:23 am

Post » Mon Jun 18, 2012 2:26 am

As I said, I did try even defining the function within the script and it still complained. I tried importing and parenting ActorBase and Actor as well. None of it worked. I'm very familair with the script you used in past games, but I'm just learning Papyrus now, so I have to guess it was some stupid error I was overlooking. Either way, I've got it working now, so Aela and Illia's transformation abilities are functioning great.

If anyone's interested, they'll be a part of the next update to http://skyrim.nexusmods.com/downloads/file.php?id=7245. I should have the update available soon. I just wanted to test things a bit more first to make sure there's nothing else I missed.
User avatar
celebrity
 
Posts: 3522
Joined: Mon Jul 02, 2007 12:53 pm

Post » Sun Jun 17, 2012 2:59 pm

Hmm… let me see if I can explain better. Apologies for the confusion, I’m not the best at writing documentation/help for non-programmers :)

Papyrus is very “type-oriented”. In programmer terms, it is “strongly-typed”. The best way I can think of to explain it would be that the compiler has a very narrow view of what you can and cannot do with various kinds of objects in the game (also known as “types”).

As an example, think of a car. The “Car” is our “type”. You can tell a “Car” to drive by writing: “Car.Drive()”. But you cannot tell a car to fly, because a car is not an airplane. So “Car.Fly()” doesn’t work. (And would give you the “function doesn’t exist error”)

One thing that can be incredibly useful if you are having trouble with a specific function is to search the other scripts included with the game for the name of the function. So, if you can’t seem to get SetEssential to work, search all the files in “Skyrim/Data/Scripts/Source” for “SetEssential” with your favorite text editor, or even Windows (they’re just text files), which should help you in figuring out what to do differently. Simply extending a different script will most likely make your script not run at all on the object you attached it to (because the game won’t let you run a quest script on an actor, for example), and importing another script is simply shorthand that is mostly useful for global functions.
User avatar
Karen anwyn Green
 
Posts: 3448
Joined: Thu Jun 15, 2006 4:26 pm

Post » Mon Jun 18, 2012 12:32 am

Papyrus is very “type-oriented”. In programmer terms, it is “strongly-typed”.

I think I love you for this.


Well that and the Sublime integration. You guys kick ass.
User avatar
Gen Daley
 
Posts: 3315
Joined: Sat Jul 08, 2006 3:36 pm


Return to V - Skyrim