Hard Light Productions Forums

Modding, Mission Design, and Coding => The Scripting Workshop => Topic started by: Kusanagi on December 31, 2010, 08:49:29 am

Title: runSEXP()
Post by: Kusanagi on December 31, 2010, 08:49:29 am
Dear gentlemen,

What exactly is the syntax of this command? There are a few things I need to have a script do that are in FRED but not in scripting such as set-object-facing-object and change-iff. I would think that the command takes several arguments such as the name of the SEXP and the other arguments would be handles inserted where they would go in FRED, no? Such as

mn.runSEXP('set-object-facing-object',ship1,ship2)?

I've tried variations of this but it makes FSO freeze, not crash.
Title: Re: runSEXP()
Post by: m!m on December 31, 2010, 08:58:50 am
Code: [Select]
Just use the same syntax as in normal mission files. :)
Look below for an example(but I'm not sure if it will work :nervous:) or you could simply create a mission with the wanted SEXP.
[code=]mn.runSEXP("set-object-facing-object ship1 ship2")
Title: Re: runSEXP()
Post by: Kusanagi on December 31, 2010, 09:19:53 am
That doesn't seem to work, it just crashes. :(

I'd like to be able to input values into the SEXP but I just can't get the damned syntax right for things defined in scripts.
Title: Re: runSEXP()
Post by: zookeeper on December 31, 2010, 12:56:20 pm
Here's some examples:

Code: [Select]
mn.runSEXP("show-subtitle !20! !-40! !writeyoursubtitlehere! !2000!")
Code: [Select]
mn.runSEXP("set-camera-host !" .. tostring(player) .. "!")
Code: [Select]
mn.runSEXP("change-ai-class !None! !Alpha 2!")
What's up with the !'s? No idea. I guess it's just some rather unfortunately undocumented alternative style of quoting that's necessary in this case.
Title: Re: runSEXP()
Post by: Kusanagi on December 31, 2010, 01:16:09 pm
So I was right in assuming everything between each pair of exclamation points is the different arguments in a sexp? awesome.
Title: Re: runSEXP()
Post by: Kusanagi on January 01, 2011, 07:55:42 pm
Ah, figured it out.

The reason the ! is needed is because the sexp commands are strings and would be read as such in the runSEXP command.