Visibility is a great feature in TTS but the problem is that visibility is not saved with game saves. This is especially detrimental if you are using TTS for RPG games where your TTS game consists of a large dungeon.

I found that I did not like the TTS Fog Of War (FoW) because when my characters came close to dungeon walls, the TTS FoW revealed content behind the wall. So as an alternative I decided to make all of my dungeon content invisible to all players except Black (host/GM) and then I wrote a little GM macro that makes all selected objects visible. As the players explore the dungeon the GM can select all of the tiles that make up the room or less (for example if the characters have limited light source) and make them visible. In this way the GM can ensure that tiles on the other side of walls are not revealed.

The problem with this solution was that visibility of objects is not stored in a save game. Thus when an incomplete RPG session is save and later loaded, all the contents become visible and the GM has to re-hide them. This can be a problem especially when continuing a session because the GM needs to hide everything that has not yet been explored but keep revealed everything that has been revealed.

To overcome this problem I wrote two functions (hide and show) which I use to hide and reveal all the dungeon content. The GM macro function just calls show on each selected object. Within these function, besides hiding or showing the object, the functions also add or remove the word hidden from the description. Since descriptions are stored in a save game, this allows the visibility state to be preserved in a save game. Now it is just a matter of adding a loop, on load, to re-hide any objects with hidden in the description.

Re-hide code on startup...
Code:
function onLoad()
  local objs = getAllObjects()
  for i,obj in pairs(objs) do
    if (string.find(obj.getDescription(),"Hidden")) then
	      hide(obj)
    end
  end
end
Code to perform a object hide...
Code:
function hide(obj)
  obj.setInvisibleTo({"White", "Brown", "Red", "Orange", "Yellow", "Green", "Teal", "Blue", "Purple", "Pink", "Grey" })  
  printToAll(obj.name .. " disappears from view.")
  local desc = obj.getDescription()
  desc = desc:gsub(",Hidden","")
  desc = desc .. ",Hidden"
  obj.setDescription(desc)
end
Code to perform a object show...
Code:
function show(obj)
  obj.setInvisibleTo({})
  printToAll(obj.name .. " appears.")
  local desc = obj.getDescription()
  desc = desc:gsub(",Hidden","")
  obj.setDescription(desc)
end
Code to perform a hide on selected objects (typically triggered from a GM button)...
Code:
function hideSelected()
  local objs = Player["Black"].getSelectedObjects()
  for key,obj in pairs(objs) do
    Global.call("hide",obj)
  end
end
Code to perform a show on selected objects (typically triggered from a GM button)...
Code:
function showSelected()
  local objs = Player["Black"].getSelectedObjects()
  for key,obj in pairs(objs) do
    Global.call("show",obj)
  end
end
Note that the hide function first removes Hidden from the description (if it exists) and then adds it. This is done so that if the object is hidden when already hidden, it will still only have one Hidden keyword in the description.