Everyone who has never used our Bots before, can test each one for 2 days without any limitation.
The trial is given automatically when you login on the Bot, but in some cases it wouldn't work (security reasons).
If this happens, send me a private message and i will be checking the failed trials manually and adding it for those who didn't get it.
We are looking for resellers who may accept payment methods different from ours, including classictibia's cash, realesta's cash, mastercores' cash, etc. Interested? Click here at anytime.



Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
VIP Player In Combat
#1
I was wondering if there's a script i could add so that, if a person on my VIP list gets in combat (unable to logout) my other characters log out?

I have one LUA for characters logging out if one of my VIP isn't online. But some people are sneaky and therefore.

If my VIP is in combat - Logout

Is this possible?
Reply

#2
Hello.

Well, there are many ways to achieve that, but you can only do that if you run a LUA script on the bait character.
1. You can make bait character send a PM to other characters and once they receive the PM then logout.
1. You can make bait character write in a file and other characters reads this file then logout.
etc.

# Private message approach #
How it works: Bait character send a PM to other characters and once they receive the PM then logout. Alternatively (reason explained below), send a PM to another character which logouts then other characters logouts as well.

The downside of using the PM approach is that you would need to send messages to all the makers you want to log out. If you have a lot of characters, it will take a while to avoid getting mutated.
But this can be solved in a simple way: Using scripts to check the vip list on all makers except in one maker. This exception will use the script that will receive the private message and logout. So you will only send a private message to this maker and that maker will log out, so everyone else will log out too.

Example: Let's say that you have 5 characters. 1 character blocking path (let's call it 'bait character') and 4 characters making runes (let's call it makers A, B, C and D).
1. Use the script #1 on character blocking path (bait character). You should setup one of the makers names (for example: "maker A") on table "PLAYERS", so once bait character see a player, etc it will send a private message ONLY for "maker A".
2. Use the script #2 on "maker A". It will receive the private message from "bait character" then logout.
3. Add "maker A" to other makers (B, C and D) vip list, use the script #3 on the other makers (B, C and D). They will check if "maker A" is offline then logout.


Script #1 to be used on bait character to check and send private message. If you follow my recommendation, you just need to leave one maker name on the script below.
local PLAYERS = { 'main maker' } -- Players to send message.
local MESSAGE = 'player' -- Sends this message to players on table above.
local DELAY_BETWEEN_MESSAGES = 1500 -- Delay (in milliseconds) between writing a message to a player to avoid being muted.
local DELAY_BETWEEN_WARNINGS = 6 -- In seconds. How long should it wait between warnings. So you dont get warned multiple times about same.

local CHECK_PLAYERS = true -- Check for players.
local CHECK_PLAYERS_DIST = 5 -- Maximum distance to trigger this.
local CHECK_PLAYERS_SAFE = { 'main character' } -- Safe list.

local CHECK_HP = true -- Check for your health%.
local CHECK_HP_WARNING = 80 -- If your health% lower than that warn another player.

local CHECK_BATTLESIGN = true -- Check for battle sign.



if LAST_WARNING_TIME == nil then
    LAST_WARNING_TIME = 0
end

if (runningtime() - LAST_WARNING_TIME) >= DELAY_BETWEEN_WARNINGS and ((CHECK_BATTLESIGN and battlesigned()) or (CHECK_HP and hppc() < CHECK_HP_WARNING) or (CHECK_PLAYERS and paroundignore(CHECK_PLAYERS_DIST, table.unpack(CHECK_PLAYERS_SAFE)) > 0)) then
    for _, player in ipairs(PLAYERS) do
        say('*' .. player .. '* ' .. MESSAGE)
        if #PLAYERS > 1 and DELAY_BETWEEN_MESSAGES > 0 then
            wait(DELAY_BETWEEN_MESSAGES)
        end
    end
    LAST_WARNING_TIME = runningtime()
end


Script #2 to use on characters that will receive the private message. Once this character receives the private message, it will logout. If you follow my recommendation, you will use the script below only in a single maker, which should be listed on script above.
local PLAYER = 'bait character' -- Bait character name. To prevent someone (maybe even a GM) from discovering the message and making your makers log out.
local MESSAGE = 'player'

local LAST_PM = getlastprivatemessage()
if LAST_PM.visible and LAST_PM.sender:lower() == PLAYER:lower() and LAST_PM.content:lower() == MESSAGE then
     logout()
end


Script #3 to use on other makers to check for the maker #1. When maker #1 logout then who's using this script will logout as well.
local VIPS = { 'main maker'} -- Characters to check. If one of them is offline then logout.

if connected() then
    local vips = getviplist()
    for _, vip in ipairs(vips) do
        if vip.status == false and table.find(VIPS, vip.name) ~= nil then
            logout()
            break
        end
    end
end

# File approach #
How it works: Bait character writes in a file and other characters checks for this file then logout.

Script to be used on bait character to check and write file.
local FILE = 'runemaker' -- Writes on this file.
local CHECK_PLAYERS = true -- Check for players.
local CHECK_PLAYERS_DIST = 5 -- Maximum distance to trigger this.
local CHECK_PLAYERS_SAFE = { 'main character' } -- Safe list.

local CHECK_HP = true -- Check for your health%.
local CHECK_HP_WARNING = 80 -- If your health% lower than that warn another player.

local CHECK_BATTLESIGN = true -- Check for battle sign.


if (CHECK_BATTLESIGN and battlesigned()) or (CHECK_HP and hppc() < CHECK_HP_WARNING) or (CHECK_PLAYERS and paroundignore(CHECK_PLAYERS_DIST, table.unpack(CHECK_PLAYERS_SAFE)) > 0) then
    file.rewrite(FILE, unixtime())
    wait(500)
end


local FILE = 'runemaker' -- Check for this file.

if connected() then
    local file_text = file.readfile(FILE)
    if type(file_text) == 'string' and file_text ~= '' then
        local timestamp = tonumber(file_text)
        if timestamp ~= nil and math.abs(timestamp - unixtime()) <= 3 then
            logout()
            wait(1000)
        end
    end
end
Reply

#3
First, don't write inside a quote. It's bad to read, because I have to look up what you wrote inside a post you quoted.

If you read what I wrote above each script, it will tell you what each script does and even where you should use it.

Script #1
It will only send a private message when you get battle sign (added check for players and hp%). That means if a player just shows up it WOULD do nothing, but after my changes it will trigger as well.

I just edited my post that contains the script to try make it more clear and added few options on PM approach -> script#1, to check for hp% and players on screen as well.
|Only Registered members can see download links. | Click here to buy subscription or here to register.
Reply

#4
@Arkilys

I tried your write to file approach as that seems abit easier. However


I added this to my "look out" character
local FILE = 'runemaker' -- Writes on this file.

if battlesigned() then
    file.rewrite(FILE, os.time(os.date("!*t")))
    wait(500)
end

BUT, when I added below part to one of my makers
local FILE = 'runemaker' -- Check for this file.

if connected() then
    local file_text = file.readfile(FILE)
    if type(file_text) == 'string' and file_text ~= '' then
        local timestamp = tonumber(file_text)
        if timestamp ~= nil then

        if math.abs(timestamp - os.date("!*t")) <= 3 then
            logout()
            wait(1000)
        end
    end
end

I got the following error message, on my maker.

18:33:50 - Core:Lua:ExecuteScript:DoString:Persistent01: 15: 'end' expected (to close 'if' at line 3) near '<eof>'
Reply

#5
Try the second script like this:
local FILE = 'runemaker' -- Check for this file.

if connected() then
    local file_text = file.readfile(FILE)
    if type(file_text) == 'string' and file_text ~= '' then
        local timestamp = tonumber(file_text)
        if timestamp ~= nil and math.abs(timestamp - os.date("!*t")) <= 3 then
            logout()
            wait(1000)
        end
    end
end
Reply

#6
@Arkilys

I tried your code, and then I got the following error on my look out instead:

18:39:44 - Core:Lua:ExecuteScript:DoString:Persistent02: NLua.Exceptions.LuaScriptException: function

Then again, I'm using what you first wrote:
local FILE = 'runemaker' -- Writes on this file.

if battlesigned() then
    file.rewrite(FILE, os.time(os.date("!*t")))
    wait(500)
end

Should I use your updated script instead?
Reply

#7
That's not what you asked for, you didn't mention it.

Your request was to check when the bait character on your VIP list gets in combat (unable to logout), that's battle sign, then maker characters logout. And the script I posted does that.

Making other requests after the script is ready is not acceptable, because it can change the structure and maybe even make the script need to be rewritten from scratch, which leads to an unnecessary waste of time. Making people who are helping you waste time is very rude. Please don't do this again, otherwise I won't be able to help anymore. :/

If you read the guidelines, which are quite large in the Requests section, you will see that it says about that:
|Only Registered members can see download links. | Click here to buy subscription or here to register.


Anyway, I changed the script to check if there are players on the screen, battle sign and even their hp%.
Reply

#8
@Arkilys
I might have missused the words.

I currently have a lookout. That I use as a VIP from another one of your posts for script. If he logs out the others logs out.

I asked in the post "if a person on my VIP list gets in combat (unable to logout) my other characters log out?"

That means, if my lookout, gets in combat, somehow, my other chars logs out too. That's what you're sending me as well, that's what I'm looking for too. I just can't seem to get it to work.

I understand you don't want me wasting your time and I apologise if I have done that. Was not my intention at all and I have read through the link you sent.

Anyway, i'm getting the same error using your updated "for the write to file" on my look out.

So basically, when using this script on my lookout
local FILE = 'runemaker' -- Writes on this file.
local CHECK_PLAYERS = true -- Check for players.
local CHECK_PLAYERS_DIST = 5 -- Maximum distance to trigger this.
local CHECK_PLAYERS_SAFE = { 'main character' } -- Safe list.

local CHECK_HP = true -- Check for your health%.
local CHECK_HP_WARNING = 80 -- If your health% lower than that warn another player.

local CHECK_BATTLESIGN = true -- Check for battle sign.


if (CHECK_BATTLESIGN and battlesigned()) or (CHECK_HP and hppc() < CHECK_HP_WARNING) or (CHECK_PLAYERS and paroundignore(CHECK_PLAYERS_DIST, table.unpack(CHECK_PLAYERS_SAFE)) > 0) then
    file.rewrite(FILE, os.time(os.date("!*t")))
    wait(500)
end



I get this error message on the lookout WHEN he gets in combat
18:56:56 - Core:Lua:ExecuteScript:DoString:Persistent02: NLua.Exceptions.LuaScriptException: function

My maker with
local FILE = 'runemaker' -- Check for this file.

if connected() then
    local file_text = file.readfile(FILE)
    if type(file_text) == 'string' and file_text ~= '' then
        local timestamp = tonumber(file_text)
        if timestamp ~= nil and math.abs(timestamp - os.date("!*t")) <= 3 then
            logout()
            wait(1000)
        end
    end
end
Doesn't get an error message though.
Reply

#9
Hello.

Check for player on screen is not combat. The original script that you requested and that i developed was just about checking battle sign (pz lock). But i thought about player check and health % check while developing it, that's why I actually added such options. Let's move on.

Yeah, it seems that LUA version that Bot is using has some crazy bug on os.time() function, so I had to add a function on Bot to return some timestamp to be used.

First, download and install this build:
|Only Registered members can see download links. | Click here to buy subscription or here to register.

Because i've added a function that you need on this script. Then press CTRL+F5 on this page, i've edited my the script. So try the new one there.
Reply

#10
@Arkilys

Do you mean I should use that client instead? Not 100% sure what you mean, I appologise.
Reply



Forum Jump:



Forum software by © MyBB Theme © iAndrew 2016