Author Topic: New Scripting Thing  (Read 1209 times)

0 Members and 1 Guest are viewing this topic.

Offline WMCoolmon

  • Purveyor of space crack
  • 213
New Scripting Thing
Working on a new scripting.tbl setup, so that I can keep scripting all in one spot. I call it 'conditional hooks'.

The idea behind it is that you may only want hooks to execute for certain ships, ship classes, types, or on certain missions, (or any combination of the aforementioned) but at the same time, keep all of the scripting in scripting.tbl.

Also, I modified the code to allow for modular scripting tables, since all conditional hooks are additive. See the below example, which demonstrates all the conditions and trigger actions that I've implemented so far.

Yes, this should allow for per-mission scripting with standalone missions (:nervous:)

test-sct.tbm
Code: [Select]
#Conditional Hooks
--Generic mission hook (executes every frame)
$Mission: test
$Hook: []

--Hooks for ship 'Mohawk', in mission 'test', that is of ship class 'Fenris' and type 'Cruiser'
$Mission: test
$Ship: Mohawk
$Ship Class: Fenris
$Ship Type: Cruiser
$On Warpout: []
$On Warpin: []
$On Death: []

--Hook that executes all the time when in-mission
$State: GS_STATE_GAME_PLAY
$Hook: []
#End

http://fs2source.warpcore.org/temp/wmc/conditionalhooks.zip
-C

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: New Scripting Thing
Nice! I think SoL team can find a lot of use for that.. Atleast it makes various currently used rather odd statements useless :p

Also the ship type and ship class options seem very promising ones indeed...
Do not meddle in the affairs of coders for they are soggy and hard to light

  

Online Cobra

  • 212
  • Snake on a Cain
    • Skype
    • Steam
    • Twitter
Re: New Scripting Thing
Nice, if I'm reading that right we don't have to put in a hundred AI-order SEXPs in FRED anymore.
To consider the Earth as the only populated world in infinite space is as absurd as to assert that in an entire field of millet, only one grain will grow. - Metrodorus of Chios
I wept. Mysterious forces beyond my ken had reached into my beautiful mission and energized its pilots with inhuman bomb-firing abilities. I could only imagine the GTVA warriors giving a mighty KIAAIIIIIII shout as they worked their triggers, their biceps bulging with sinew after years of Ivan Drago-esque steroid therapy and weight training. - General Battuta