Forum Archive. A read-only snapshot of the Warfare Incorporated forums (2003–2020), preserved for historical purposes.  ·  warfareincorporated.com
Warfare Incorporated Forum

How to remove Persistent Variables?
Author Message
ajcross
Very Active User


Joined: 23 Dec 2003
Posts: 113
Location: Kansas City
 Post Posted: Fri May 07, 2004 1:35 pm  Post subject: How to remove Persistent Variables?

How are persistent variables deleted from memory?

Is it done by setting these to "-1" or the empty string ""?
crakerz
Mega-Poster


Joined: 17 Sep 2003
Posts: 353
Location: California Bay Area
 Post Posted: Fri May 07, 2004 2:04 pm  

I know you can set pvars to negative values, so the "-1" wouldn't work, and you can set them to a null string, so "" won't work. Actually, once they are created, I believe they are there to stay, until you exit the game.

Why would you want to?
ajcross
Very Active User


Joined: 23 Dec 2003
Posts: 113
Location: Kansas City
 Post Posted: Fri May 07, 2004 2:57 pm  

I thought that they were getting saved when the game was saved. I don't want to accidentally overflow that area.

I also want some variables to reset between missions.
crakerz
Mega-Poster


Joined: 17 Sep 2003
Posts: 353
Location: California Bay Area
 Post Posted: Fri May 07, 2004 5:30 pm  

You need to reset them yourself. When a pvar is modified for the first time, it is "declared" and given a value of zero before the add/subtract. If you use the set pvar text to text action, then it is given that value.

I always "declare" my pvars at the beginning of a mission, esp. to avoid the ?pvar? error. If you want to use pvars between levels, and don't want values carried over, then set them at the start.
PhillipEarl
Mega-Poster


Joined: 12 Jan 2004
Posts: 329
Location: Charlotte, NC
 Post Posted: Sat May 08, 2004 6:06 am  

ajcross wrote:
I thought that they were getting saved when the game was saved.


So if I were using pvars to, say, keep track of how many Rocket Troopers the player owns, and the player saves the game and exits the mission, will the pvar be preserved when the player reloads the mission?
scottlu
WI Founder


Joined: 15 Aug 2003
Posts: 1773
 Post Posted: Sat May 08, 2004 5:47 pm  

PhillipEarl wrote:
ajcross wrote:
I thought that they were getting saved when the game was saved.


So if I were using pvars to, say, keep track of how many Rocket Troopers the player owns, and the player saves the game and exits the mission, will the pvar be preserved when the player reloads the mission?


Yes it will.