• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Saves

Donio

Banned User
Joined
Jun 24, 2008
Messages
4,004
Reaction score
16
Location
Manhattan, New York
Hello, I am currently having some issues with saves on my Server.. I am getting this error in the console:

Code:
[Error - GlobalEvent Interface] 
data/globalevents/scripts/save.lua:onThink
Description: 
data/globalevents/scripts/save.lua:30: bad argument #1 to 'maxn' (table expected, got nil)
stack traceback:
	[C]: in function 'maxn'
	data/globalevents/scripts/save.lua:30: in function <data/globalevents/scripts/save.lua:29>
[Error - GlobalEvents::think] Couldn't execute event: save

this is the saving script I use in globalevents:

Code:
local config = {
	shallow = "no",
	delay = 120,
	events = 30
}

config.shallow = getBooleanFromString(config.shallow)

local function executeSave(seconds)
	if(isInArray(config.broadcast, seconds)) then
		local text = ""
		if(not config.shallow) then
			text = "Full s"
		else
			text = "S"
		end

		text = text .. "erver save within " .. seconds .. " seconds, please mind it may freeze!"
		doBroadcastMessage(text)
	end

	if(seconds > 0) then
		addEvent(executeSave, config.events * 1000, seconds - config.events)
	else
		doSaveServer(config.shallow)
	end
end

function onThink(interval, lastExecution, thinkInterval)
	if(table.maxn(config.broadcast) == 0) then
		doSaveServer(config.shallow)
	else
		executeSave(config.delay)
	end

	return true
end

and inside globalevents.xml:
Code:
<globalevent name="save" interval="900" event="script" value="save.lua"/>

What can the problem be?.. The server isnt saving at all <_<

I am still using tfs -> 0.3.6.
 
LUA:
local config = {
    shallow = "no",
    delay = 120,
    events = 30
}

config.shallow = getBooleanFromString(config.shallow)

local function executeSaveServer(seconds)
    if(isInArray(config.broadcast, seconds)) then
        local text = ""
        if(not config.shallow) then
            text = "Full s"
        else
            text = "S"
        end

        text = text .. "erver save within " .. seconds .. " seconds, please mind it may freeze!"
        doBroadcastMessage(text)
    end

    if(seconds > 0) then
        addEvent(executeSaveServer, config.events * 1000, seconds - config.events)
    else
        doSaveServer(config.shallow)
    end
end

function onThink(interval, lastExecution, thinkInterval)
    if(table.maxn(config.broadcast) == 0) then
        doSaveServer(config.shallow)
    else
        executeSaveServer(config.delay)
    end

    return true
end
 
Code:
local config = {
[B][COLOR="red"]	broadcast = {120, 30},[/COLOR][/B]
	shallow = "no",
	delay = 120,
	events = 30
}

config.shallow = getBooleanFromString(config.shallow)

local function executeSave(seconds)
	if(isInArray(config.broadcast, seconds)) then
		local text = ""
		if(not config.shallow) then
			text = "Full s"
		else
			text = "S"
		end

		text = text .. "erver save within " .. seconds .. " seconds, please mind it may freeze!"
		doBroadcastMessage(text)
	end

	if(seconds > 0) then
		addEvent(executeSave, config.events * 1000, seconds - config.events)
	else
		doSaveServer(config.shallow)
	end
end

function onThink(interval, lastExecution, thinkInterval)
	if(table.maxn(config.broadcast) == 0) then
		doSaveServer(config.shallow)
	else
		executeSave(config.delay)
	end

	return true
end
 
LUA:
local config = {
	shallow = "no",
	delay = 120,
	events = 30
}

config.shallow = getBooleanFromString(config.shallow)

local function executeSave(seconds)
	if(isInArray(config.broadcast, seconds)) then
		local text = ""
		if(not config.shallow) then
			text = "Full s"
		else
			text = "S"
		end

		text = text .. "erver save within " .. seconds .. " seconds, please mind it may freeze!"
		doBroadcastMessage(text)
	end

	if(seconds > 0) then
		addEvent(executeSave, config.events * 1000, seconds - config.events)
	else
		doSaveServer(config.shallow)
	end
end

function onThink(interval, lastExecution, thinkInterval)
	if(table.max(config.broadcast) == 0) then
		doSaveServer(config.shallow)
	else
		executeSave(config.delay)
	end

	return true
end
?
 
Noticed it xD

I got a idea, does this work:

If some one can make a script were a char saves automaticly.. not all together just 1 char when he logs in til he logs out..

Like If I got my own char it will save every 20-30 min..
Cykotitans char will save somewere between 20-30 min..

insted of all saving together?

I got no other way to explain it better than this xD
 
200 to be more accurate, no other ways? =/

The server has been online for like 100 hours soon and anytime now I think there will be a shutodown or something, and I have not got any save system :s
 
Back
Top