Documentation › Lua
Engine
The Engine module turns the bot's modules on and off, switches profiles, handles alarms and PvP options, and loads other scripts.
Turning modules on and off#
Each module has a pair enableX(on) / isXEnabled(). Calling enableX() with no parameter turns it on.
| On/off | Query | DrenoxBot module |
|---|---|---|
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() | The whole bot (pause and resume) |
Engine.enableTimer(b) | Engine.isTimerEnabled() | Scripts turned on by themselves when the bot opens |
-- No mana potions: turn off the CaveBot and warn
if Game.getItemCount(268) == 0 then
Engine.enableCaveBot(false)
Client.showMessage("Out of mana potions")
endPvP and Tools#
| On/off | Query | What it is |
|---|---|---|
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() | Reconnect by itself |
Settings:
| Function | What it does |
|---|---|
Engine.setFirstAntiPushId(itemId) / Engine.setSecondAntiPushId(itemId) | Items the anti-push drops |
Engine.getRuneMaxId() / Engine.setRuneMaxId(itemId) | Rune used by rune max |
Engine.antiPushEnable(true)
Engine.setFirstAntiPushId(3031)Profiles#
A profile is a config saved with profile save in the Console (files profiles/*.json). The profile number is the file's position in the folder, in alphabetical order, starting at 0. Switching a module's profile loads only that module's part.
| Module | Switch | Current | Name |
|---|---|---|---|
| Healing (and Conditions) | Engine.healingSwitchProfile(n) | Engine.healingGetProfile() | Engine.healingGetProfileName(n) |
| Targeting | Engine.targetingSwitchProfile(n) | Engine.targetingGetProfile() | Engine.targetingGetProfileName(n) |
| Equipment | Engine.equipmentSwitchProfile(n) | Engine.equipmentGetProfile() | Engine.equipmentGetProfileName(n) |
| Shooter | Engine.magicShooterSwitchProfile(n) | Engine.magicShooterGetProfile() | Engine.magicShooterGetProfileName(n) |
xSwitchProfile takes the profile's number or its name (Engine.magicShooterSwitchProfile("Boss")), and returns false if the profile does not exist. xGetProfileName with no parameter gives the current profile's name.
-- Switch Targeting to profile 1 when a player shows up
Game.registerEvent(Game.Events.ALARM, function(kind)
if kind == Enums.AlarmType.PLAYER_ON_SCREEN then
Engine.targetingSwitchProfile(1)
print("Targeting: " .. Engine.targetingGetProfileName())
end
end)Engine.targetingGetProfileSettings(n) and Engine.targetingSetProfileSettings(n, table)#
Reads and writes the Targeting part of a profile, as a table. Writing to the profile in use applies it right away.
local t = Engine.targetingGetProfileSettings(0)
Engine.targetingSetProfileSettings(0, t)Engine.loadConfig(name)#
→ boolean
Loads a whole saved config, like profile load <name> in the Console.
Engine.loadConfig("rotworm")Alarms#
| Function | What it does |
|---|---|
Engine.setAlarm(type, on) | Turns an Enums.AlarmType alarm on or off. Alarms with a limit (health, cap, stuck, idle) turn on with a default value (30%, 100 oz, 60 s, 10 min) and turn off with 0. Returns false for an invalid type |
Engine.isAlarmEnabled(type) | Whether the alarm is on |
Engine.allAlarmsEnable(on) | false silences every alarm (and the ALARM event) |
Engine.isAllAlarmsDisabled() | Whether they are silenced |
Engine.setAlarm(Enums.AlarmType.PLAYER_ON_SCREEN, true)Scripts#
| Function | What it does |
|---|---|
Engine.loadScript(name) | Turns on scripts/<name>.lua (and keeps it on when the bot opens) |
Engine.unloadScript(name) | Turns the script off |
Engine.reloadScript(name) | Restarts the script |
Engine.isScriptLoaded(name) | Whether the script is running |
Engine.getScriptsDirectory() / Engine.getScriptsDirectoryUtf8() | Path of the scripts/ folder |
All of them return true or false.
if not Engine.isScriptLoaded("alarme") then Engine.loadScript("alarme") endInformation#
| Function | Returns |
|---|---|
Engine.getBotVersion() | A fixed text with the scripting API version |
Engine.getLicenseTime() | Always a very large number (exists for ZeroBot scripts) |
Engine.getUserId(lowercase) | The Windows user name; true returns it in lowercase |
print(Engine.getUserId(true))
Comments
to comment.