Jump to content

How to call scripts from within scripts?


Graxster

Recommended Posts

This has been driving me crazy. I've seen scripts that call other scripts from within scripts. For example: Script 1 is named "CoolArmor". In a different script I can see something along the lines of:

 

if such and such

call CoolArmor

endif

 

Yet every time I attempt this I get "could not parse user function" or "expected user function" error(s). I also would like to know how to use the "call" command (or whatever command) to call a script from a quest's "Result Script" window. Thanks!

Link to comment
Share on other sites

This has been driving me crazy. I've seen scripts that call other scripts from within scripts. For example: Script 1 is named "CoolArmor". In a different script I can see something along the lines of:

 

if such and such

call CoolArmor

endif

 

Yet every time I attempt this I get "could not parse user function" or "expected user function" error(s). I also would like to know how to use the "call" command (or whatever command) to call a script from a quest's "Result Script" window. Thanks!

 

Doing it without OBSE is a bit of a pain, but certainly possible

 

Put the script code you want into the OnActivate section of a script, such as:

 

begin OnActivate
   do_something
end

 

Attach this script to something like a book or scroll with a persistant reference, and place it in a new interior worldspace. I place it into a room so I can easilly orient myself and find the scripts I am looking for, but - whatever works for you...

 

Now when you want to call the script, move it to you, activate it, and then send it back to the room

 

BookRef.moveto player
BookRef.activate player 1
Bookref.moveto MarkerRefInHiddenRoom

 

(You have to move it to you, as the onActivate just doesn't work if you do it when it is in a different cell. However it doesn't become visible to the player, as it is sent back before the next frame renders).

 

It is a bit clunky, but works.

Link to comment
Share on other sites

Doing it without OBSE is a bit of a pain, but certainly possible

 

Nice idea, but why should someone want to do that? If you are at a point where you need functions, you won't work without all the other anemities, like flow control, arrays, strings, and, and, and, ... And its so easy to use, you hardly recognize it's there.

Link to comment
Share on other sites

(You have to move it to you, as the onActivate just doesn't work if you do it when it is in a different cell. However it doesn't become visible to the player, as it is sent back before the next frame renders).

 

Double check that.

 

Activate works on persistent references, wherever they may be.

 

In my old mods, before OBSE User Functions, I used to have a cell that looked like a warehouse out of an Indiana Jones movie, full of crates placed there just to hold callable scripts. Never moved a single one.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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