Jump to content

Request Script


Zelek

Recommended Posts

7 hours ago, asktheages said:

Dear Zelek,

 

Could you tell me how to set the X Y Z properly? If i put a certain value it wont work as intended. I need a range - lets say X range 931 - 999 , Y - 700-750 (so the box goes around all the respawn where i cavebot). Thanks

function Position:isInRange(from, to)
	local zone = {
		nW = {
			x = (from.x < to.x and from.x or to.x),
			y = (from.y < to.y and from.y or to.y),
			z = (from.z < to.z and from.z or to.z)
		},
		sE = {
			x = (to.x > from.x and to.x or from.x),
			y = (to.y > from.y and to.y or from.y),
			z = (to.z > from.z and to.z or from.z)
		}
	}

	if  self.x >= zone.nW.x and self.x <= zone.sE.x
	and self.y >= zone.nW.y and self.y <= zone.sE.y
	and self.z >= zone.nW.z and self.z <= zone.sE.z then
		return true
	end
	return false
end

local fromPos = Position.new(123, 456, 7) -- top left corner
local toPos = Position.new(321, 654, 7) -- bottom right corner

local playerPos = g_game.getLocalPlayer():getPosition()

if not playerPos:isInRange(fromPos, toPos) then
    playSound("alarm.wav")
    if getOption("Global/BotPaused") == "false" then
        setOption("Global/BotPaused", "true")
        sleep(300000)
    end
    if getOption("Global/BotPaused") == "true" then
        setOption("Global/BotPaused", "flase")
    end
end

auto(500)

 

Link to comment
Share on other sites

21 hours ago, lediv said:

Is Script to use hotkey for example f12 on monster's dead body possible while standing 1sqm next to it?

Using hotkey at specified position is not supported.

However you can use for example "g_game.useItemOnPosition(itemId, position)"

Link to comment
Share on other sites

21 hours ago, lediv said:

yeah that would do the job, but I lack scripting skills so if you'd have time to write something like that, I'd much appreciate. Hovever It'd have to work like that: where there are no monsters on screen the bot would only use item on dead bodies and pause cavebot, after after there are no bodies, he would turn on cavebot again. Is that possible? If that is too demanding to write that script or it's not possible than no problem it's not as necessary. It's just that on the ots I play it's a great way to earn money so it'd help

auto(100)

local corpseIds = {296, 4133} -- ids of bodies
local itemIdToUse = 3456 -- id of the item to use on bodies

function table.find(t, value)
  for k,v in pairs(t) do
    if v == value then return k end
  end
end

local tiles = g_map.getTiles()
local corpses = {}
for _, tile in pairs(tiles) do
    if tile:getPosition():getDistance(g_game.getLocalPlayer():getPosition()) <= 1 then
        local topItem = tile:getTopItem()
        if topItem and table.find(corpseIds, topItem:getId()) then
            table.insert(corpses, topItem)
        end
    end
end

if #corpses > 0 then
    for _, corpse in pairs(corpses) do
        setOption("Cavebot/Enabled", "false")
        g_game.stop()
        g_game.useItemOnPosition(itemIdToUse, corpse:getPosition())
        sleep(1000)
    end
else
    setOption("Cavebot/Enabled", "true")
end

 

Remember to enable "Read map tiles" in Info & options tab.

  • Like 1
Link to comment
Share on other sites

2 hours ago, Zelek said:

auto(100)

local corpseIds = {296, 4133} -- ids of bodies
local itemIdToUse = 3456 -- id of the item to use on bodies

function table.find(t, value)
  for k,v in pairs(t) do
    if v == value then return k end
  end
end

local tiles = g_map.getTiles()
local corpses = {}
for _, tile in pairs(tiles) do
    if tile:getPosition():getDistance(g_game.getLocalPlayer():getPosition()) <= 1 then
        local topItem = tile:getTopItem()
        if topItem and table.find(corpseIds, topItem:getId()) then
            table.insert(corpses, topItem)
        end
    end
end

if #corpses > 0 then
    for _, corpse in pairs(corpses) do
        setOption("Cavebot/Enabled", "false")
        g_game.stop()
        g_game.useItemOnPosition(itemIdToUse, corpse:getPosition())
        sleep(1000)
    end
else
    setOption("Cavebot/Enabled", "true")
end

 

Remember to enable "Read map tiles" in Info & options tab.

damn it really works, you're the best man

Link to comment
Share on other sites

1 hour ago, nowskivip said:

Hey Zelek is this possible to create alert for item on screen? like if X item appears on screen bot will play alarm or something like this?

auto(100)
local idsToFind = {3031, 3035} -- items ids to find

local tiles = g_map.getTiles()
for _, tile in pairs(tiles) do
    local topItem = tile:getTopItem()
    if topItem then
        for _, id in pairs(idsToFind) do
            if topItem:getId() == id then
                playSound("alarm.wav")
                sleep(1000)
                return
            end
        end
    end
end

Remember to enable "Read map tiles" in Info & options tab.

  • Like 1
Link to comment
Share on other sites

1 hour ago, Zelek said:

auto(100)
local idsToFind = {3031, 3035} -- items ids to find

local tiles = g_map.getTiles()
for _, tile in pairs(tiles) do
    local topItem = tile:getTopItem()
    if topItem then
        for _, id in pairs(idsToFind) do
            if topItem:getId() == id then
                playSound("alarm.wav")
                sleep(1000)
                return
            end
        end
    end
end

 

Remember to enable "Read map tiles" in Info & options tab.

Instant bot crash after enabling this script 😐 read map tiles is on ;-;  (tried on rots)

Link to comment
Share on other sites

16 hours ago, nowskivip said:

Instant bot crash after enabling this script 😐 read map tiles is on ;-;  (tried on rots)

It works fine for me, however I've made some changes so let me know if it still crashes the bot for you with beta14

  • Thanks 1
Link to comment
Share on other sites

20 hours ago, Zelek said:



auto(100)
local idsToFind = {3031, 3035} -- items ids to find

local tiles = g_map.getTiles()
for _, tile in pairs(tiles) do
    local topItem = tile:getTopItem()
    if topItem then
        for _, id in pairs(idsToFind) do
            if topItem:getId() == id then
                playSound("alarm.wav")
                sleep(1000)
                return
            end
        end
    end
end

 

Remember to enable "Read map tiles" in Info & options tab.

changed auto 100 to auto 2000 and everything works now, thank you ❤️

Link to comment
Share on other sites

On 2/18/2021 at 2:26 PM, xcorek said:

Hey Zelek, I need 2 scripts.

1. barrier on if health 50%< ///  barrier off if health 50%>

2. alarm if anyone on the vip list goes online 

 

1. Just use  spell helaler

2.

auto(100)
if not g_game.isOnline() then return end
local messagesToDetect = {"xxx", "xxx", "xxx", "xxx"} -- which words should it look for?
local respondToMessage = false -- should it respond if trigger word is found?
local messageToRespond = "im here" -- what should it respond?
local pauseBot = false -- should it pause the bot?
local playAlarm = true -- should it play alarm?

connect("g_game", "onTalkMessage", checkBotMessage)

function checkBotText(mode, message)
  for _, messageToDetect in pairs(messagesToDetect) do
    if string.find(message, messageToDetect, 1, true) then
      if respondToMessage then
      	g_game.talk(messageToRespond)
      end
      if pauseBot then
      	setOption("Global/BotPaused", "true")
      end
      if playAlarm then
        for i = 1, 3 do
          playSound("alarm.wav")
          sleep(1000)
        end
      end
      return
    end
  end
end

 

Link to comment
Share on other sites

On 2/19/2021 at 11:43 AM, kuzzuki said:

Hey Zelek, I need 2 scripts.

the first on the spell bit, but with a cold 3 seconds so that he does not spam on ROTS, the second is for treatment, so that he does not spam all the time because hotkeye are on F1 and spam is terrible

auto(100)
if not g_game.isOnline() then return end
if  g_game.isAttacking() then
	g_game.sendKey("F1")
	sleep(3000)
end

 

Edited by zakne11
  • Like 1
Link to comment
Share on other sites

2 hours ago, kuzzuki said:

Hello, I have a question, is there a script that turns off targeting and cavebot and you can set it in the bot on hotkey?

if getOption("Cavebot/Enabled") == "true" then
    setOption("Cavebot/Enabled", "false")
else
    setOption("Cavebot/Enabled", "true")
end
if getOption("Targeting/Enabled") == "true" then
    setOption("Targeting/Enabled", "false")
else
    setOption("Targeting/Enabled", "true")
end

place it in hotkey section in scripts section

Link to comment
Share on other sites

5 hours ago, zakne11 said:

if getOption("Cavebot/Enabled") == "true" then
    setOption("Cavebot/Enabled", "false")
else
    setOption("Cavebot/Enabled", "true")
end
if getOption("Targeting/Enabled") == "true" then
    setOption("Targeting/Enabled", "false")
else
    setOption("Targeting/Enabled", "true")
end

place it in hotkey section in scripts section

something I don't want to work ;/

 

Link to comment
Share on other sites

Dear Zelek,

 

Is there any option for bot to auto-back from respawn to the city and finalize the task, taking another, then coming back to respawn?

I imagine it like this: i add a specific path and actions in Cavebot, but the specific wpt lines activate ONLY, when !task (automaticaly sent) shows 350/350.  Or maybe it just jumps and activates the Waypoints_2 tab, then switches to the Waypoints_1 when back (maybe at certain SQM)? 

 

Edited by asktheages
Link to comment
Share on other sites

4 hours ago, asktheages said:

Dear Zelek,

 

Is there any option for bot to auto-back from respawn to the city and finalize the task, taking another, then coming back to respawn?

I imagine it like this: i add a specific path and actions in Cavebot, but the specific wpt lines activate ONLY, when !task (automaticaly sent) shows 350/350.  Or maybe it just jumps and activates the Waypoints_2 tab, then switches to the Waypoints_1 when back (maybe at certain SQM)? 

 

 

gotolabel (string sectionName , string labelName )

Sets the current waypoint to the one of labelName Label in sectionName Section.

gotolabel("HUNTING", "start-hunting")

just you have to prepare tab changer in script

 

Link to comment
Share on other sites

×
×
  • Create New...