Author Topic: Detect Mission Replay?  (Read 1847 times)

0 Members and 1 Guest are viewing this topic.

Offline wookieejedi

  • 29
  • Intensify Forward Firepower
Detect Mission Replay?
Is there a way to detect if a mission is being replayed in a campaign? There may not be, as I have not seen anything that would be useful in the scripts or sexps output html files. Just wanted to double check. Thanks!

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Detect Mission Replay?
This is what the stuff I just coded on eternal variables is for (in fact, I literally used exactly that example when discussing it). You'd simply add a persistent variable called something like Your-Campaign-Name-Replay and set it to 1 at the end of the mission. If the player progresses past that mission the variable would be saved to the player file and next time it's played you simply check if the variable is set to 1.

There are ways to do something similar with scripting (simply create a file if the campaign has been played before) and the reason for eternal variables is because there currently is a bug in the player-persistent variables that makes them act like they are eternal (so if you need to test things, you can totally abuse the bug until it gets fixed). You can read more about it on this thread
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline wookieejedi

  • 29
  • Intensify Forward Firepower
Re: Detect Mission Replay?
This is what the stuff I just coded on eternal variables is for (in fact, I literally used exactly that example when discussing it). You'd simply add a persistent variable called something like Your-Campaign-Name-Replay and set it to 1 at the end of the mission. If the player progresses past that mission the variable would be saved to the player file and next time it's played you simply check if the variable is set to 1.

There are ways to do something similar with scripting (simply create a file if the campaign has been played before) and the reason for eternal variables is because there currently is a bug in the player-persistent variables that makes them act like they are eternal (so if you need to test things, you can totally abuse the bug until it gets fixed). You can read more about it on this thread

Ah gotcha. I have been following your progress on that front closely, as I am very excited to play around with the variable modifications. Ah I see how this valuable fix applies to replaying a campaign. Is there also a way to use it to detect if, at the end of a mission, the player hits the 'replay' mission button?

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: Detect Mission Replay?
Is there also a way to use it to detect if, at the end of a mission, the player hits the 'replay' mission button?
Eh... sort of, it would just be indistinguishable from quitting, not accepting the mission outcome, and playing it again later.
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Detect Mission Replay?
If you do this

Player Jumps Out
when
- key-pressed
-- Alt J
- do-nothing

when
- is-event-true-delay
-- Player Jumps Out
-- 3
- modify-variable
-- Player-Maybe-Replaying[0]
-- 1

You pretty much make it certain that the player is replaying from debrief rather than just quitting in the middle of the mission.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline wookieejedi

  • 29
  • Intensify Forward Firepower
Re: Detect Mission Replay?
If you do this

Player Jumps Out
when
- key-pressed
-- Alt J
- do-nothing

when
- is-event-true-delay
-- Player Jumps Out
-- 3
- modify-variable
-- Player-Maybe-Replaying[0]
-- 1

You pretty much make it certain that the player is replaying from debrief rather than just quitting in the middle of the mission.

Cool, that makes sense. Thanks so much!