Session variables

Tutorials and guides for Plazma Burst and community features.

Session variables

Postby mrnat444 » 24 December 2017, 10:54

Recently in a PB2 update, some new actions were added to triggers, these included session variables. It might be a little confusing how session variables work, or how to use them, so I'll explain.


What are session variables?

A session variable is like a normal variable (refer here), except that, unlike normal variables, session variables are independent from a single map, and maintain their values as long as the page life lasts before closing/reloading the page. This means that you can transfer values for variables between maps.


How do you use them?

It's pretty simple. You can first save the value of a session variable from a normal variable, and then on another map (or the same map), load that session variable's value into a normal variable.
Session variables are currently available through three different action types:

1. Image
Clears all the current saved session variables, as if you reloaded the page

2. Image
Saves the value of a normal variable to the value of the session variable
Example: normal variable is named "money" with a value of "4", so the session variable which is used, named "transfer_money", now has a value of "4"

3. Image
Loads the value of the session variable onto a normal variable
Example: Session variable is named "transfer_money" with a value of "4", so the normal variable which is used, named "gold", now has a value of "4" (if this variable had a previous value, it is overwritten)


What are their uses?

Session variables allow for different maps to be tied together, and influence each other (or themselves) in any way you like. Session variable functions and transfers work in singleplayer -> singleplayer, singleplayer -> multiplayer, multiplayer -> singleplayer, and multiplayer -> multiplayer.

If you use session variables in multiplayer, note that the session variables you have saved are exclusive to you. Other players will not get the same session variables unless they took the same steps you did to get your current session variables.


Very important note

When you are using session variables, you need to remember that the session variable is placed in parameter A, while the normal variable is placed in parameter B. The action's names say the opposite, this is a typo.
Hope for the best, yet expect the worst.
User avatar
mrnat444
Usurpation Soldier [50]
 
Posts: 69
Joined: 16 October 2013, 00:51
Location: PB2

Re: Session variables

Postby wreak » 30 December 2017, 07:39

Could you make an open source for this. Also could this in theory work for zooming so some players could have farther viewing range? (I'm trying to make a hostage map and some of the trigger systems I need are somewhat complex)
wreak
User avatar
wreak
Civil Security Boss [500]
 
Posts: 590
Joined: 23 January 2015, 02:01
Location: Just look behind you.

Re: Session variables

Postby darkstar 1 » 1 January 2018, 11:35

wreak wrote:Could you make an open source for this. Also could this in theory work for zooming so some players could have farther viewing range? (I'm trying to make a hostage map and some of the trigger systems I need are somewhat complex)

I think that could work, but there are easier ways without the session variables.
http://www.plazmaburst2.com/?s=2&map=darkstar%201-pixels
User avatar
darkstar 1
Proxy [700]
 
Posts: 784
Joined: 13 September 2014, 13:20
Location: Here... or there :|


Return to Tutorials

Who is online

Users browsing this forum: No registered users