Jump to content

akActionRef definition: is there a place I can find official definitions?


09jlardinois

Recommended Posts

Hi all,

 

I know what akActionRef does and how to use it, but I can't seem to find the official definition on the Papyrus help section of the Creation Kit wiki, or through Google.

 

Is there a good resource for finding official definitions of these things?

  • What's the "ak" stand for?
  • And why is it Action Reference and not Object Reference (generically)? (See below)
  • Is ActionRef only for objects that can be activated?
  • Or does ActionRef refer to the actual activator element itself?

 

 

For example, does akActionRef point to the specific activator element of the code of the respective ObjectReference,

or does akActionRef just generically refer to an activatable object?

 

I know this question is maybe unnecessary, but I'm a veteran coder in many other languages, so I take things like this very seriously. It helps one understand the technical limitations of a parameter like ObjectReference and its corresponding argument on a more fundamental, logical level. It lets you instantly recognized what can and can't be done with an argument.

 

Thanks for your help and expertise,

-John

Link to comment
Share on other sites

So, for example the OnActivate event:

Event OnActivate(ObjectReference akActionRef)

Afaik, you could actually name it whatever you want

Event OnActivate(ObjectReference DudeThatActivatedThisReference)

should work as well.

 

That argument will point in this case to the reference of the actor that activated the reference this script is running in so you can use that reference within the event.

 

Ak is the naming convention they use, a is for argument I think, so ab for booleans, ai for integers, as for strings, af for float. K seems to be used for all forms and references, everything that isn't a literal I think it's the proper term, I'm not a programmer though.

 

Not sure if this answers your question. Also, this might be useful: https://www.creationkit.com/index.php?title=Category:Papyrus

Edited by FrankFamily
Link to comment
Share on other sites

Thank you! That didn't fully answer my question, but you got me in the right direction. Knowing the 'ak' helps a lot.

 

But, yes, you can name the akActionRef anything on function call. But knowing how the language refers to itself helps understand specifically what the parameter is referring to, and your explanation of 'ak' helped me figure that out.

 

So being an "action reference" of a form, I think it goes like this.

 

In many OOP languages, you can make a function inside of a file or class (depending on the language) that is global. Then, you can also make a function that is local to that class. And then, when you extend a class, you can overload that function and make a version specific to the child class.

 

So I think, in this case, akActionRef is referring to the overloaded OnActivate( ) function (the 'action', so to speak) found inside the object class in question, which is a child of object reference class. So, for instance, if the script was on a door, akActionRef would not be referring to OnActivate's return value, but rather the OnActivate return value that is unique and specific to the Door class, extended from xyz.

 

So thank you. Your answer helped me come to the conclusion.

 

so 'ak' is just prefix notation (that a lot of programmer hate, but I personally love) and ActionRef is just referring to the overloaded function. Sort of a function:thisoverloadedfunction( ) kind of thing. Not sure what the C# or Java equivalent would be. Can't remember much of C++ and I'm currently only working in Python, C, and Lua. But I'm sure there's an equivalent in those languages.

Link to comment
Share on other sites

akActionRef is a variable, not a function. It doesn't "do" anything. It gets passed in when the event is triggered, in case the Event code needs to know what ObjectReference caused it to trigger. For example, if an NPC pulls a lever and causes the lever's OnActivate event to fire, it will be set to the (FormId of) the NPC.

 

Don't try to carry over your knowledge of OOP to Papyrus, it will lead you astray.

Link to comment
Share on other sites

Simplest terms: akActionRef is the thing that the event is expecting to activate it.

 

Same with OnTriggerEnter/Leave where akActionRef is the thing the event(s) is expecting to trigger it.

 

And I agree with OldMansBeards' last bit. Papyrus was created from C++ but a lot of cool stuff related to OOP is.."missing". Still it helps a lot to think of everything in the game that isn't numbers as exactly what they are: objects.

Link to comment
Share on other sites

What really gets many experienced OOP programmers in trouble is that Papyrus is designed to give the actual game objects (NPCs, Quests, Containers, Weapons, etc.) additional behaviors not to represent those objects completely (or to solve arbitrary programming tasks). Papyrus scripts don't have a life of their own, so (ignoring global scripts like Game, Utility, etc.) the only way to instantiate a script is to create some object in the game world which has the script attached. If you keep in mind that you're extending objects created by someone else who made most of those object implementations private and hidden, you can use much of your OOP knowledge and simply rail against the fact that so much of the object is hidden away.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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