Log in

View Full Version : Script to logout



xwicuxx
08-18-2016, 06:23 PM
Im looking for script that will at hour XX:XX kill all monsters around and logout.

Zingron
08-18-2016, 10:52 PM
--[[ time in 24 hour format, eg, 21:00, 12:30, 04:35 ]]

local hourTime = 07 -- time in hours (00 to 24)
local minsTime = 20 -- time in minutes (00 to 60)



--[[ leave below this alone]]

function creatureCount()
local count = 0
for name, cid in Creature.iMonsters() do
count = count + 1
end
return count
end

while true do
-- get local time
local logTime = os.date("*t")

if logTime.hour == hourTime and logTime.min == minsTime then
-- stop the walker if time is equal to variable time
Walker.Stop()
-- wait until there are no creatures on screen..
while creatureCount() ~= 0 do
wait(1000)
end
-- ..then exit the client
os.exit()
end
wait(5000)
end

Trykon
08-19-2016, 12:47 AM
--[[ time in 24 hour format, eg, 21:00, 12:30, 04:35 ]]

local hourTime = 07 -- time in hours (00 to 24)
local minsTime = 20 -- time in minutes (00 to 60)



--[[ leave below this alone]]

function creatureCount()
local count = 0
for name, cid in Creature.iMonsters() do
count = count + 1
end
return count
end

while true do
-- get local time
local logTime = os.date("*t")

if logTime.hour == hourTime and logTime.min == minsTime then
-- stop the walker if time is equal to variable time
Walker.Stop()
-- wait until there are no creatures on screen..
while creatureCount() ~= 0 do
wait(1000)
end
-- ..then exit the client
os.exit()
end
wait(5000)
end




But char will be left there anyway for some time, cuz of log out lock
Not sure if it is safe, when i make scripts to exit i let it exit in first reached pz, this way char disapears stright away

Zingron
08-19-2016, 01:43 AM
It will still kill any creatures around before it triggers the xlog. XLogging is safe if there are no creatures around that can do waves, as the creatures will not directly target you if you are disconnected.

xwicuxx
I can add Self.isInFight() which will wait for your battle sign to drop (if you want to be sure of your characters safety), but it would result in your character standing there for a while if you are cursed by anything.

xwicuxx
08-19-2016, 06:27 AM
Yes, please add it, its 100% exact script im looking for.

Zingron
08-19-2016, 10:51 AM
--[[ time in 24 hour format, eg, 21:00, 12:30, 04:35 ]]



local hourTime = 11 -- time in hours (00 to 24)

local minsTime = 50 -- time in minutes (00 to 60)







--[[ leave below this alone]]



function creatureCount()

local count = 0

for name, cid in Creature.iMonsters() do

count = count + 1

end

return count

end



while true do

-- get local time

local logTime = os.date("*t")



if logTime.hour == hourTime and logTime.min == minsTime then

-- stop the walker if time is equal to variable time

Walker.Stop()

-- wait until there are no creatures on screen..

while creatureCount() ~= 0 or Self.isInFight() do

wait(1000)

end

-- ..then exit the client

os.exit()

end

wait(5000)

end