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
    equipItem(RING_SLOT, RING_ID_TO_EQUIP_WHEN_E_RING_NOT_NEEDED , 1)
    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 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)
                    

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)