Author Topic: Some help for testing the missions...  (Read 1923 times)

0 Members and 1 Guest are viewing this topic.

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Some help for testing the missions...
With trunk builds post 4687 revision you can use the following script. It might help a bit with the mission testing. Only SP though...

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

$State: GS_STATE_MAIN_MENU

$On Frame:

[

-- get mouse and frametime
x = io.getMouseX()
y = io.getMouseY()
time_dif = ba.getFrametime()

-- init the stuff
if init == nil then
   -- limits for the replay box
   -- br defines the border between the briefing and briefingless links
   x_min_replay = 0.325 * gr.getScreenWidth()
   x_max_replay = 0.425 * gr.getScreenWidth()
   y_min_replay = 0.05 * gr.getScreenHeight()
   y_max_replay = 0.125 * gr.getScreenHeight()
   y_br_replay = 0.1 * gr.getScreenHeight()
   -- limits for the play defined mission
   x_min_defined = 0.325 * gr.getScreenWidth()
   x_max_defined = 0.425 * gr.getScreenWidth()
   y_min_defined = 0.2 * gr.getScreenHeight()
   y_max_defined = 0.275 * gr.getScreenHeight()
   y_br_defined = 0.25 * gr.getScreenHeight()
   -- inits
   init = 42
   timepress = 0
   timestamp = 0
   -- !!define the name of the mission here!!
   missionname = "SM1-01"
end

-- increment the time
timestamp = timestamp + time_dif

-- Draw boxes - replay
gr.setColor(155, 20, 20, 150)
gr.drawRectangle(x_min_replay, y_min_replay, x_max_replay, y_br_replay, true)
gr.setColor(75, 0, 0, 150)
gr.drawRectangle(x_min_replay, y_br_replay, x_max_replay, y_max_replay, true)
gr.setColor(255, 100, 100)
gr.drawRectangle(x_min_replay+1, y_min_replay+1, x_max_replay-1, y_max_replay-1, false)

-- Draw boxes - defined
gr.setColor(20, 155, 20, 150)
gr.drawRectangle(x_min_defined, y_min_defined, x_max_defined, y_br_defined, true)
gr.setColor(0, 75, 0, 150)
gr.drawRectangle(x_min_defined, y_br_defined, x_max_defined, y_max_defined, true)
gr.setColor(100, 255, 100)
gr.drawRectangle(x_min_defined+1, y_min_defined+1, x_max_defined-1, y_max_defined-1, false)

gr.setColor(255,255,255)
gr.drawString("Replay the mission", x_min_replay+5, y_min_replay+5, x_max_replay-5, y_br_replay-5)
gr.drawString("No briefing", x_min_replay+5, y_br_replay, x_max_replay-5, y_max_replay)
gr.drawString("Play the " .. missionname .. " mission", x_min_defined+5, y_min_defined+5, x_max_defined-5, y_br_defined-5)
gr.drawString("No briefing", x_min_defined+5, y_br_defined, x_max_defined-5, y_max_defined)

-- assuming there is long enough gap between clicks...
if (timestamp >= timepress) then
   -- and that mouse cursor is within the box
   if ( (y > y_min_defined ) and (y < y_br_defined) and (x > x_min_defined) and (x < x_max_defined) ) then
      -- and that left mouse button is pressed
      if (io.isMouseButtonDown(MOUSE_LEFT_BUTTON) == true) then
         -- do things
         timepress = timestamp + 0.5
         mn.startMission(missionname)
      end
   end
   if ( (y > y_br_defined ) and (y < y_max_defined) and (x > x_min_defined) and (x < x_max_defined) ) then
      -- and that left mouse button is pressed
      if (io.isMouseButtonDown(MOUSE_LEFT_BUTTON) == true) then
         -- do things
         timepress = timestamp + 0.5
         mn.startMission(missionname, false)
      end
   end
   if ( (y > y_min_replay ) and (y < y_br_replay) and (x > x_min_replay) and (x < x_max_replay) ) then
      -- and that left mouse button is pressed
      if (io.isMouseButtonDown(MOUSE_LEFT_BUTTON) == true) then
         -- do things
         timepress = timestamp + 0.5
         mn.startMission(MISSION_REPEAT)
      end
   end
   if ( (y > y_br_replay ) and (y < y_max_replay) and (x > x_min_replay) and (x < x_max_replay) ) then
      -- and that left mouse button is pressed
      if (io.isMouseButtonDown(MOUSE_LEFT_BUTTON) == true) then
         -- do things
         timepress = timestamp + 0.5
         mn.startMission(MISSION_REPEAT, false)
      end
   end
end

]

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

 

Offline Mobius

  • Back where he started
  • 213
  • Porto l'azzurro Dolce Stil Novo nella fantascienza
    • Skype
    • Twitter
    • The Lightblue Ribbon | Cultural Project
Re: Some help for testing the missions...
Hey, do you mind telling us something about the utility of this new feature? :)
The Lightblue Ribbon

Inferno: Nostos - Alliance
Series Resurrecta: {{FS Wiki Portal}} -  Gehenna's Gate - The Spirit of Ptah - Serendipity (WIP) - <REDACTED> (WIP)
FreeSpace Campaign Restoration Project
A tribute to FreeSpace in my book: Riflessioni dall'Infinito
My interviews: [ 1 ] - [ 2 ] - [ 3 ]

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: Some help for testing the missions...
It creates two boxes to the main hall  (actually four...). Clicking one of these boxes causes game to start the last played mission (the one which says replay) or doing the same while bypassing the briefing stages by clicking in the darker area. So while testing missions there is no real need to go through every single step but you can skip most of them...

from:
main hall -> tech room -> simulator room -> command briefing(s) -> briefing(s) ( -> ship select -> loadout ) -> start mission
to (either of):
main hall -> command briefing(s) -> briefing(s) ( -> ship select -> loadout ) -> start mission
main hall -> start mission


Which might ease the pain while testing features or missions.



The other option instaplays the mission explicitly defined in the tbm file
Code: [Select]
   -- !!define the name of the mission here!!
   missionname = "SM1-01"
where the "SM1-01" is the filename of the mission which will be loaded when the other new box is clicked. Again the darker side of the box jumps directly into the mission while the brighter side allows for going through the briefing stages as well.
Do not meddle in the affairs of coders for they are soggy and hard to light

  

Offline Mobius

  • Back where he started
  • 213
  • Porto l'azzurro Dolce Stil Novo nella fantascienza
    • Skype
    • Twitter
    • The Lightblue Ribbon | Cultural Project
Re: Some help for testing the missions...
Sounds interesting :yes:

Do you mind providing me a link to a build that is compatible with this new feature? I always get lost :doubt:
The Lightblue Ribbon

Inferno: Nostos - Alliance
Series Resurrecta: {{FS Wiki Portal}} -  Gehenna's Gate - The Spirit of Ptah - Serendipity (WIP) - <REDACTED> (WIP)
FreeSpace Campaign Restoration Project
A tribute to FreeSpace in my book: Riflessioni dall'Infinito
My interviews: [ 1 ] - [ 2 ] - [ 3 ]