Home Button Home Login Button Login Download Button Download Lua scripts list button Scripts list Lua documentation Button Lua scripting docs About FAQ Button FAQ

Player on screen alarm ignoring friends

Plays an alarm when you see player that is not in whitelist


local whitelist = {
    "FriendName1", 
    "FriendName2", 
    "FriendName3",
}

local function isInWhitelist(playerName)
    local selfName = getSelfName()
    for _, name in ipairs(whitelist) do
        if playerName == name then
            return true
        end
        if selfName ~= nil and playerName == selfName then
            return true
        end
    end
    return false
end

local function checkForPlayers()
    local players = getScreenPlayers()
    for _, player in ipairs(players) do
        local playerName = getCreatureName(player)
        if playerName and not isInWhitelist(playerName) then
            playSound("playerOnScreen.wav")
            break
        end
    end
end

autoRun(1000, checkForPlayers)
                    

Logout if any player on screen

Checks only players visible on screen


local function f()
    if #getScreenPlayers() > 1 then
        xlog()
        sleep(1000)
    end
end

autoRun(100, f)
                    

Logout if any player on screen (multifloor)

Checks all player. On screen and on higher/lower levels.


local function logoutMultifloor()
    local selfName = getSelfName()
    if selfName == nil then
        return
    end
    for i, creature in ipairs(getCreaturesMultiFloor()) do
        if isPlayer(creature) and getCreatureName(creature) ~= selfName then
            xlog()
            sleep(500)
            return
        end
    end
end

autoRun(100, logoutMultifloor)
                    

Drop items on the ground

Change ITEMS_TO_DROP to add more items


local ITEMS_TO_DROP = {
    3264, -- sword
    3286, -- mace
}

local function f()
    for _, itemId in ipairs(ITEMS_TO_DROP) do
        dropItem(itemId, 1)
    end
end

autoRun(300, f)
                    

Spear pickup and equip

Pickup spears from ground if your character is near it. Also puts spears from backpack to hand


local function f()
    if getItemCount(3277) > 1 then
        equipItem(RIGHT_HAND_SLOT, 3277, 5)
        sleep(math.random(200,300))
    end
    collectNearbyGroundItem(2854, 3277)
    sleep(math.random(300, 500))
end

autoRun(100, f)
                    

Equip ammo (arrow, bolts)

Equip ammo from open backpacks to arrow slot. Edit AMMO_ID


local AMMO_ID = 7368

local function f()
  equipItem(AMMO_SLOT, AMMO_ID , 100)
  sleep(math.random(100000, 200000))
end

autoRun(1, f)
                    

Auto energy ring

Equip energy ring at low hp and remove it at high hp. Edit ID or HPPCs for custom values


local E_RING_ID = 3051
local EQUIPED_E_RING_ID = 3088
local UNEQUIP_HPPC = 80
local EQUIP_HPPC = 40

local function f()
  local equippedRingId = getInventoryItemId(RING_SLOT)
  local hppc = getPlayerHppc()
  if equippedRingId == EQUIPED_E_RING_ID and hppc >= UNEQUIP_HPPC then
    unequip(RING_SLOT)
    return
  end
  if hppc <= EQUIP_HPPC and equipedRingId ~= EQUIPED_E_RING_ID then
    equipItem(RING_SLOT, E_RING_ID, 1)
  end
end

autoRun(100, f)
                    

Auto life ring

Equip life ring at low mp and remove it at higher mp. Edit ID or MPPCs for custom values


local LIFE_RING_ID = 3052
local EQUIPED_LIFE_RING_ID = 3089
local UNEQUIP_MPPC = 10
local EQUIP_MPPC = 5

local function f()
  local equippedRingId = getInventoryItemId(RING_SLOT)
  local mppc = getPlayerMppc()
  if equippedRingId == EQUIPED_LIFE_RING_ID and mppc >= UNEQUIP_MPPC then
    unequip(RING_SLOT)
    return
  end
  if mppc <= EQUIP_MPPC and equipedRingId ~= EQUIPED_LIFE_RING_ID then
    equipItem(RING_SLOT, LIFE_RING_ID, 1)
  end
end

autoRun(1000, f)
                    

Auto follow friend (map click)

Edit followedPlayer to the name of friend you want to follow. This will use map clicks for walking so targeting can be enabled


local followedPlayer = "Pan Tadeusz"

local function f()
    local followed = getCreatureByName(followedPlayer)
    mapClickChase(followed)
end

autoRun(20, f)
                    

Heal friend by name (auto exura sio)

Uses Exura sio on friend if below certain HP%


local SIO_FRIEND_NAME = "MyFriend"
local SIO_HPPC = 80

local function heal()
    local friend = getCreatureByName(SIO_FRIEND_NAME)
    if friend == nil then
        return
    end
    if getCreatureHppc(friend) <= SIO_HPPC then
        talk('exura sio "' .. SIO_FRIEND_NAME)
    end
end

autoRun(500, heal)
                    

Heal friends with UH

Uses UH on friend if below certain HP%


local UH_RUNE_ID = 3160
local UH_HPPC = 40

local FRIEND_LIST = {
    "FRIEND1",
    "FRIEND2",
}

local function isFriend(creature)
    for _, friend in ipairs(FRIEND_LIST) do
        if friend == getCreatureName(creature) then
            return true
        end
    end
    return false
end

local function autoUh()
    for _, friend in ipairs(getScreenPlayers()) do
        if isFriend(friend) and getCreatureHppc(friend) <= UH_HPPC then
            useItemFromOpenContainerOnThing(UH_RUNE_ID, friend)
            sleep(1000)
            return
        end
    end
end

autoRun(300, autoUh)
                    

Mana train

Uses Spell above % mana


local MANA_PERCENT = 60  -- change
local MANA_TRAIN_SPELL = "utevo lux" -- change

local function manaTrain()
    if getPlayerMppc() >= MANA_PERCENT then
        talk(MANA_TRAIN_SPELL)
    end
end

autoRun(2000, manaTrain)
                    

custom mana fluid

Uses mana fluid when low mana


local CUSTOM_MANA_FLUID_ID = 7480
local CUSTOM_MANA_FLUID_SUBTYPE = 0
local MANA_PERCENT = 60

local function useCustomManaFluid()
    if getPlayerMppc() <= MANA_PERCENT then
        useItemWithSubtypeFromOpenContainerOnSelf(CUSTOM_MANA_FLUID_ID, CUSTOM_MANA_FLUID_SUBTYPE)
        sleep(2000)
    end
end

autoRun(500, useCustomManaFluid)
                    

Report (spy) players on screens with private message

This script sends private message for every player that is on the screen. Useful for MC character that spies if someone is entering spawn

Change PLAYER_TO_SEND_MSG


local PLAYER_TO_SEND_MSG = "Papryka" -- edit this name to character which should receive msgs
local EXHAUST = 4000 -- milliseconds delay for each reported player that comes on screen

local EXHAUST_TABLE = {}

local function shouldReportPlayer(playerName)
    return EXHAUST_TABLE[playerName] == nil or EXHAUST_TABLE[playerName] < nowMs()
end

local function reportPlayersOnPriv()
    local selfName = getSelfName()
    if selfName == nil then
        return
    end
    for index, player in ipairs(getScreenPlayers()) do
        local playerName = getCreatureName(player)
        if playerName ~= selfName then
            if shouldReportPlayer(playerName) then
                talkPrivate(PLAYER_TO_SEND_MSG, playerName)
                EXHAUST_TABLE[playerName] = nowMs() + EXHAUST
            end
        end
    end
end


autoRun(500, reportPlayersOnPriv)
                    

Organize loot from ground to backpack of backpacks

Make backpacks of backpacks and run script to put items from ground to this backpack. This script will open next backpack if the current one is full

Change LOOT_BACKPACK_ID and LOOT_BAG_CAPACITY


local LOOT_BACKPACK_ID = 2853
local LOOT_BAG_CAPACITY = 8
local ITEMS_TO_PUSH = {
    3264, -- sword
    3286, -- mace
}

local function collectFromGround()
    for i, v in ipairs(ITEMS_TO_PUSH) do
        collectNearbyGroundItem(LOOT_BACKPACK_ID, v)
        sleep(300)
    end
end

local function openNextBackpack()
    for index, container in ipairs(getOpenContainers()) do
        if getId(getContainerItem(container)) == LOOT_BACKPACK_ID then
            local items = getItems(container)
            if #items >= LOOT_BAG_CAPACITY then
                for index, item in ipairs(items) do
                    if getId(item) == LOOT_BACKPACK_ID then
                        open(item, container)
                        sleep(500)
                        return
                    end
                end
            end
        end
    end
end

autoRun(500, openNextBackpack)
autoRun(500, collectFromGround)