12-06-2023, 09:43 PM
(This post was last modified: 12-15-2023, 07:50 PM by Pabloo.)
Dodawanie skryptów za pomocą pliku.lua
Quote:Używając dowolnego bota wchodzimy kolejno: "edytuj" ->"kliknij tutaj, aby otworzyć katalog bota". Następnie otwieramy plik z botem którego używamy.
Quote:Tworzymy notatnik po czym go otwieramy, następnie klikamy kolejno: plik -> zapisz jako. W nazwie pliku dopisujemy .lua" i zapisujemy. Od teraz każdy skrypt zapisany w notatniku zostaje automatycznie dodany do bota w grze.
Dodawanie skryptów za pomocą "Edytora skryptów w grze"
Quote:Uruchamiamy bota i przechodzimy w zakładkę tools. Następnie klikamy przycisk "ingame script editor".W okienku "Hotkeys editor" wklejamy skrypt, naciskamy „ok” i cieszymy się nowo dodanym skryptem.
Przykładowe skrypty
Quote:Zbieranie rzepy
Code:-- Use item on ground
-- START CONFIG
local items_ids = {10795} -- always inside {} -- e.g. {1234} or {1234,1235,1236}
local max_distance = 6
-- END CONFIG
-- vBot scripting services: F.Almeida#8019
-- if you like it, consider making a donation:
-- ATTENTION:
-- Don't edit below this line unless you know what you're doing.
-- ATENÇAO:
-- Nao mexa em nada daqui para baixo, a nao ser que saiba o que está fazendo.
-- ATENCIÓN:
-- No cambies nada desde aquí, solamente si sabes lo que estás haciendo.
macro(250,"Use Item On Ground",function()
for x = -max_distance, max_distance do
for y = -max_distance, max_distance do
local pos = player:getPosition()
local tile = g_map.getTile({x = pos.x + x, y = pos.y + y, z = pos.z})
if tile and (x ~= 0 or y ~= 0) then
local topItem = tile:getTopUseThing()
if topItem then
if table.find(items_ids,topItem:getId()) then
return g_game.use(topItem)
end
end
end
end
end
end)
Quote:Zbieranie siana
Code:local scytheId = 10817
macro(2000, "Siano", function()
for i, tile in ipairs(g_map.getTiles(posz())) do
for u, item in ipairs(tile:getItems()) do
if (item) then
wheat = { 10809,10811,10813,10815 }
if table.find(wheat, item:getId()) then
useWith(findItem(scytheId), item)
end
end
end
end
end)
Quote:Używanie spella
Code:macro(500, "cast", function()
saySpell("nazwa spella ", 200)
delay(6010)
end)
Quote:Wyświetlanie prywatnych wiadomości zawsze na wierzchu
Code:local height = 50
local widget = setupUI([[
Panel
id: msgPanel
height: 400
width: 200
]], g_ui.getRootWidget())
onTalk(function(name, level, mode, text, channelId, pos)
if (mode ~= 4) then return end
local msgLabel = g_ui.loadUIFromString([[
Label
color: #5ff7f7
background-color: black
opacity: 0.87
]], widget)
msgLabel:setText(name .." ["..level.. "]: " .. text)
msgLabel:setPosition({y = height, x = 10})
if height > 210 then
for msgIndex, message in ipairs(widget:getChildren()) do
message:setPosition({y = message:getPosition().y - 13, x = 10})
if (msgIndex == 1) then message:destroy() end
end
else
height = height + 13
end
end)
Quote:Hold Target
Code:local oldTarget
macro(200, "hold target", function()
if g_game.isAttacking() then
oldTarget = g_game.getAttackingCreature()
end
if (oldTarget and not g_game.isAttacking() and getDistanceBetween(pos(), oldTarget:getPosition()) <= 8) then
g_game.attack(oldTarget)
end
end)
Quote:Szybsze leczenie
Code:local hpPercent = 99
macro(50, "faster healing", function()
if (hppercent() <= hpPercent) then
say(storage.HealText)
end
end)
addTextEdit("HealText", storage.HealText or "NAZWASPELLA", function(widget, text)
storage.HealText = text
end)
Quote:Autofollow
Code:--Description: A macro to follow players through stairs, doors, ladders, sewer gates and some other things.
--A message error appears on the log, but other than that everything seems to run well... save for the eventual hiccups.
--ATTENTION: It might not work if multiple "use objects" that lead to different paths are near eachother.
Follow = macro(1000,"Follow",function()
nome = storage.followLeader
end)
UI.Label("Follow Player:")
addTextEdit("playerToFollow", storage.followLeader or "Heeey", function(widget, text)
storage.followLeader = text
target = tostring(text)
end)
nome = storage.followLeader
pos_p = player:getPosition()
p = getCreatureByName(nome)
onCreaturePositionChange(function(creature, newPos, oldPos)
if Follow.isOn() then
if creature:getName()==player:getName() and getCreatureByName(nome) == nil and newPos.z>oldPos.z then
say('exani tera')
for i = -1,1 do
for j = -1,1 do
local useTile = g_map.getTile({x=posx()+i,y=posy()+j,z=posz()})
g_game.use(useTile:getTopUseThing())
end
end
end
if creature:getName()==nome then
if newPos==nil then
lastPos = oldPos
schedule(200,function()
autoWalk(oldPos)
end)
schedule(1000,function()
for i = -1,1 do
for j = -1,1 do
local useTile = g_map.getTile({x=posx()+i,y=posy()+j,z=posz()})
g_game.use(useTile:getTopUseThing())
end
end
end)
end
if oldPos.z == newPos.z then
schedule(300,function()
local useTile = g_map.getTile({x=oldPos.x,y=oldPos.y,z=oldPos.z})
topThing = useTile:getTopThing()
if not useTile:isWalkable() then
use(topThing)
end
end)
autoWalk({x=oldPos.x,y=oldPos.y,z=oldPos.z})
else
lastPos = oldPos
autoWalk(oldPos)
for i = 1,6 do
schedule(i*200,function()
autoWalk(oldPos)
if getDistanceBetween(pos(), oldPos) == 0 and (posz()>newPos.z and getCreatureByName(nome) == nil) then
say('exani tera')
end
end)
end
local useTile = g_map.getTile({x=newPos.x,y=newPos.y-1,z=oldPos.z})
g_game.use(useTile:getTopUseThing())
end
end
end
end)
Quote:Skrypt na trzymanie mwall`a
Code:local holdMwallHotkey = 'PageUp'
local holdMwallText = 'Hold MWall'
local holdMwallTextCol = 'yellow'
local holdMwallTiles = {}
local holdMwallIsOn = false
onKeyPress(function(keys)
if keys == holdMwallHotkey and holdMwallIsOn then
local tile = getTileUnderCursor()
local currTile = table.find(holdMwallTiles, tile)
if currTile then
holdMwallTiles[currTile]:setText('')
table.remove(holdMwallTiles, currTile)
else
table.insert(holdMwallTiles, tile)
holdMwallTiles[#holdMwallTiles]:setText(holdMwallText, holdMwallTextCol)
end
end
end)
addSwitch('holdMwall', 'Better Hold MWall', function(widget)
widget:setOn(not widget:isOn())
if not widget:isOn() then
for i = 1, #holdMwallTiles do
holdMwallTiles[1]:setText('')
table.remove(holdMwallTiles, 1)
end
end
holdMwallIsOn = widget:isOn()
end)
macro(1, function()
if holdMwallIsOn then
for _, holdMwallTile in pairs(holdMwallTiles) do
if holdMwallTile:getTopThing():getId() ~= 2129 then
useWith(3180, holdMwallTile:getTopUseThing())
return
end
end
end
end)
Sio Friend
Code:
macro(100, "Sio Friend", function()
local friendPercent = tonumber(storage.hpfriend)
local friends = string.split(storage.friendName, ",")
for i, spec in pairs(getSpectators()) do
if spec:getHealthPercent() <= friendPercent then
say('exura sio "' .. spec:getName())
end
end
end)
UI.Label("Player name:")
UI.TextEdit(storage.friendName or "NAME,NAME,NAME", function(widget, text)
storage.friendName = text
end)
UI.Label("Heal below %:")
UI.TextEdit(storage.hpfriend or "85", function(widget, text)
storage.hpfriend = text
end)
Ruch gdy bot się zawiesi
Open Monster boxes
Alarm po śmierci
Follow red skull
Attack Red Skull
Code:
tandTime = now
onPlayerPositionChange(function(x,y)
standTime = now
end)
function getStandTime()
return now - standTime
end
local SECONDS = 30
macro(2000, "noMovmenWalk", function()
if isInPz() then return end
local time = SECONDS * 1000
if getStandTime() > time then
walk(math.random(0,3))
end
end)
Open Monster boxes
Code:
local ICON_ID = 8745 -- id ikony
local omb = macro(500, "Open Monster Boxes", function()
for i, tile in ipairs(g_map.getTiles(posz())) do
for u,item in ipairs(tile:getItems()) do
if (item and item:getId() == 8745) then
g_game.use(item)
return
end
end
end
end)
addIcon("OMB", {item={id = ICON_ID}, movable=true}, function(icon, isOn)
omb.setOn(isOn)
end)
Alarm po śmierci
Code:
xxx = macro(1000000, "Alram After Dead", function() end)
onPlayerHealthChange(function(healthPercent)
if xxx.setOff() then return end
if healthPercent <= 0 then
playAlarm()
delay(1000)
end
end)
Follow red skull
Code:
local target
local s = macro(100, "FOLLOW RED SKULL", function()
if target then return end
for i, spec in pairs(getSpectators(false)) do
if spec:isPlayer() and spec:getName() ~= name() then
if spec:getSkull() >= 4 and not g_game.isFollowing() then
g_game.follow(spec)
target = spec
break
end
end
end
end)
onCreatureDisappear(function(creature)
if not target then return end
if s.isOff() then return end
if creature:getName() ~= target:getName() then return end
target = nil
end)
Attack Red Skull
Code:
local target
local s = macro(100, "ATTACK RED SKULL", function()
if target then return end
for i, spec in pairs(getSpectators(false)) do
if spec:isPlayer() and spec:getName() ~= name() then
if spec:getSkull() >= 4 then
g_game.attack(spec)
target = spec
break
end
end
end
end)
onCreatureDisappear(function(creature)
if not target then return end
if s.isOff() then return end
if creature:getName() ~= target:getName() then return end
target = nil
end)
Anty Trap
Code:
macro(100, "Anti Trap", function()
CaveBot.setOff(isTrapped())
TargetBot.setOn(isTrapped())
end)
Fast attack
Combo Spells (for mage)
Code:
macro(1, "Fast Attack", function()
if not g_game.isAttacking() then
for i, spec in ipairs(getSpectators(posz())) do
if spec:isMonster() then
g_game.attack(spec)
g_game.cancelAttack()
break
end
end
end
end)
Combo Spells (for mage)
Code:
local DELAY = 1000 -- odstep miedzy czarami
local spells = {
"Spell1",
"Spell2",
"Spell3"
}
function castSpells()
for i = 1, #spells do
schedule(DELAY*(i-1), function()
say(spells[i])
end)
end
delay(#spells * DELAY)
end
macro(100, "NAME", function()
if not g_game.isAttacking() then return end
castSpells()
end)
Code:
local target
local s = macro(100, "ATTACK ALL PLAYERS", function()
if target then return end
local players = string.split(storage.attackName, "\n")
for i, spec in pairs(getSpectators()) do
if not table.contains(players, spec:getName(), true) then
g_game.attack(spec)
target = spec
break
end
end
end)
UI.Button("Ignore Attack List", function(newText)
UI.MultilineEditorWindow(storage.attackName or "", {title="Ignore Attack List", description="Ignore Attack List \nExample:\nPlayer1\nPlayer2\nPlayer3"}, function(text)
storage.attackName = text
end)
end)
onCreatureDisappear(function(creature)
if not target then return end
if s.isOff() then return end
if creature:getName() ~= target:getName() then return end
target = nil
end)