Is there a way to start a script from a script?

Post » Tue May 17, 2011 7:58 am

As the title says, is there a command to start a script from a running script?

I could do it of course by attaching the script to a quest and starting/ending the quest but I was wondering if there is a way to do it directly like in Morrowind.
User avatar
Jack Moves
 
Posts: 3367
Joined: Wed Jun 27, 2007 7:51 am

Post » Tue May 17, 2011 12:43 am

You create a global variable. You then set this variable and in the various scripts, you check for the variable to be set to a certain value before executing.

Not sure why you want to do this since the scripts run a bit different than they did in Morrowind.
User avatar
Susan
 
Posts: 3536
Joined: Sun Jun 25, 2006 2:46 am

Post » Sat May 28, 2011 10:25 pm

There are some large pieces of code in my script that are not supposed to be used very often and I was thinking of placing them in another script to make the code more managable :)
User avatar
Blessed DIVA
 
Posts: 3408
Joined: Thu Jul 13, 2006 12:09 am

Post » Sat May 28, 2011 8:45 am

Clever use of tokens is probably what you want and better then having some quest script constantly running in the background looking for variable changes that never gets used.
User avatar
Jessica Raven
 
Posts: 3409
Joined: Thu Dec 21, 2006 4:33 am

Post » Sat May 28, 2011 2:14 pm

It is possible to simulate function and procedure calls in two ways.

Procedures can be simulated by making a scripted spell effect, a spell that use that effect and call it on an actor using http://geck.gamesas.com/index.php/CastImmediateOnSelf.

Functions (and procedures) can be simulated by using a http://cs.elderscrolls.com/constwiki/index.php/User:Haama/FAR. Basicly, you make a scriptable object (such as an armor) and place it in an empty cell as a persistant reference (make sure to give it a custom name). You place a script on the object, where your code is in the http://cs.elderscrolls.com/constwiki/index.php/OnActivate block. If the name of the persistent object is FooFAR, the function can be called by:

FooFAR.Activate player, 1

If you need to send arguments to the function, you can exploit that the object is persistant and let the calling script use:

set FooFAR.someArg to someValue

As the script is run instantaneous, you can load return value(s) by:

set returnValue to FooFAR.someResult

User avatar
Matt Fletcher
 
Posts: 3355
Joined: Mon Sep 24, 2007 3:48 am

Post » Sat May 28, 2011 7:13 pm

It is possible to simulate function and procedure calls in two ways.

Procedures can be simulated by making a scripted spell effect, a spell that use that effect and call it on an actor using http://geck.gamesas.com/index.php/CastImmediateOnSelf.

Functions (and procedures) can be simulated by using a http://cs.elderscrolls.com/constwiki/index.php/User:Haama/FAR. Basicly, you make a scriptable object (such as an armor) and place it in an empty cell as a persistant reference (make sure to give it a custom name). You place a script on the object, where your code is in the http://cs.elderscrolls.com/constwiki/index.php/OnActivate block. If the name of the persistent object is FooFAR, the function can be called by:

FooFAR.Activate player, 1

If you need to send arguments to the function, you can exploit that the object is persistant and let the calling script use:

set FooFAR.someArg to someValue

As the script is run instantaneous, you can load return value(s) by:

set returnValue to FooFAR.someResult



This is exactly what I was looking for! Thanks a lot :celebration:
User avatar
Rozlyn Robinson
 
Posts: 3528
Joined: Wed Jun 21, 2006 1:25 am


Return to Fallout 3