Fortress Forever

Go Back   Fortress Forever > Editing > Mapping > Lua

Reply
 
Thread Tools Display Modes
Old 06-23-2013, 12:36 PM   #1
ddm999
worst ff player eu
 
Join Date: Jun 2012
Location: South Yorks., England
Class/Position: o - no, d - scout
Gametype: IvDZ
Posts Rated Helpful 18 Times
Does the FF Lua script support read/write?

I tried using various methods of opening files in the Lua script, but seen as there's about 5 different methods of doing it in different programs using Lua, it's probably better to just ask.

If there is file support, what are the commands, and if there isn't, will we ever see it exist?

If it existed, it'd mean that Lua scripts can actually permanently save settings and the like, rather than them resetting to defaults every map change. :P

Making plugins would be much more viable with an easier way of changing settings in a file, as well as the ability for stuff to be changed in-game.

A few examples:
  • Showing player statistics.
  • Showing custom welcome messages if a player hasn't played on the server before.
  • Setting players listed in a file as 'admin' and allowing them access to more commands.
  • Easier for server admins to change settings out-of-game with a simple text file.
  • Custom variables not used by the game itself, but by the Lua script (say, a custom .cfg containing variables used to alter gameplay).
  • All server plugins able to be converted to Lua, making them easier to update, change, be make specific for a server.

Overall, adding file support gives the Lua script almost the same amount of flexibility as the actual game's code itself.
__________________
gg ff not ded
ff very much alive
ddm999 is offline   Reply With Quote


Old 06-24-2013, 05:33 AM   #2
squeek.
Stuff Do-er
Lua Team
Wiki Team
Fortress Forever Staff
 
squeek.'s Avatar
 
Join Date: Mar 2007
Location: Northern California
Class/Position: Rallygun Shooter
Gametype: Conc tag (you just wait)
Affiliations: Mustache Brigade
Posts Rated Helpful 352 Times
Send a message via AIM to squeek.
I actually added this in 2.44 but no one's used it yet afaik.

Quote:
Originally Posted by 2.44 changelog
  • Added a way to persist Lua data across level changes
    • Functions added:
      • SaveMapData( luaobject ) // saves to maps/data/<mapname>.luadat
      • SaveMapData( luaobject, suffix ) // saves to maps/data/<mapname>_<suffix>.luadat
      • LoadMapData() // returns the loaded lua object from maps/data/<mapname>.luadat
      • LoadMapData( suffix ) // returns the loaded lua object from maps/data/<mapname>_<suffix>.luadat
      • SaveGlobalData( luaobject ) // saves to maps/data/global/global.luadat
      • SaveGlobalData( luaobject, suffix ) // saves to maps/data/global/global_<suffix>.luadat
      • LoadGlobalData() // returns the loaded lua object from maps/data/global/global.luadat
      • LoadGlobalData( suffix ) // returns the loaded lua object from maps/data/global/global_<suffix>.luadat
  • The suffix param gets stripped of all non-alphanumeric and non-underscore characters. The lua object is serialized into binary.
  • Only strings, numbers, booleans, and tables are able to be saved. All other object types are ignored for now (player objects/lua functions for example).
It serializes the table and saves it as binary, so you can't really edit the .luadat file with a text editor, though.
__________________
#FF.Pickup ยค Fortress-Forever pickups

My Non-official Maps
Released FF_DM_Squeek - FF_2Mesa3_Classic - FF_Siege_Classic
Beta FF_Myth - FF_Redlight_Greenlight

Sick of the people on the internet, always moanin'. They just moan.
- Karl Pilkington
squeek. is offline   Reply With Quote


Old 06-24-2013, 03:32 PM   #3
ddm999
worst ff player eu
 
Join Date: Jun 2012
Location: South Yorks., England
Class/Position: o - no, d - scout
Gametype: IvDZ
Posts Rated Helpful 18 Times
That's really quite awesome.

Sucks that it's not easily editable like a .cfg though.
But it's easy enough to add chat commands to allow admins to change options, etc.

(why do i always look for things on the wiki and think its updated when it never is :P)

(now to add it to the wiki so next time i search for it its there)

http://www.fortress-forever.com/wiki...ving_functions

__________________
gg ff not ded
ff very much alive
ddm999 is offline   Reply With Quote


Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:54 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.