![]() |
Storing with serverr.
I was reading through Fowlplay4's scripting guide and I suddenly decided to make a simple script that stores text on the server, safe from updating a level. I read through the forums and found that the use of serverr to store data was a favored method, so I studied some more on the wiki and decided to go and make a simple GUI interface consisting of a MuliLineTextEditCtrl an a Window. All it does is read from the serverr and displays the text in the multiline. Here is what I have.
PHP Code:
Does the serverr have to be on the serverside to store the data? |
It's possible that serverr vars haven't been synced to the clientside yet when that script runs.
|
A serverr.var is read-only on the clientside. You need to set it on the serverside.
I'm not sure it's a good idea to store something like server news (which is only needed on demand) in a variable that is synced with every client. You also have the problem of strings being chopped to 255 characters if a staff member manually edits the flags from RC. serverr variables are good when a small amount of data is needed frequently on every client. Such as storing the current state of a weather system. |
As Sales said, you have to set serverr variables on serverside. If they could be set clientside, a "hacker" would be able to change the news for everybody.
The reason it works until you reconnect is that you're temporarily changing the serverr variable on your client only. When you reconnect, the server sends the actual variable. It's like setting a clientr variable on clientside. The value will stick (at least for a while?), but you won't have actually changed the variable on serverside. Also, RC will trim any server flags down to a certain size (~255 characters?), so if you set server flags with RC, you'll permanently lose anything past that many characters. You should probably use text files instead of serverr variables for storing server news. There are very few times when server or serverr variables are advisable. |
On Zodiac I use text files, and onLevelFileUpdated() to allow people to edit the news.
When the news text file is updated, I store an updated copy in Control NPC. I.e: PHP Code:
|
I always thought onLevelFileUpdated was only for files downloadable in game by the client, having seen that and confirmed that it does indeed work for any file uploaded this is going to make life a lot easier for certain things I wanted to make.
The more you know :). |
| All times are GMT +2. The time now is 09:52 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.