XenoBot Forums - Powered by vBulletin

User Tag List

Page 1 of 4 123 ... LastLast
Results 1 to 10 of 32

Thread: Anoyn's Scripts

  1. #1

    Join Date
    May 2014
    Location
    Canada
    Posts
    320
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)

    Anoyn's Scripts

    Last edited by anoyn; 02-15-2016 at 01:18 AM.

  2. #2

    Join Date
    May 2014
    Location
    Canada
    Posts
    320
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)
    Paladin/Mage Bow/X-Bow/Wand Spell Caster
    This script replaces the built in magic shooter.
    It casts spells after a Bow/Crossbow/wand hit to avoid exhaust.
    It only works with bow, XBow and wands.
    It does not support area spells.
    It supports range limited spells.
    It supports spells for specific creatures.


    lua code:

    -- Paladin/Mage single target spell shooter
    -- THIS ONLY WORKS WITH ARROWS, BOLTS and WANDS/RODS
    --Version 2.1
    --[[ Made by
    ___ .__ __. ______ ____ ____ .__ __.
    / \ | \ | | / __ \ \ \ / / | \ | |
    / ^ \ | \| | | | | | \ \/ / | \| |
    / /_\ \ | . ` | | | | | \_ _/ | . ` |
    / _____ \ | |\ | | `--' | | | | |\ |
    /__/ \__\ |__| \__| \______/ |__| |__| \__|

    ]]


    --------------------------------------------
    --[[ ------------ CONFIG -------------- ]]--
    --------------------------------------------
    --if the spell does not have a range, dont give the spell a range
    --if you want to use a spell on any creature, dont give the spell onCreatures
    --attack can be either a spell or rune ID
    --spells you want to cast first should be at the top
    spells = {
    --{ attack = "exori san", range = 4 },
    { attack = "exori flam", range = 3, onCreatures = { "Kongra", "Rat" } }, -- This will cast exori flam on a Kongra or Rat if they are within a range of 3
    { attack = 3155, range = 3, onCreatures = { "Sibang" } },
    -- { attack = "exori gran con" },
    -- { attack = "exori con" },
    { attack = "exori vis", range = 3 }
    }

    --How long do you want to wait between your arrow and casting spell? (If OT, set to 0)
    delayToCastMin = 150 -- 150ms
    delayToCastMax = 300 -- 300ms

    --IF you are playing a wierd OT that messes with player HP, you can override what vocation you are here
    overrideVocation = nil -- "Paladin", "Mage"

    --------------------------------------------
    --[[ ----- Script -- No need to edit ---- ]]
    --------------------------------------------

    function VocationDetection() --Aristeus
    if overrideVocation ~= nil and (overrideVocation ~= "Knight" or overrideVocation ~= "Paladin" or overrideVocation ~= "Mage") then
    print("Overiding Vocation to " .. overrideVocation)
    Vocation = overrideVocation
    else
    local HealthLevel = (Self.MaxHealth() - 185) / (Self.Level() - 8)
    if (HealthLevel == 15) then
    Vocation = "Knight"
    print('Vocation: Knight')
    end
    if (HealthLevel == 10) then
    Vocation = "Paladin"
    print('Vocation: Paladin')
    end
    if (HealthLevel == 5) then
    Vocation = "Mage"
    print('Vocation: Mage')
    end
    print("Vocation " .. Vocation .. " detected.")
    end
    end
    VocationDetection()

    lastAmmoCount = Self.Ammo().count
    function checkIfCanCastSpell(targetID)
    --Check if spell has limited range
    for i = 1, #spells do
    local castThisSpell = true
    local creature = Creature.New(targetID)
    if creature ~= nil then
    if spells[i]['range'] ~= nil then
    if not( Self.DistanceFromPosition(creature:Position().x, creature:Position().y, creature:Position().z) <= spells[i]['range'] ) then
    castThisSpell = false
    end
    end
    --Check current target
    if castThisSpell and spells[i]['onCreatures'] ~= nil then
    if not table.contains( spells[i]['onCreatures'], creature:Name() ) then
    castThisSpell = false
    end
    end

    if castThisSpell then
    attack(spells[i]['attack'], targetID)
    break
    end
    end
    end
    end

    function attack(attackValue, targetID)
    wait(delayToCastMin,delayToCastMax)
    if tonumber(attackValue) then
    Self.UseItemWithCreature(attackValue, targetID)
    else
    Self.Cast(attackValue)
    end
    end

    if Vocation == "Paladin" then
    Module.New('boltChecker', function(boltChecker)
    ammo = Self.Ammo()
    local targetID = Self.TargetID()
    if ammo.count > lastAmmoCount then
    lastAmmoCount = ammo.count
    elseif targetID ~= 0 and ammo.id ~= 0 and ammo.count < lastAmmoCount then
    lastAmmoCount = ammo.count
    checkIfCanCastSpell(targetID)
    end
    end)
    elseif Vocation == "Mage" then
    BattleMessageProxy.OnReceive("BattleProxy", function(proxy, text)
    if( string.find(text, " due to your")) then
    local targetID = Self.TargetID()
    if targetID ~= 0 then
    checkIfCanCastSpell(targetID)
    end
    end
    end)
    else
    print("Vocation " .. Vocation .. " not supported")
    end
    Last edited by anoyn; 01-23-2016 at 05:48 PM.

  3. #3

    Join Date
    May 2014
    Location
    Canada
    Posts
    320
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)
    X-Log before Server Save
    This script will close the client at a random period before the server save.
    It will only X-log when no creatures are no screen.

    lua code:

    -- Xlog at server save
    --Version 1.0
    --[[ Made by
    ___ .__ __. ______ ____ ____ .__ __.
    / \ | \ | | / __ \ \ \ / / | \ | |
    / ^ \ | \| | | | | | \ \/ / | \| |
    / /_\ \ | . ` | | | | | \_ _/ | . ` |
    / _____ \ | |\ | | `--' | | | | |\ |
    /__/ \__\ |__| \__| \______/ |__| |__| \__|

    ]]
    -----CONFIG------
    --the hour before the server save (server save is at 3 AM for my computer)
    local sshour = "02"

    -- the script will logout sometime between the two times
    local ssEarlyLogout = 10
    local ssLateLogout = 40


    -----SCRIPT------
    local ssmin = tostring(math.random(ssEarlyLogout,ssLateLogout))

    Module.New('xLogSS', function(xLogSS)
    if ((os.date("%H") == sshour) and (os.date("%M") >= ssmin)) then
    --Check to see if there are creatures on screen
    PlayersOnScreen = Self.GetSpectators()
    creatureOnScreen = false
    for i = 1, #PlayersOnScreen do
    if not PlayersOnScreen[i]:isPlayer() then
    creatureOnScreen = true
    break
    end
    end

    --If there are no creatures on screen
    if not creatureOnScreen then
    os.exit()
    end
    end
    xLogSS:Delay(10000)
    end)

  4. #4

    Join Date
    May 2014
    Location
    Canada
    Posts
    320
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)
    Stealth/Energy Ring Equipper on X creatures
    This script will equip a stealth ring based on creatures on screen within a certain range.
    Creatures can have varying danger levels
    If the total danger is above the limit. The ring will be equipped.

    lua code:

    -- Stealth Ring Equipper
    --Version 1.0
    --[[ Made by
    ___ .__ __. ______ ____ ____ .__ __.
    / \ | \ | | / __ \ \ \ / / | \ | |
    / ^ \ | \| | | | | | \ \/ / | \| |
    / /_\ \ | . ` | | | | | \_ _/ | . ` |
    / _____ \ | |\ | | `--' | | | | |\ |
    /__/ \__\ |__| \__| \______/ |__| |__| \__|

    ]]
    --------------------------------------------
    --[[ ------------ CONFIG -------------- ]]--
    --------------------------------------------
    local distanceToCheckCreatures = 2 -- Check creatures within this range
    local dangerToEquip = 3 -- if danger is higher than this number, equip ring

    local monsterList = {
    { name = "Cyclops Smith", danger = 3 },
    { name = "Cyclops Drone", danger = 2 },
    { name = "Cyclops", danger = 1 }
    }

    -- 3049, 3086 = stealth ring/steath ring equipped
    local RingID = 3049 -- ID of ring in backpack to equip
    local RingIDWhenEquipped = 3086 -- The ID when ring is equipped

    --How often should creature checks be made in milliseconds
    local minCreatureCheckDelay = 400
    local maxCreatureCheckDelay = 1200

    --------------------------------------------
    --[[ ----- Script -- No need to edit ---- ]]
    --------------------------------------------
    function getDangerLevel( dist )
    local currentDanger = 0
    local targets = Self.GetTargets( dist )
    for i = 1, #targets do
    local targetName = targets[i]:Name()

    for i = 1, #monsterList do
    if monsterList[i]['name'] == targetName then
    currentDanger = currentDanger + monsterList[i]['danger']
    end
    end
    end
    return currentDanger
    end

    function stealthring()
    local dangerAmount = getDangerLevel( distanceToCheckCreatures )
    --print("Danger level = " .. dangerAmount )
    if dangerAmount >= dangerToEquip and Self.Ring().id ~= RingIDWhenEquipped and Self.ItemCount(RingID) >= 1 then
    Self.Equip(RingID, "ring")
    elseif dangerAmount < dangerToEquip and Self.Ring().id == RingIDWhenEquipped then
    Self.Dequip("ring")
    end
    end

    Module('stealth', function(stealth)
    stealthring()
    stealth:Delay(minCreatureCheckDelay,maxCreatureCheckDelay)
    end)
    Last edited by anoyn; 01-22-2016 at 04:25 AM.

  5. #5

    Join Date
    May 2014
    Location
    Canada
    Posts
    320
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)
    Spell Caster while Manually Playing
    This script will cast spells in order when you are attacking a creature.
    To be used if you are too lazy to cast spells yourself while manually playing.
    Can be enabled and disabled with a hotkey. (Default end)

    lua code:

    -- Automatic spell caster for manual targeting
    -- Version 1.0
    --[[ Made by
    ___ .__ __. ______ ____ ____ .__ __.
    / \ | \ | | / __ \ \ \ / / | \ | |
    / ^ \ | \| | | | | | \ \/ / | \| |
    / /_\ \ | . ` | | | | | \_ _/ | . ` |
    / _____ \ | |\ | | `--' | | | | |\ |
    /__/ \__\ |__| \__| \______/ |__| |__| \__|

    ]]
    --------------------------------------------
    --[[ ------------ CONFIG -------------- ]]--
    --------------------------------------------
    --Spells to cast in order from strongest to weakest
    strikeSpells = {
    "exori max frigo",
    "exori gran frigo",
    "exori frigo"
    }

    --Square range you can shoot your spells
    castRange = 3

    --will only cast if mana percent is this or above
    manaPercentToCast = 10

    --Whether you want automatic casts to be on when you start the script
    castingSpells = true

    enableHotkey = 35 -- 35 = END, 36 = HOME

    --------------------------------------------
    --[[ ----- Script -- No need to edit ---- ]]
    --------------------------------------------
    Module.New('saySpell', function(saySpell)
    if( castingSpells ) then
    local curTargetID = Self.TargetID()
    if( curTargetID ~= 0 ) then
    local enemyPos = Creature.New(curTargetID):Position()
    local manaPercent = math.floor(( Self.Mana() * 100 ) / Self.MaxMana())
    if( Self.DistanceFromPosition(enemyPos.x, enemyPos.y, enemyPos.z) <= castRange and
    Self.Position().z == enemyPos.z and manaPercent >= manaPercentToCast ) then
    for spellIndex = 1, #strikeSpells do
    if( Self.CanCastSpell(strikeSpells[spellIndex] ) ) then
    Self.Cast(strikeSpells[spellIndex] )
    break
    end
    end
    end
    end
    end
    end)

    if not Hotkeys.Register(enableHotkey) then
    print("Could not enable hotkey, check that enableHotkey (" .. enableHotkey .. ") is valid.")
    end

    function pressHandler(key, control, shift)
    if( castingSpells ) then
    print("Pausing Spell Caster")
    castingSpells = false
    else
    print("Starting Spell Caster")
    castingSpells = true
    end
    end
    Hotkeys.AddPressHandler(pressHandler)

  6. #6

    Join Date
    Sep 2015
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by anoyn View Post
    Paladin Bow/X-Bow Spell Caster
    This script replaces the built in magic shooter.
    It casts spells after a Bow/Crossbow hit to avoid exhaust.
    It only works with bow and XBow.
    It does not support area spells.
    It supports range limited spells.

    lua code:

    -- Paladin single target spell shooter
    -- THIS ONLY WORKS WITH ARROWS AND BOLTS
    --Version 1.0
    --[[ Made by
    ___ .__ __. ______ ____ ____ .__ __.
    / \ | \ | | / __ \ \ \ / / | \ | |
    / ^ \ | \| | | | | | \ \/ / | \| |
    / /_\ \ | . ` | | | | | \_ _/ | . ` |
    / _____ \ | |\ | | `--' | | | | |\ |
    /__/ \__\ |__| \__| \______/ |__| |__| \__|

    ]]

    --------------------------------------------
    --[[ ------------ CONFIG -------------- ]]--
    --------------------------------------------
    --if the spell does not have a range, dont give the spell a range
    --spells you want to cast first should be at the top
    spells = {
    --{ words = "exori san", range = 4 },
    { words = "exori gran con" },
    { words = "exori con" }
    }

    --How long do you want to wait between your arrow and casting spell? (If OT, set to 0)
    delayToCastMin = 30 -- 30ms
    delayToCastMax = 300 -- 300ms


    --------------------------------------------
    --[[ ----- Script -- No need to edit ---- ]]
    --------------------------------------------
    lastAmmoCount = Self.Ammo().count
    function checkIfCanCastSpell(targetID)
    --Check if spell has limited range
    for i = 1, #spells do
    if spells[i]['range'] ~= nil then
    local creature = Creature.New(targetID)
    if( creature ~= nil and Self.DistanceFromPosition(creature:Position().x, creature:Position().y, creature:Position().z) <= spells[i]['range'] ) then
    if Self.CanCastSpell(spells[i]['words']) then
    castSpell(spells[i]['words'])
    break
    end
    end
    else
    if Self.CanCastSpell(spells[i].words) then
    castSpell(spells[i]['words'])
    break
    end
    end
    end
    end

    function castSpell(words)
    lastAmmoCount = ammo.count
    wait(delayToCastMin,delayToCastMax)
    Self.Cast(words)
    end

    Module.New('boltChecker', function(boltChecker)
    ammo = Self.Ammo()
    local targetID = Self.TargetID()
    if targetID ~= 0 and ammo.id ~= 0 and ammo.count < lastAmmoCount then
    checkIfCanCastSpell(targetID)
    end
    end)
    SERIOUSLY! THIS IS THE BEST THING THAT COULD HAVE HAPPEN! It works like a charm, really you are a lifesaver, BIG CREDS to you! Would have payed for this to happen lol.

    Update: Ive tried it now and it worked flawlessly for some time, then it just stopped working at all and i had to reload the script to make it work again (no error message) It could be at the time my bot autorefill to 100 arrows from 25-35 but not sure
    Update 2: Yes it is when the bot reloads the arrows confirmed
    Last edited by garre93; 12-07-2015 at 01:35 AM.

  7. #7

    Join Date
    May 2014
    Location
    Canada
    Posts
    320
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by garre93 View Post
    SERIOUSLY! THIS IS THE BEST THING THAT COULD HAVE HAPPEN! It works like a charm, really you are a lifesaver, BIG CREDS to you! Would have payed for this to happen lol.

    Update: Ive tried it now and it worked flawlessly for some time, then it just stopped working at all and i had to reload the script to make it work again (no error message) It could be at the time my bot autorefill to 100 arrows from 25-35 but not sure
    Update 2: Yes it is when the bot reloads the arrows confirmed
    Glad to hear you like it!

    Issue should be fixed with version 1.1.

  8. #8

    Join Date
    Sep 2015
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by anoyn View Post
    Glad to hear you like it!

    Issue should be fixed with version 1.1.
    Cool! Really looked forward to something like this, and great it getting fixed also, then its perfect!

    Update: Yes its perfect thanks!!
    Last edited by garre93; 12-07-2015 at 02:31 AM.

  9. #9
    Lifetime Subscriber Kociii's Avatar
    Join Date
    Apr 2013
    Location
    Sweden
    Posts
    3,586
    Mentioned
    199 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by anoyn View Post
    Paladin Bow/X-Bow Spell Caster
    This script replaces the built in magic shooter.
    It casts spells after a Bow/Crossbow hit to avoid exhaust.
    It only works with bow and XBow.
    It does not support area spells.
    It supports range limited spells.

    lua code:

    -- Paladin single target spell shooter
    -- THIS ONLY WORKS WITH ARROWS AND BOLTS
    --Version 1.1
    --[[ Made by
    ___ .__ __. ______ ____ ____ .__ __.
    / \ | \ | | / __ \ \ \ / / | \ | |
    / ^ \ | \| | | | | | \ \/ / | \| |
    / /_\ \ | . ` | | | | | \_ _/ | . ` |
    / _____ \ | |\ | | `--' | | | | |\ |
    /__/ \__\ |__| \__| \______/ |__| |__| \__|

    ]]

    --------------------------------------------
    --[[ ------------ CONFIG -------------- ]]--
    --------------------------------------------
    --if the spell does not have a range, dont give the spell a range
    --spells you want to cast first should be at the top
    spells = {
    --{ words = "exori san", range = 4 },
    { words = "exori gran con" },
    { words = "exori con" }
    }

    --How long do you want to wait between your arrow and casting spell? (If OT, set to 0)
    delayToCastMin = 30 -- 30ms
    delayToCastMax = 300 -- 300ms


    --------------------------------------------
    --[[ ----- Script -- No need to edit ---- ]]
    --------------------------------------------
    lastAmmoCount = Self.Ammo().count
    function checkIfCanCastSpell(targetID)
    --Check if spell has limited range
    for i = 1, #spells do
    if spells[i]['range'] ~= nil then
    local creature = Creature.New(targetID)
    if( creature ~= nil and Self.DistanceFromPosition(creature:Position().x, creature:Position().y, creature:Position().z) <= spells[i]['range'] ) then
    if Self.CanCastSpell(spells[i]['words']) then
    castSpell(spells[i]['words'])
    break
    end
    end
    else
    if Self.CanCastSpell(spells[i].words) then
    castSpell(spells[i]['words'])
    break
    end
    end
    end
    end

    function castSpell(words)
    lastAmmoCount = ammo.count
    wait(delayToCastMin,delayToCastMax)
    Self.Cast(words)
    end

    Module.New('boltChecker', function(boltChecker)
    ammo = Self.Ammo()
    local targetID = Self.TargetID()
    if ammo.count > lastAmmoCount then
    lastAmmoCount = ammo.count
    elseif targetID ~= 0 and ammo.id ~= 0 and ammo.count < lastAmmoCount then
    checkIfCanCastSpell(targetID)
    end
    end)
    Nice work. I will give it a go later. Just checking, will you be adding area attacker and such later on? But this script isen't working with Exori Hur and that right?



    Free & Open Teamspeak 3 server for everyone!




    My Spotify List



    My Tibia Life



    My Script Thread

  10. #10

    Join Date
    May 2014
    Location
    Canada
    Posts
    320
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Kociii View Post
    Nice work. I will give it a go later. Just checking, will you be adding area attacker and such later on? But this script isen't working with Exori Hur and that right?
    I may add an area spell shooter later, but its not a high priority right now.


    The script works by casting when you use a arrow/bolt. For spears and knights it does not work since you cant count if you lost your weapon.

    You could have it cast after a battle proxy message, but then it wouldnt cast if you missed the creature, so therefore on paladin/knight but perfect for mages.

    I'm not sure if there is enough interest for a mage version which uses a battle proxy message to time wands and spells together.

Posting Permissions

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