Documentação › Lua

Engine

O módulo Engine liga e desliga os módulos do bot, troca perfis, mexe nos alarmes e nas opções de PvP, e carrega outros scripts.

Ligar e desligar módulos#

Cada módulo tem um par enableX(ligar) / isXEnabled(). Chamar enableX() sem parâmetro liga.

Liga/desligaConsultaMódulo do DrenoxBot
Engine.enableHealing(b)Engine.isHealingEnabled()Healing
Engine.enableHealFriend(b)Engine.isHealFriendEnabled()Heal Friend
Engine.enableTargeting(b)Engine.isTargetingEnabled()Targeting
Engine.enableMagicShooter(b)Engine.isMagicShooterEnabled()Shooter
Engine.enableCaveBot(b)Engine.isCaveBotEnabled()CaveBot
Engine.enableEquipment(b)Engine.isEquipmentEnabled()Equipment
Engine.enableBot(b)Engine.isBotEnabled()O bot inteiro (pausa e retoma)
Engine.enableTimer(b)Engine.isTimerEnabled()Scripts ligados sozinhos ao abrir o bot
lua
-- Sem mana potion: desliga o CaveBot e avisa
if Game.getItemCount(268) == 0 then
  Engine.enableCaveBot(false)
  Client.showMessage("Acabaram as mana potions")
end

PvP e Tools#

Liga/desligaConsultaO que é
Engine.holdTargetEnable(b)Engine.isHoldTargetEnabled()Hold target
Engine.antiPushEnable(b)Engine.isAntiPushEnabled()Anti-push
Engine.autoSSAEnable(b)Engine.isAutoSSAEnabled()Auto SSA
Engine.autoMightRingEnable(b)Engine.isAutoMightRingEnabled()Auto might ring
Engine.runeMaxEnable(b)Engine.isRuneMaxEnabled()Rune max
Engine.reconnectEnable(b)Engine.isReconnectEnabled()Reconectar sozinho

Ajustes:

FunçãoO que faz
Engine.setFirstAntiPushId(itemId) / Engine.setSecondAntiPushId(itemId)Itens que o anti-push joga
Engine.getRuneMaxId() / Engine.setRuneMaxId(itemId)Runa do rune max
lua
Engine.antiPushEnable(true)
Engine.setFirstAntiPushId(3031)

Perfis#

Um perfil é uma config salva com profile save no Console (arquivos profiles/*.json). O número do perfil é a posição do arquivo na pasta, em ordem alfabética, começando em 0. Trocar o perfil de um módulo carrega só a parte daquele módulo.

MóduloTrocarAtualNome
Healing (e Conditions)Engine.healingSwitchProfile(n)Engine.healingGetProfile()Engine.healingGetProfileName(n)
TargetingEngine.targetingSwitchProfile(n)Engine.targetingGetProfile()Engine.targetingGetProfileName(n)
EquipmentEngine.equipmentSwitchProfile(n)Engine.equipmentGetProfile()Engine.equipmentGetProfileName(n)
ShooterEngine.magicShooterSwitchProfile(n)Engine.magicShooterGetProfile()Engine.magicShooterGetProfileName(n)

xSwitchProfile aceita o número do perfil ou o nome dele (Engine.magicShooterSwitchProfile("Boss")), e retorna false se o perfil não existe. xGetProfileName sem parâmetro dá o nome do perfil atual.

lua
-- Troca o Targeting para o perfil 1 quando aparece um player
Game.registerEvent(Game.Events.ALARM, function(tipo)
  if tipo == Enums.AlarmType.PLAYER_ON_SCREEN then
    Engine.targetingSwitchProfile(1)
    print("Targeting: " .. Engine.targetingGetProfileName())
  end
end)

Engine.targetingGetProfileSettings(n) e Engine.targetingSetProfileSettings(n, tabela)#

Lê e grava a parte de Targeting de um perfil, como tabela. Gravar no perfil que está em uso aplica na hora.

lua
local t = Engine.targetingGetProfileSettings(0)
Engine.targetingSetProfileSettings(0, t)

Engine.loadConfig(nome)#

→ booleano

Carrega uma config inteira salva, como profile load <nome> no Console.

lua
Engine.loadConfig("rotworm")

Alarmes#

FunçãoO que faz
Engine.setAlarm(tipo, ligar)Liga ou desliga um alarme de Enums.AlarmType. Alarmes com limite (vida, cap, parado, idle) ligam com um valor padrão (30%, 100 oz, 60 s, 10 min) e desligam com 0. Retorna false para um tipo inválido
Engine.isAlarmEnabled(tipo)Se o alarme está ligado
Engine.allAlarmsEnable(ligar)false silencia todos os alarmes (e o evento ALARM)
Engine.isAllAlarmsDisabled()Se estão silenciados
lua
Engine.setAlarm(Enums.AlarmType.PLAYER_ON_SCREEN, true)

Scripts#

FunçãoO que faz
Engine.loadScript(nome)Liga scripts/<nome>.lua (e deixa ligado ao abrir o bot)
Engine.unloadScript(nome)Desliga o script
Engine.reloadScript(nome)Reinicia o script
Engine.isScriptLoaded(nome)Se o script está rodando
Engine.getScriptsDirectory() / Engine.getScriptsDirectoryUtf8()Caminho da pasta scripts/

Todas retornam true ou false.

lua
if not Engine.isScriptLoaded("alarme") then Engine.loadScript("alarme") end

Informações#

FunçãoRetorna
Engine.getBotVersion()Um texto fixo com a versão da API de scripts
Engine.getLicenseTime()Sempre um número muito grande (existe para scripts do ZeroBot)
Engine.getUserId(minúsculas)O nome do usuário do Windows; true devolve em minúsculas
lua
print(Engine.getUserId(true))