Author Topic: runSEXP()  (Read 1978 times)

0 Members and 1 Guest are viewing this topic.

Offline Kusanagi

  • A man, a van, a plan, Vanama!
  • 27
  • Enemy vessel captured
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.
Cum historia
mutat valde Razgriz
revelat ipsum
primum daemon scelestus est.

 

Offline m!m

  • 211
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")

 

Offline Kusanagi

  • A man, a van, a plan, Vanama!
  • 27
  • Enemy vessel captured
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.
Cum historia
mutat valde Razgriz
revelat ipsum
primum daemon scelestus est.

 

Offline zookeeper

  • *knock knock* Who's there? Poe. Poe who?
  • 210
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.

 

Offline Kusanagi

  • A man, a van, a plan, Vanama!
  • 27
  • Enemy vessel captured
So I was right in assuming everything between each pair of exclamation points is the different arguments in a sexp? awesome.
Cum historia
mutat valde Razgriz
revelat ipsum
primum daemon scelestus est.

 

Offline Kusanagi

  • A man, a van, a plan, Vanama!
  • 27
  • Enemy vessel captured
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.
Cum historia
mutat valde Razgriz
revelat ipsum
primum daemon scelestus est.