Jump to content

Scripting: When to Use “Import Game� Et. Al?


Recommended Posts

Just curious when Import Game is necessary or useful when scripting. Also curious about when to use Import Utility and Import Math. Also, are there others that can can be imported?

 

Edit: Iâm asking about scripting for Skyrim SE. :)

Edited by sp0ckrates
Link to comment
Share on other sites

That's simply so you can do:

Wait(847.0)

instead of

Utility.Wait(847.0)

in your script. Convenience basically, afaik there's zero difference in the compiled script, if you use many global functions from one script, say math, utility, etc (any really) then you can import it so you don't have to type it everytime.

Link to comment
Share on other sites

That's simply so you can do:

Wait(847.0)
instead ofÂ
Utility.Wait(847.0)
in your script. Convenience basically, afaik there's zero difference in the compiled script, if you use many global functions from one script, say math, utility, etc (any really) then you can import it so you don't have to type it everytime.

Got it! Thanks!

Link to comment
Share on other sites

Yeah, as far as I know, that's all.

For future reference, papyrus questions fit more in the appropiate game-specific thread, i.e: https://forums.nexusmods.com/index.php?/forum/3930-skyrim-creation-kit-and-modders/ or https://forums.nexusmods.com/index.php?/forum/4070-skyrim-special-edition-creation-kit-and-modders/

Edited by FrankFamily
Link to comment
Share on other sites

They are useful when you know you're going to be using a lot of functions that are defined in a certain script.

 

Import Math when you know you gonna need to type a lot of math functions.

 

If you made a script that extends no other scripts, and it contains global functions, you can import that script in another script when you don't want to prefix the function

with scriptname.Function.

 

Basically they just save a little time on typing. This is similar to the concept that C++ has(but the C++ version is much more powerful and can be dangerous if used improperly. Importing in papyrus doesn't appear to have this drawback).

Edited by Rasikko
Link to comment
Share on other sites

They are useful when you know you're going to be using a lot of functions that are defined in a certain script.

Â

Import Math when you know you gonna need to type a lot of math functions.

Â

If you made a script that extends no other scripts, and it contains global functions, you can import that script in another script when you don't want to prefix the function

with scriptname.Function.

Â

Basically they just save a little time on typing. This is similar to the concept that C++ has(but the C++ version is much more powerful and can be dangerous if used improperly. Importing in papyrus doesn't appear to have this drawback).

Thank you!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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