Your browser does not support JavaScript or its disabled!
Please turn it on, or be aware that some features on this website will not work correctly.
3.3K
Suggestions
Charm Equipper - (onHotkey) | 01/01/20 | 3.1K
Open Backpacks Minimised | 01/05/21 | 2.3K
Open next container | 12/09/21 | 2.4K
Drop to Pos | 01/01/20 | 2.1K
Reload Spell ID Split | 09/05/21 | 1.1K
vBot Alarms #57

Add - Ignore Party, warn name
This is based on vBot 3.45

File: alarms.lua | 8.60kb | 256 lines.
--[[
  Script made by Lee (Discord: l33_) - www.trainorcreations.com
  If you want to support my work, feel free to donate at https://trainorcreations.com/donate
  PS. Stop ripping off my work and selling it as your own.
]]--
local panelName = "alarms"
local ui = setupUI([[
Panel
  height: 19

  BotSwitch
    id: title
    anchors.top: parent.top
    anchors.left: parent.left
    text-align: center
    width: 130
    !text: tr('Alarms')

  Button
    id: alerts
    anchors.top: prev.top
    anchors.left: prev.right
    anchors.right: parent.right
    margin-left: 3
    height: 17
    text: Edit

]])
ui:setId(panelName)

if not storage[panelName] then
    storage[panelName] = {
        enabled = false,
        playerAttack = false,
        playerDetected = false,
        playerDetectedLogout = false,
        creatureDetected = false,
        healthBelow = false,
        healthValue = 40,
        manaBelow = false,
        manaValue = 50,
        privateMessage = false,
        ignoreParty = false,
        warnCreature = false,
        warnName = 'Benjamin, Riona',
        warnLoot = false,
        warnLootName = 'gold coin, golden armor, demon shield'
    }
end

local config = storage[panelName]

ui.title:setOn(config.enabled)
ui.title.onClick = function(widget)
config.enabled = not config.enabled
widget:setOn(config.enabled)
end

rootWidget = g_ui.getRootWidget()
if rootWidget then
  alarmsWindow = UI.createWindow('AlarmsWindow', rootWidget)
  alarmsWindow:hide()

  alarmsWindow.closeButton.onClick = function(widget)
    alarmsWindow:hide()
  end

    alarmsWindow.playerAttack:setOn(config.playerAttack)
    alarmsWindow.playerAttack.onClick = function(widget)
        config.playerAttack = not config.playerAttack
        widget:setOn(config.playerAttack)
    end

    alarmsWindow.playerDetected:setOn(config.playerDetected)
    alarmsWindow.playerDetected.onClick = function(widget)
        config.playerDetected = not config.playerDetected
        widget:setOn(config.playerDetected)
    end

    alarmsWindow.playerDetectedLogout:setChecked(config.playerDetectedLogout)
    alarmsWindow.playerDetectedLogout.onClick = function(widget)
        config.playerDetectedLogout = not config.playerDetectedLogout
        widget:setChecked(config.playerDetectedLogout)
    end

    alarmsWindow.creatureDetected:setOn(config.creatureDetected)
    alarmsWindow.creatureDetected.onClick = function(widget)
        config.creatureDetected = not config.creatureDetected
        widget:setOn(config.creatureDetected)
    end

    alarmsWindow.healthBelow:setOn(config.healthBelow)
    alarmsWindow.healthBelow.onClick = function(widget)
        config.healthBelow = not config.healthBelow
        widget:setOn(config.healthBelow)
    end

    alarmsWindow.healthValue.onValueChange = function(scroll, value)
        config.healthValue = value
        alarmsWindow.healthBelow:setText("Health < " .. config.healthValue .. "%")
    end
    alarmsWindow.healthValue:setValue(config.healthValue)

    alarmsWindow.manaBelow:setOn(config.manaBelow)
    alarmsWindow.manaBelow.onClick = function(widget)
        config.manaBelow = not config.manaBelow
        widget:setOn(config.manaBelow)
    end

    alarmsWindow.manaValue.onValueChange = function(scroll, value)
        config.manaValue = value
        alarmsWindow.manaBelow:setText("Mana < " .. config.manaValue .. "%")
    end
    alarmsWindow.manaValue:setValue(config.manaValue)

    alarmsWindow.privateMessage:setOn(config.privateMessage)
    alarmsWindow.privateMessage.onClick = function(widget)
        config.privateMessage = not config.privateMessage
        widget:setOn(config.privateMessage)
    end

    alarmsWindow.ignoreParty:setOn(config.ignoreParty)
    alarmsWindow.ignoreParty.onClick = function(widget)
        config.ignoreParty = not config.ignoreParty
        widget:setOn(config.ignoreParty)
    end

    alarmsWindow.warnCreature:setOn(config.warnCreature)
    alarmsWindow.warnCreature.onClick = function(widget)
        config.warnCreature = not config.warnCreature
        widget:setOn(config.warnCreature)
    end

    alarmsWindow.warnName:setText(config.warnName)
    local checkNames = config.warnName
    checkNames = string.explode(config.warnName, ",")

    alarmsWindow.warnName.onTextChange = function(widget, text)
        config.warnName = text
        checkNames = string.explode(text, ",")
    end

    alarmsWindow.warnLoot:setOn(config.warnLoot)
    alarmsWindow.warnLoot.onClick = function(widget)
        config.warnLoot = not config.warnLoot
        widget:setOn(config.warnLoot)
    end

    alarmsWindow.warnLootName:setText(config.warnLootName)
    local checkLoots = config.warnLootName
    checkLoots = string.explode(config.warnLootName, ",")

    alarmsWindow.warnLootName.onTextChange = function(widget, text)
        config.warnLootName = text
        checkLoots = string.explode(text, ",")
    end

    onTextMessage(function(mode, text)
		if not config.warnLoot then return end
        if not mode == 29 then return end
        if not text:lower():find("loot of") then return end
        text = text:lower()
        for _, lootitem in ipairs(checkLoots) do
            if text:find(lootitem, 1, true) then
                playSound("/sounds/Private_Message.ogg") -- change the sound
                g_window.setTitle(lootitem .. " - Item Dropped!")
                return
            end
        end
    end)

    local pName = player:getName()
    onTextMessage(function(mode, text)
        if config.enabled and config.playerAttack and mode == 16 and string.match(text, "hitpoints due to an attack") and not string.match(text, "hitpoints due to an attack by a ") then
            playSound("/sounds/Player_Attack.ogg")
            g_window.setTitle(pName .. " - Player Detected!")
        end
    end)

    macro(100, function()
        if not config.enabled then return end
        if config.playerDetected then
            for _, spec in ipairs(getSpectators()) do
                if spec:isPlayer() and spec:getName() ~= name() then
                    specPos = spec:getPosition()
                    if (not config.ignoreParty or not spec:isPartyMember()) and math.max(math.abs(posx() - specPos.x), math.abs(posy() - specPos.y)) <= 8 then
                        playSound("/sounds/Player_Detected.ogg")
                        delay(1500)
                        g_window.setTitle(pName .. " - Player Detected!")
                        if config.playerDetectedLogout then modules.game_interface.tryLogout(false) end
                        return
                    end
                end
            end
        end

        if config.creatureDetected then
            for _, spec in ipairs(getSpectators()) do
                if not spec:isPlayer() then
                    specPos = spec:getPosition()
                    if math.max(math.abs(posx() - specPos.x), math.abs(posy() - specPos.y)) <= 8 then
                        playSound("/sounds/Creature_Detected.ogg")
                        delay(1500)
                        g_window.setTitle(pName .. " - Creature Detected! ")
                        return
                    end
                end
            end
        end

        if config.warnCreature then
            for _, spec in ipairs(getSpectators()) do
                if not spec:isPlayer() then
                    for _, nameCheck in ipairs(checkNames) do
                        if spec:getName():find(nameCheck, 1, true) then
                            specPos = spec:getPosition()
                            if math.max(math.abs(posx() - specPos.x), math.abs(posy() - specPos.y)) <= 8 then
                                playSound("/sounds/Creature_Detected.ogg")
                                delay(1500)
                                g_window.setTitle(pName .. " - " .. spec:getName() .. " Detected! ")
                                return
                            end
                        end
                    end
                end
            end
        end

        if config.healthBelow then
            if hppercent() <= config.healthValue then
                playSound("/sounds/Low_Health.ogg")
                g_window.setTitle(pName .. " - Low Health!")
                delay(1500)
                return
            end
        end

        if config.manaBelow then
            if manapercent() <= config.manaValue then
                playSound("/sounds/Low_Mana.ogg")
                g_window.setTitle(pName .. " - Low Mana!")
                delay(1500)
                return
            end
        end
    end)

    onTalk(function(name, level, mode, text, channelId, pos)
        if mode == 4 and config.enabled and config.privateMessage then
            playSound("/sounds/Private_Message.ogg")
            g_window.setTitle(pName .. " - Private Message")
            return
        end
    end)
end

ui.alerts.onClick = function(widget)
    alarmsWindow:show()
    alarmsWindow:raise()
    alarmsWindow:focus()
end

File: alarms.otui | 4.19kb | 174 lines.
AlarmsWindow < MainWindow
  !text: tr('Alarms')
  size: 270 270
  @onEscape: self:hide()

  BotSwitch
    id: playerAttack
    anchors.left: parent.left
    anchors.right: parent.right
    anchors.top: parent.top
    text-align: center
    text: Player Attack
    !tooltip: tr('Alerts when attacked by player.')

  BotSwitch
    id: playerDetected
    anchors.left: parent.left
    anchors.right: parent.horizontalCenter
    anchors.top: prev.bottom
    margin-top: 4
    text-align: center
    text: Player Detected
    !tooltip: tr('Alerts when a player is detected on screen.')

  CheckBox
    id: playerDetectedLogout
    anchors.top: playerDetected.top
    anchors.left: parent.horizontalCenter
    anchors.right: parent.right
    margin-top: 3
    margin-left: 4
    text: Logout
    !tooltip: tr('Attempts to logout when a player is detected on screen.')

  BotSwitch
    id: ignoreParty
    anchors.left: parent.left
    anchors.top: playerDetected.bottom
    anchors.right: parent.right
    text-align: center
    margin-top: 4
    text: Ignore Party
    !tooltip: tr('Player detection alerts will ignore party members.')

  HorizontalSeparator
    id: sepPlayer
    anchors.right: parent.right
    anchors.left: parent.left
    anchors.top: prev.bottom
    margin-top: 4

  BotSwitch
    id: creatureDetected
    anchors.left: parent.left
    anchors.right: parent.right
    anchors.top: sepPlayer.bottom
    margin-top: 4
    text-align: center
    text: Creature Detected
    !tooltip: tr('Alerts when a creature is detected on screen.')

  BotSwitch
    id: warnCreature
    anchors.left: parent.left
    anchors.top: prev.bottom
    anchors.right: parent.horizontalCenter
    text-align: center
    margin-top: 5
    text: Creature Name
    !tooltip: tr('Alerts when a creature/npc with name is detected on screen. eg: Benjamin or [boss] would detect a creature with [boss] in name.')

  BotTextEdit
    id: warnName
    anchors.left: prev.right
    margin-left: 4
    anchors.top: prev.top
    anchors.right: parent.right
    margin-top: 1
    height: 17
    font: terminus-10px

  HorizontalSeparator
    id: sepCreature
    anchors.right: parent.right
    anchors.left: parent.left
    anchors.top: prev.bottom
    margin-top: 4

  BotSwitch
    id: healthBelow
    anchors.left: parent.left
    anchors.top: prev.bottom
    anchors.right: parent.horizontalCenter
    text-align: center
    margin-top: 4
    text: Health < 50%
    !tooltip: tr('Alerts when a player is low health.')
  HorizontalScrollBar
    id: healthValue
    anchors.left: parent.horizontalCenter
    anchors.right: parent.right
    anchors.top: healthBelow.top
    margin-left: 3
    margin-top: 2
    minimum: 1
    maximum: 100
    step: 1

  BotSwitch
    id: manaBelow
    anchors.left: parent.left
    anchors.top: healthBelow.bottom
    anchors.right: parent.horizontalCenter
    text-align: center
    margin-top: 4
    text: Mana < 50%
    !tooltip: tr('Alerts when a player is low mana.')
  HorizontalScrollBar
    id: manaValue
    anchors.left: parent.horizontalCenter
    anchors.right: parent.right
    anchors.top: manaBelow.top
    margin-left: 3
    margin-top: 2
    minimum: 1
    maximum: 100
    step: 1

  BotSwitch
    id: privateMessage
    anchors.left: parent.left
    anchors.top: manaBelow.bottom
    anchors.right: parent.right
    text-align: center
    margin-top: 4
    text: Private Message
    !tooltip: tr('Alerts when recieving a private message.')

  BotSwitch
    id: warnLoot
    anchors.left: parent.left
    anchors.top: prev.bottom
    anchors.right: parent.horizontalCenter
    text-align: center
    margin-top: 5
    text: Item List
    !tooltip: tr('Alerts when a loot drop is detected. eg: gold coin')

  BotTextEdit
    id: warnLootName
    anchors.left: prev.right
    margin-left: 4
    anchors.top: prev.top
    anchors.right: parent.right
    margin-top: 1
    height: 17
    font: terminus-10px

  HorizontalSeparator
    id: separator
    anchors.right: parent.right
    anchors.left: parent.left
    anchors.bottom: closeButton.top
    margin-bottom: 8

  Button
    id: closeButton
    !text: tr('Close')
    font: cipsoftFont
    anchors.right: parent.right
    anchors.bottom: parent.bottom
    size: 45 21
    margin-top: 15
    margin-right: 5

29 Sep 2021
Ads