Jump to content

Papyrus: New Features


Recommended Posts

Posted

So, since Creation Kit is now in open beta, let's talk about our shiny new toy. My expertise lies in programming, therefore I will give you a short overview about the new stuff found in Papyrus.

 

Structs:

We now can create structs. Unfortunately they are one-dimensional, so no nested structs, or arrays in structs. But the great thing about structs is that they live on the heap. You can do call by reference with them, which is quite handy.

 

Arrays:

We now not only can create arrays of variable size, we also can dynamically grow and shrink them at runtime.

 

Maps:

There isn't a real map type, but with the handy function findStruct() you can use a struct array to simulate a map.

 

Custom Events:

You can define events for your custom classes. Unlike SKSE custom events they are not global but scoped to a script reference, and they survive a reload.

 

Remote Events:

There is no need anymore for attaching scripts to quest aliase just to be able to listen to an event. You can now listen to remote events.

 

Timers:

RegisterForUpdate/OnUpdate has been replaced by startTimer/OnTimer, which allows you to run several different timers at the same time.

 

In total, Fallout 4 is much more stable. There are no missing events, no mysteriously dispelled effects or abilities not re-starting after you've crossed a cell boundary. We now even have OnEquipped/OnUnequipped events when we equip/unequip stuff with scripts.

Posted

I will add, as major feature, the ability to call a papyrus function from the Console: "CallFunction".

But right now it is obscure how to handle parameters of the function.

 

This will be pretty handy to debug complex scripts, without the tricks done for Skyrim like registering for keys, adding debug spells, etc.

Posted

I will add, as major feature, the ability to call a papyrus function from the Console: "CallFunction".

But right now it is obscure how to handle parameters of the function.

 

This will be pretty handy to debug complex scripts, without the tricks done for Skyrim like registering for keys, adding debug spells, etc.

"CallFunctionNoWait" is also very handy for creating new threads.

Posted

 

"CallFunctionNoWait" is also very handy for creating new threads.

 

 

Correct but risky.

This function will spawn a parallel execution of the function. Without waiting for the "return" call.

 

If used in the correct way, being sure you are not spawning tons on unnecessary thread, it can lead to new opportunities.

But it lacks for thread synchronization feature (lock, unlock, etc.) so it will be painful to do good parallel synchronized scripting.

Posted

There's still an incredibly stupid 128 element limit on arrays, which means we get to wait for a mod like JContainers again to be able to make frameworks easily.

Posted

I wonder if it would ever be possible for the F4SE team to add NVSE-style Array_Vars, they were so incredibly flexible by comparison to the standard papyrus arrays, I've never heard anything about it but I can dream.  

 

I'm trying to write a framework right now but my first preliminary design is using multiple array of structs, each record with a unique identifier string holding a reference to the array it's stored in so I can fake multidimensional arrays using relational variables.  It's far more complicated than it needs to be, I don't want to contemplate the overhead costs.  

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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