XenoBot Forums - Powered by vBulletin

User Tag List

Page 1 of 5 123 ... LastLast
Results 1 to 10 of 47

Thread: [Update] XenoBot v3.3.4 [BrowseField and EffectMessageProxy]

  1. #1
    XenoBot Developer DarkstaR's Avatar
    Join Date
    Dec 2010
    Posts
    6,104
    Mentioned
    1326 Post(s)
    Tagged
    16 Thread(s)

    [Update] XenoBot v3.3.4 [BrowseField and EffectMessageProxy]

    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

  2. #2
    Lifetime Subscriber Stusse's Avatar
    Join Date
    Dec 2011
    Location
    solid-scripts.com
    Posts
    3,523
    Mentioned
    346 Post(s)
    Tagged
    1 Thread(s)
    sWEET!

    Good job

    /STusse

  3. #3
    Lifetime Subscriber thorekz's Avatar
    Join Date
    Dec 2011
    Location
    Santiago, Chile
    Posts
    1,247
    Mentioned
    23 Post(s)
    Tagged
    0 Thread(s)
    cool thanks
    Quod per sortem sternit fortem.

  4. #4
    Lifetime Subscriber Stusse's Avatar
    Join Date
    Dec 2011
    Location
    solid-scripts.com
    Posts
    3,523
    Mentioned
    346 Post(s)
    Tagged
    1 Thread(s)
    Do you have intentions of adding these targeting options to the Bot itself as well?

    /Stusse

  5. #5
    XenoBot Developer DarkstaR's Avatar
    Join Date
    Dec 2010
    Posts
    6,104
    Mentioned
    1326 Post(s)
    Tagged
    16 Thread(s)
    Quote Originally Posted by Stusse View Post
    Do you have intentions of adding these targeting options to the Bot itself as well?

    /Stusse
    dafuq r u sayin bro

  6. #6

    Join Date
    Apr 2012
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    YESSS!!!!!! Thanks

  7. #7
    Senior Member Xeromex's Avatar
    Join Date
    Aug 2012
    Location
    Netherlands
    Posts
    2,201
    Mentioned
    117 Post(s)
    Tagged
    0 Thread(s)
    So, who got the honour to make a anti-loot steal script?
    Darkstar, amazing update!! Thanks

  8. #8
    Lifetime Subscriber Stusse's Avatar
    Join Date
    Dec 2011
    Location
    solid-scripts.com
    Posts
    3,523
    Mentioned
    346 Post(s)
    Tagged
    1 Thread(s)
    Haha nvm didnt read it through fully


    /Stusse

  9. #9
    Lifetime Subscriber Stusse's Avatar
    Join Date
    Dec 2011
    Location
    solid-scripts.com
    Posts
    3,523
    Mentioned
    346 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Xeromex View Post
    So, who got the honour to make a anti-loot steal script?
    Darkstar, amazing update!! Thanks
    Would be quite cool if we were able to loot via Browse Field in the bot itself.. :P

    Not sure how accurate it would be with the correct monster corpse id and shit but would be cool at least

  10. #10
    Senior Member Xeromex's Avatar
    Join Date
    Aug 2012
    Location
    Netherlands
    Posts
    2,201
    Mentioned
    117 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Stusse View Post
    Would be quite cool if we were able to loot via Browse Field in the bot itself.. :P

    Not sure how accurate it would be with the correct monster corpse id and shit but would be cool at least
    Looting by just right clicking is more efficient. Making that script is going to be pretty hard I think, best way could be by lootmessage proxy I thinkż

Posting Permissions

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