Author Topic: Using variables in messages and debriefings  (Read 2542 times)

0 Members and 1 Guest are viewing this topic.

Offline ReeNoiP

  • 27
  • I FRED
Using variables in messages and debriefings
Can you do this?

A simple version of what I'm trying to do is this:
I have a variable score (default 0)

Player destroys a ship->message "Kill score +1"->message "Score is now 1"
Player destroys another ship->message "Kill score +1"->message "Score is now 2"
Player destroys 2 ships within a certain time->message "double kill score +5"->Message "score is now 5"

Say I have a number of ships in a wing: Ship1, ship2...

How would I set up a sexp which repeatedly checks each time a ship is destroyed and sends the correct message? And tjecks the two kill thing.

My guess was something like this:

Code: [Select]
Two variables: score(0) combo(0)
event1
when-argument
any-of
ship1,ship2....
is destroyed
modify variable score=score+1
modify variable combo=combo+1
training message "Kill! score+1)
Training message "Score is now {score}<-the variable

event2
when
is-event-true-delay
"some time"
event1
modify variable combo=0

event 3
when
combo>2
modify variable score=score+3
training message "Double kill score+5)

This way I would only need a few messages to make it work with any number of ships.
Uncharted Territory is released. But I still need voice actors

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Using variables in messages and debriefings
You can use a var in a message by typing $[yourvarname] in the message text (without the brackets).

  

Offline ReeNoiP

  • 27
  • I FRED
Re: Using variables in messages and debriefings
You can use a var in a message by typing $[yourvarname] in the message text (without the brackets).

Excellent.
Uncharted Territory is released. But I still need voice actors

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Using variables in messages and debriefings
Unfortunately there is no way to reference vars in a debriefing without creating additional DB branches.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Using variables in messages and debriefings
Eh?
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Using variables in messages and debriefings
Eh?

Debriefs are totally static, yes? No colored text, no $varname. Correct?

 

Offline TopAce

  • Stalwart contributor
  • 212
  • FREDder, FSWiki editor, and tester
Re: Using variables in messages and debriefings
You can display variables in a debriefing.

« Last Edit: May 10, 2011, 04:10:11 am by TopAce »
My community contributions - Get my campaigns from here.

I already announced my retirement twice, yet here I am. If I bring up that topic again, don't believe a word.

 

Offline Colonol Dekker

  • HLP is my mistress
  • 213
  • Aken Tigh Dekker- you've probably heard me
    • My old squad sub-domain
Re: Using variables in messages and debriefings
That's what i thought.  :nervous: Fred academy at next HLP London right? :yes:
Campaigns I've added my distinctiveness to-
- Blue Planet: Battle Captains
-Battle of Neptune
-Between the Ashes 2
-Blue planet: Age of Aquarius
-FOTG?
-Inferno R1
-Ribos: The aftermath / -Retreat from Deneb
-Sol: A History
-TBP EACW teaser
-Earth Brakiri war
-TBP Fortune Hunters (I think?)
-TBP Relic
-Trancsend (Possibly?)
-Uncharted Territory
-Vassagos Dirge
-War Machine
(Others lost to the mists of time and no discernible audit trail)

Your friendly Orestes tactical controller.

Secret bomb God.
That one time I got permabanned and got to read who was being bitxhy about me :p....
GO GO DEKKER RANGERSSSS!!!!!!!!!!!!!!!!!
President of the Scooby Doo Model Appreciation Society
The only good Zod is a dead Zod
NEWGROUNDS COMEDY GOLD, UPDATED DAILY
http://badges.steamprofile.com/profile/default/steam/76561198011784807.png

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Using variables in messages and debriefings
Awesome.

 

Offline Goober5000

  • HLP Loremaster
  • 214
    • Goober5000 Productions
Re: Using variables in messages and debriefings
Last I recall, colored text is still not available in debriefings though.