Hard Light Productions Forums
Modding, Mission Design, and Coding => The Scripting Workshop => Topic started by: General Battuta on June 09, 2016, 12:50:43 pm
-
Scripts are good because they are very easy to call from multiple missions. Scripts are tricky because you can't customize their behavior on a per-mission/per-ship basis like you can with SEXP chains.
-
(http://i63.tinypic.com/flhbhv.jpg)
-
Scripts are good because they are very easy to call from multiple missions. Scripts are tricky because you can't customize their behavior on a per-mission/per-ship basis like you can with SEXP chains.
I'd disagree with that. A script can be as simple or complex as you like it. If you construct it in a well thought out generic way it can be just as versatile as a sexp.
-
It's hard to build a script that talks to SEXP logic. It's easy to use complex events to call scripts, but hard to build scripts that work with complex events, right?
I'm thinking about **** like "send a message from the most angry character if the mission time is between 30 and 90 seconds and ship B has been destroyed using gun X and then this ability is triggered." I know how to do that trivially with event logic. I feel like a script would be uselessly cluttered up by adding all those conditions.
In my head scripts are good because they're fast, general, and powerful.
-
SCRIPT ALL THE THINGS!
(Only event in .fs2 is script-eval "missiongo"
-
It really depends what you're trying to do. You could make (with a lot of effort) a procedural message system where your wingman will automatically report important ships dying, or how they just slagged Aries 4 with their Slammers.
The key I find when wondering if I should sexp or script it is ask, "Will it save me time in the future?".
mjn: That's basically what my Visual Novel missions look like in JAD now. :p
-
I'm thinking about **** like "send a message from the most angry character if the mission time is between 30 and 90 seconds and ship B has been destroyed using gun X and then this ability is triggered." I know how to do that trivially with event logic. I feel like a script would be uselessly cluttered up by adding all those conditions.
So do it in event logic; scripts can add functions that return numbers and then script-eval-num lets you insert them into your event conditionals; it's just a matter of making sure that you have good ways of communicating your state back to the SEXP engine.
-
I split the topic since this is gone off into another direction!
-
I'm thinking about **** like "send a message from the most angry character if the mission time is between 30 and 90 seconds and ship B has been destroyed using gun X and then this ability is triggered." I know how to do that trivially with event logic. I feel like a script would be uselessly cluttered up by adding all those conditions.
You need a "rage" counter of some sort in both the sexp and scripted version, which could be an argument construction using sexps or a loop through some fixed lists in scripting. 30 - 90 seconds is a simple condition in both versions and the ship B destroyed by gun x seems also pretty similar (again some argument list stuff for sexps, an on hit check for gun x and a follow up check if target B is now dead for scripting). I feel like the effort is not that much different...
So most cases boil down to:
The key I find when wondering if I should sexp or script it is ask, "Will it save me time in the future?".
Or: Is it easier for me to sexp it or script it? And do I need a generic version for other missions where simple sexp copy/paste won't be possible?
Also for anything based on generic scripts sexp-variables can be easily used to transport information between sexps and scripts. They can trigger or modify scripts without actual script-eval calls or provide data that is needed in a sexp event.