Author Topic: script for specific missions  (Read 2588 times)

0 Members and 1 Guest are viewing this topic.

Offline origin

  • 27
script for specific missions
Sorry if this has been asked before but is there a way to do scripting for a specific mission?

Thanks

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: script for specific missions
Code: [Select]
#Conditional Hooks
$Mission: <missionname>
;; Other hooks go here
#End

I don't have the code with me, but IIRC missionname should be the mission filename with or without the .fs2 extension. If that doesn't work, try the mission name itself.

You can of course use $Mission with any other condition (see http://fs2source.warpcore.org/exes/latest/scripting.html or use -output_scripting)
-C

 

Offline origin

  • 27
Re: script for specific missions
I'm sure I am way off the mark here but what I am trying to do is have script show up on the screen for a cutscene.  I can easily get it to show up but of course it shows up on every HUD in every mission. 
What I want is to have a text show up on one specific mission.  Here is one of my many failed attempts:

#Global Hooks
$HUD:
[

if Mission == "warpin" then

    gr.setColor(255, 255, 255)
    gr.drawString("Entering the Palin System", 450, 650)

end
]
#End


Any help would be appreciated.

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: script for specific missions
Well in that particular example the 'Mission' is the problem as it is not defined as anything (so its has value of 'nil').

Far better way to do it would be to do it like WMC said.. Using scripting modular tables (sct.tbm) and conditional hooks. And then simply toss the stuff inside the HUD. As the script would only work with the defined mission you wouldnt need to insert anything special to the tables.

Other way to do it could be to use for example mn.getMissionFilename() function - like in your example.. just Mission = mn.getMissionFilename(). But imo it would be better to use tbms for these. Also you might want to make sure the text always appears in proper location instead of being in different places in different resolutions.
Do not meddle in the affairs of coders for they are soggy and hard to light

 

Offline origin

  • 27
Re: script for specific missions
 I got the script to run the way I wanted using 'Mission = mn.getMissionFilename()'.   Thanks. 

I'm Knu and did not really understand the method you discussed in your second paragraph, when I tried to "simply toss stuff in the HUD" the stuff just bounced of my computer screen ;).

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: script for specific missions
Well... what i mean is that with multiple scripts it a lot easier to manage a group of tbm based scripts files rather than just trying to get all to fit into a single tbl file.

somethingye-sct.tbm
Code: [Select]
#Conditional Hooks

$Mission: <name of the mission>

$On HUD Draw:

[

gr.setColor(255, 255, 255)
gr.drawString("Entering the Palin System", 450, 650)

]

#End
Do not meddle in the affairs of coders for they are soggy and hard to light

 

Offline origin

  • 27
Re: script for specific missions
Gotcha - Thanks for your patience. :yes: