Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: PotzUK on August 27, 2006, 01:24:05 pm

Title: Variable in a debriefing later in a campaign
Post by: PotzUK on August 27, 2006, 01:24:05 pm
I had this working once, but now it doesn't

Mission 1 - Campaign persistant variable $XYZ is set
Mission 2 - Debriefing has $XYZ in the text, but it gets displayed as $Squadron, instead of the variable.

Mission 2 follows Mission 1 in the campaign
Mission 1 has no debriefing
Mission 2 has no briefing

Does anyone have any ideas?  I'm using the lastest CVS build.

Calling the variable within the mission it's set seems to work OK
Title: Re: Variable in a debriefing later in a campaign
Post by: karajorma on August 27, 2006, 03:11:17 pm
Submit it to mantis.

If you make a test campaign that does nothing other than set the variable in mission 1 and outputs it in mission 2 (both in mission and in the debrief) and attach it to the report then I'll almost certainly look at it quickly.

Saving me the bother of writing a test mission displaying odd behaviour makes it almost certain I'll check it more quickly because it drastically reduces the time I need free to start looking into the problem.
Title: Re: Variable in a debriefing later in a campaign
Post by: PotzUK on August 27, 2006, 04:24:41 pm
I would, but I'm not sure how. 

I've created the account, but when I click Submit Issue, the only project I see is Inferno?

I've attached the two missions & campaign to this post, although in these two the variable doesn't seem to work at all in these test files (at least in the build I'm using at the mo).  In the campaign mission I have has  two messages use the $Squadron variable with no problem...

Essentially, in the actual campaign the player can choose their squadron name from 3 options given (by pressing 1, 2 or 3).  An event records the keypress using the key-pressed sexp and modifies the variable accordingly. 





[attachment deleted by admin]
Title: Re: Variable in a debriefing later in a campaign
Post by: karajorma on August 27, 2006, 04:30:49 pm
That's the wrong Mantis. HLP has it's own version for projects but you want the SCP mantis which you can find here (http://scp.indiegames.us/mantis/main_page.php).
Title: Re: Variable in a debriefing later in a campaign
Post by: PotzUK on August 27, 2006, 04:39:08 pm
ahh, you may want to make the tab link @ the top a little clearer, at the mo it's labelled 'HLP Mantis' which is a little mis-leading :) 

I'll plop it up now
Title: Re: Variable in a debriefing later in a campaign
Post by: PotzUK on August 27, 2006, 04:49:14 pm
Just tried to register on the proper Mantis, but I've not yet received the account password via email.  The Inferno one arrived within a few minutes so I know my spam filters aren't getting in the way... I'll check again in the morning - cheers Kara :)
Title: Re: Variable in a debriefing later in a campaign
Post by: karajorma on August 28, 2006, 03:01:18 am
The SCP mantis seems to have a longstanding vendetta against Yahoo and especially against Hotmail. You didn't use either of those to register did you?
Title: Re: Variable in a debriefing later in a campaign
Post by: PotzUK on August 28, 2006, 03:41:04 am
No, I used my own personal email - pyroport.com, the password hasn't arrived though :(
Title: Re: Variable in a debriefing later in a campaign
Post by: karajorma on August 28, 2006, 07:58:03 am
Okay. I checked the mission. This wasn't an SCP bug at all but a misunderstanding in the way variable insertion into messages works on your part. I'm glad I had you build the mission cause otherwise I'd have spent ages trying to figure out what was wrong otherwise :)

Whenever you want to use a variable in a briefing, message or debriefing you put a $ in front of the variable name. This much you got. But what that refers to is only the text of the briefing, message or debriefing. You don't actually name the variable with a dollar sign in the name.

So when you included a message like this "The variable is currently set to $Squadron" the game doesn't find your variable cause it's looking for a variable called Squadron and all you have is a variable called $Squadron. The best thing you can do is rename the variable but updating the message to "The variable is currently set to $$Squadron" would probably work too.


That said this wasn't a complete waste of time. While working on this I uncovered a rather nasty bug that needs investigation :)
Title: Re: Variable in a debriefing later in a campaign
Post by: PotzUK on August 28, 2006, 08:05:17 am
OK, that makes sense :)

But I renamed the actual variable from $Squadron to just Squadron which solved the message variable call, but the following mission still displays $Squadron :(

The variable doesn't have to be 'defined' in the second mission as well does it? 
Title: Re: Variable in a debriefing later in a campaign
Post by: karajorma on August 28, 2006, 08:36:53 am
Yes it does. Squadron and $Squadron are completely different variables as far as the game is concerned. As far as it knows although Squadron exists as a persistent variable it's never used in mission 2 because no variable with that name exists in the mission file.

If you look at the variables in mission 2 you'll notice that at some point you defined $Squadron there too.
Title: Re: Variable in a debriefing later in a campaign
Post by: PotzUK on August 28, 2006, 08:58:28 am
OK, so despite the variable being campaign persistant, I have to 'define' the variable in the second mission... how do I tell the variable for Mission 2 to keep the value that was set previously?
Title: Re: Variable in a debriefing later in a campaign
Post by: karajorma on August 28, 2006, 09:04:55 am
Simply mark the variable as campaign persistant in the second mission too. The game will handle the rest.

I'm kinda surprised you're still having trouble with this in fact. You did it all correctly once before when you made the test campaign. You just simply picked the wrong name for the variable. All that needs to be done is to rename it in both missions.
Title: Re: Variable in a debriefing later in a campaign
Post by: PotzUK on August 28, 2006, 09:17:30 am
Actually, I took a shortcut with the second mission - I just saved the first as under a different filename and forgot to remove the variable :)

That got it.

OK, for anyone reading this topic:

Set Variable mission
Define a variable in the event editor (Don't put a $ on the front of the name!)

Mission where variable is called
Do the same, using the same variable name as before

Call the variable using $VariableName where you need it...