FOnline Development > Questions and Answers

SDK How to save table in serwer.

(1/1)

dawidsonki:
Hello i have question, how to permament save table with variables in SDK server. Maybe is possible to set gvar/lvar with type parameter to send table as variable, but i dont think so. I need it in many critter scripts to change critter parametrs when critter is not logged in. Do you know how to change critter parametr when critter is not loaded to game (player is offline)? I can get critter ID, critter name but i can get critter as 'critter' to change parametrs etc. Maybe you have some idea how for example add offline player to fraction (change his param) or get list of all fraction players (i think saved table with id's is good idea but i dont know how to do this). Thank you in advance for your help.


@edit
Also it can be how to operate on files in serwer folder, operation like file.open() in scripts is dedicated for files in client folder. If I find out how to do this it will manipulate read/write files to achieve what I needs.

devis:
What you do is create a critter and store your variables onto the critter params via Critter.ParamBase[index] , you get 1000 variables here! Move the critter to worldmap or a safe map and just simply store the critterhandle into a dictionary with the playerId as key. Then you can attach a initCritter script on this datastorage critter to automatically insert itself into the dictionary to maintain the dictionary data permanence between server sessions.

You can also following similiar logic as the critterStorageDeviceâ„¢ with maps. Create a location and then get the map(s). Using the handy map::setData(index, int); You get to store 100 variables here references by Map.Id!

or you could create an boring anydata.

@edit
To access server files with file.open() just use pre-pend to the filepath "../server/" !

Navigation

[0] Message Index

Go to full version