Jump to content

Running a script from the console


IWantMyMod

Recommended Posts

  • 4 years later...

You cannot run a papyrus script directly from the console.

 

You can start a quest from the console. Said quest could have a script with code to start running in the OnInit event.

 

Depending upon what you want to do, this may or may not be feasible.

Not to hijack the thread, but just for curiosity, could a general purpose quest be made that would accept a script name at execution, ie a hook into Console that would fire X when called by a quest request? Or am I being wishful/ignorant?

 

EX:

> setstage MySillyQuestForCallingAnyOldScript 10 <User input script name>

Link to comment
Share on other sites

I do not think so. That said, if there is a utility / extension that allows obtaining string data from the console, then something might theoretically be doable. Thinking about the possibility of using console input string data to do something like {scriptname}.{functionname}({parameters}) to run a Form or Game function when the console is closed. SKSE can catch when the console closes with OnMenuClose. But the rest of it, wishful thinking as far as I know.

Link to comment
Share on other sites

You can use modevents to map strings to functions, or even gotoState, but I don't see a way to get a string from the console or how to trigger directly a modevent or a state change.

 

You can trigger various events, and from there run your scripts, but AFAIK the scripts must have been specially prepared for the purpose, and attached to a form of some kind. You can't just call a script from the filename in a string variable... you have to call a function inside the script... with a function name and arguments... and a "self".

 

Here are a few event triggering methods available from the console:

startQuest

startScene

castSpell

placeAtMe

addSpell (to add an ability)

 

Truthfully, in most cases, mod authors create "lesser powers" (a type of spell) to access this type of functionality from the game instead of the console.

 

Using a spell, you can prompt the player for a string (using SkyUI for example), and then map that string to an attached script (using a modevent, gotoState, or just calling an overridden function).

Link to comment
Share on other sites

  • Recently Browsing   0 members

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