This update not only fixes a bug, but it also adds the BrowseField and EffectMessageProxy features needed to make effective dice scripts. Furthermore, it brings some huge new ways to succinctly, yet powerfully, interface with the Creature and Container classes.

Changelog:
Code:
v3.3.4
Fixed a bug in the Scripter which caused Self.GetSpectators() to ignore the first creature in the list.
Added the following Scripter functions to the Self class:
Added tostring(), ==, and .. operators for the Creature class in the Scripter.
    tostring() returns name
    == compares by ID
    .. concatenates names
Added EffectMessageProxy class to the Scripter.
    Works like all other proxies. See below for code examples.
Added Self.PrivateMessage() to the Scripter.
    Notes: Sends a private message to a player.
    Parameters
        player: the person to message
        message: the message to send
    Returns: 1 if success 0 if fail
    Usage: Self.PrivateMessage(player, message)
Added Self.BrowseField() to the Scripter.
    Notes: Opens the Browse Field window on a tile.
    Parameters
        x, y, z: the position of the tile to browse
    Returns: 1 if success 0 if fail
    Usage: Self.BrowseField(x, y, z)
Added meta __call constructors to the following Scripter classes:
    Creature, Container, Module, Signal, All Proxies
    Examples
        Creature("DarkstaR") is the same as Creature.New("DarkstaR")
        Container("Orange Backpack") is the same as Container.New("Orange Backpack")
Added Creature iterators to the Scripter.
    See below for code examples.
    Current iterators:
        Creature.iPlayers([range, sort])
        Creature.iMonsters([range, sort])
        Creature.iNpcs([range, sort])
        Creature.iAllies([range, sort])
        Creature.iEnemies([range, sort])
        Creature.iPartyMembers([range, sort])
        Creature.iCreatures([range, sort])
Added Container iterators to the Scripter.
    See below for code examples.
    Current iterators:
        Container.iContainers()
            iterates through containers
        Container:iItems()
            iterates through items in a container
New Scripting Examples

EffectMessageProxy Example
lua code:
EffectMessageProxy.OnReceive("GET EFFECTS", function(proxy, message, x, y, z)
--will get red messages from dice, food eating, potion drinking, etc...
end)



Container class iterator example
lua code:
for index, container in Container.iContainers() do
print(tostring(index) .. ": " .. container:Name())

for spot, item in container:iItems() do
print("-----" .. tostring(spot) .. ": " .. table.serialize(item))
end
end



Simple Creature class iterator examples
lua code:
print("------------ PLAYERS ------------")
for name, creature in Creature.iPlayers() do
print(name .. ": " .. creature:HealthPercent() .. "%")
end
print("------------ MONSTERS ------------")
for name, creature in Creature.iMonsters() do
print(name .. ": " .. creature:HealthPercent() .. "%")
end
print("------------ NPCS ------------")
for name, creature in Creature.iNpcs() do
print(name .. ": " .. creature:HealthPercent() .. "%")
end
print("------------ ALLIES ------------")
for name, creature in Creature.iAllies() do
print(name .. ": " .. creature:HealthPercent() .. "%")
end
print("------------ ENEMIES ------------")
for name, creature in Creature.iEnemies() do
print(name .. ": " .. creature:HealthPercent() .. "%")
end
print("------------ PARTY MEMBERS ------------")
for name, creature in Creature.iPartyMembers() do
print(name .. ": " .. creature:HealthPercent() .. "%")
end
print("------------ ALL ------------")
for name, creature in Creature.iCreatures() do
print(name .. ": " .. creature:HealthPercent() .. "%")
end



Advanced Creature class iterator Examples
lua code:
print("------------ MONSTERS in RANGE 5 sort by HEALTH ------------")
local sort = function(a, b) return a:HealthPercent() > b:HealthPercent() end
for name, creature in Creature.iMonsters(5, sort) do
print(name .. ": " .. creature:HealthPercent() .. "%")
end

print("------------ PLAYERS in ANY RANGE sort by NAME ------------")
local sort = function(a, b) return a:Name() < b:Name() end
for name, creature in Creature.iPlayers(nil, sort) do
print(name .. ": " .. creature:HealthPercent() .. "%")
end

print("------------ ENEMIES in RANGE 1 ------------")
for name, creature in Creature.iEnemies(1) do
print(name .. ": " .. creature:HealthPercent() .. "%")
end



Practical Creature class iterator Examples
lua code:
-- PRACTICAL EXAMPLES: ALLY HEALER --
local sort = function(a, b) return a:HealthPercent() < b:HealthPercent() end
local name, creature = Creature.iAllies(10, sort)() --gets the first ally returned; e.g. lowest hp
if (creature and creature:HealthPercent() < 60) then
Self.Say("exura sio \"" .. name)
end


-- PRACTICAL EXAMPLES: TARGETING --
local sort = function(a, b) --SORT by DISTANCE then by HEALTH then by ID
local adist = a:DistanceFromSelf()
local bdist = b:DistanceFromSelf()
if (adist == bdist) then
local ahealth = a:HealthPercent()
local bhealth = b:HealthPercent()
if (ahealth == bhealth) then
return a:ID() < b:ID()
else
return ahealth < bhealth
end
else
return adist < bdist
end
end
local name, creature = Creature.iMonsters(nil, sort)() --gets the first creature returned; e.g. best target
if (creature and not creature:isTarget()) then
creature:Attack()
end


For download and operation instructions, refer back to this thread:
http://forums.xenobot.net/showthread.php?19