Please or Register to create posts and topics.

Hi! Portal 2 VScript - Variables

Hi! I've put this question on Steam Forum, but I didn't get any reply.

'm relatively new to modding the source engine, and I was wondering if I can "save and load" variables within .nut files: I want to store an integer, and retrieve it after I not only change the map, but also when I close and open the game.

If I can't save it to a files, can I at least create and use a ConVar?

Thank you in advance

(I'm asking because in the documentation wiki, the variables section of L4D2 (where I read about vscript) vscript is in "TODO ")

Unfortunately, you can't create a ConVar without the original source of the game (which only Valve has), and I don't think you can save and load a variable like that. Try looking at the "counter" feature in an env_global entity.

Falsi sumus crusto!

You cannot store variables without writing to a file. There is no way Valve would let us write to a file through actions in hammer; this is probably unsafe. The only thing I know of that can write to a file within source (no game code) is config.cfg and it will only store client cvars.
Even if you could store your data to a client console parameter, you won't be able to read it.

Also: mapping-help/capturing-the-state-of-a-map-and-reverting-t5918.html

?????????????????????????????TWP Releases | My Workshop

Ok, thank you :D For replies and link :)