We have detected that cookies are not enabled on your browser. Please enable cookies to ensure the proper experience.
Results 1 to 3 of 3

Thread: Server Name

  1. #1

    Server Name

    When running an export script in game, it would be great if we could get the server name that the script was run on. Landroval, Ithil, etc.

    Does SSG still add/update the LUA scope and method definitions?


  2. #2
    Join Date
    Jun 2011
    Posts
    1,403
    What do you mean by an "export script"?
    Thurallor, Warden of Landroval
    Author of plugins: SequenceBars, Reminders, others

  3. #3
    Join Date
    Mar 2007
    Posts
    1,455
    A Turbine.Engine:GetServerName() method would be nice but there are ways around the need for it. One way is to simply create a .plugindata file in the Server scope for each server that contains the server name, then let your plugin read that file - that requires either manually creating the files or writing a simple script to automatically create them but that's not very difficult. Of course, for a distributed plugin, any external application or script becomes a security concern to end users, but if you are asking for a ServerName method I have to assume that is to share the data with an external application anyway, so the whole security risk question is moot, so having the external application create the server name plugindata files should be sufficient.

    I believe he may be using the Turbine.Engine:ScriptLog() method to output to the script.log text file instead of saving data via the .plugindata files - I have done the same to make using the output simpler at times, for instance I dump the grid data from my map making plugin to the script log as a Lua table definition that I then simply copy and paste to the grid.lua file for TerrainMap. This is particularly handy when dealing with large tables since you can format the script.log to have one or more entries per line where the .plugindata files take several lines for most entries. Since the limit that you run into when reading the data back in is based on the number of lines in the file (I believe it is 2^18 lines) you can generally read much more data from a .lua file than from a .plugindata file. The drawbacks are that the scriptlog doesn't get flushed to disk right away so output can be delayed slightly (not as long as normal plugindata saves but there's an easy way around that) and you have no way of tracking server identity (with plugindata files the AllCharacter and Character scoped files are saved under a folder with the servername which fixes that). Third, all script errors share the same file so it's possible to get other stuff mixed in with your output. Fourth, the file gets wiped and recreated each time the client starts. This works fine for a manual process but is a bit messy for an automated process.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

This form's session has expired. You need to reload the page.

Reload