Aller au contenu

Photo

Execute another script?


  • Veuillez vous connecter pour répondre
9 réponses à ce sujet

#1
Shard of Truth

Shard of Truth
  • Members
  • 105 messages
Okay, I created a module and worte two scripts for it.
Is it possible to execute the other script inside the first one (which is linked to the module under properties) and if yes, how?

#2
J.O.G

J.O.G
  • Members
  • 355 messages
It really depends on what you intend to do.



You can use the second script as an include in the first one, or use HandleEvent to outsorce the handling of certain events, or use DelayEvent to call the second script more or less independently.

#3
TimelordDC

TimelordDC
  • Members
  • 923 messages
It would help if you could tell what the second script is for.

If it is to handle a particular event, you can just call HandleEvent (, R"") from inside that event block.

Edit: Need to refresh the page before replying :)

Modifié par TimelordDC, 22 décembre 2009 - 02:55 .


#4
Shard of Truth

Shard of Truth
  • Members
  • 105 messages
The reason I wrote two scripts is, that I reached the limit of number of includes in a single file. So the second script is more like a sequel of the first one.



So I just make something like this:

#include "script_2"

and then?




#5
J.O.G

J.O.G
  • Members
  • 355 messages
There is a limit to the number of includes?



Anyway, still not sure what you're asking for.



"Script_2" can only be an include when it doesn't have a function named "main". So you need to rename it if there is one. After that, you call the included function in in the main function of your main script, just like would do with any other function.

#6
FalloutBoy

FalloutBoy
  • Members
  • 580 messages
I guess the answer to the original question is no. What you are trying to do is not going to work the way you want it to. There should never be a need to split a script into two halves unless you are doing something very wrong.

#7
FalloutBoy

FalloutBoy
  • Members
  • 580 messages

Modifié par FalloutBoy, 22 décembre 2009 - 07:23 .


#8
Shard of Truth

Shard of Truth
  • Members
  • 105 messages
It seem you're right FalloutBoy, I can't trick the Toolset. If I include my second script in the first one, the include limit (which seems to be 182 by the way) is also reached.

Hmm, maybe I can find a completely different way to write this script.

Modifié par Shard of Truth, 22 décembre 2009 - 11:53 .


#9
Gocek

Gocek
  • Members
  • 154 messages
Why would you ever want to include 182 scripts? Maybe try merging some of those into one? Group them somehow, dunno. But 182 sounds insane. If DA single player module requires less, then... well - you shouldn't need more ;)

Modifié par Gocek, 23 décembre 2009 - 12:24 .


#10
Shard of Truth

Shard of Truth
  • Members
  • 105 messages
Just to clarifiy this:

I wanted to include many plots from the single player campaign (mostly codex entries). It seemed to be the easiest way to create a working module.