Hello,
I have a large list of static Rooms that are created whent he server boots. Each room has some room variables that are specific to that group. I want to save one of those room variables in permanent storage, however. The idea is that each room has one specific room var that should be kept even whent he server restarts, picking up where it left off. Is the room's room var was "55" when the server shuts down, it should start up, read the value and be "55" again.
The http://docs2x.smartfoxserver.com/AdvancedTopics/room-persistence-api says that there's an error when trying to create persistent room vars with a static room, which is what I run into. I can get the one variable to be saved, but it messes up my initialization code.
What's the best way to set it up so I can save a persistent variable for each static room?
Persistent server variable with static room
Re: Persistent server variable with static room
Hi,
Yes, because when you use Room Persistence you're saving all variables, so you will find your persistent variable back to its value but you will loose the default value for all the others.
I think you should probably save the value of these variables manually, like in a database or local file. Then in your Extension you can handle the SERVER_READY event and load the saved variables and set them for each Room.
To improve our Room Persistence API in the future we could add an extra flag on Room Variables to include/exclude them from the storage.
I'll add a note in our feature TODO list.
Hope it helps
The http://docs2x.smartfoxserver.com/Advanc ... stence-api says that there's an error when trying to create persistent room vars with a static room, which is what I run into. I can get the one variable to be saved, but it messes up my initialization code.
Yes, because when you use Room Persistence you're saving all variables, so you will find your persistent variable back to its value but you will loose the default value for all the others.
I think you should probably save the value of these variables manually, like in a database or local file. Then in your Extension you can handle the SERVER_READY event and load the saved variables and set them for each Room.
To improve our Room Persistence API in the future we could add an extra flag on Room Variables to include/exclude them from the storage.
I'll add a note in our feature TODO list.
Hope it helps
Re: Persistent server variable with static room
Thanks, that helps. I'd really appreciate that feature and will use it as soon as it's available.
Who is online
Users browsing this forum: Majestic-12 [Bot] and 60 guests