Hi guys,
i've a little problem saving a table over quit. I already read a few posts about this problem. But i didn't fully understand it.
In Avalon Mud, they don't provide exact numbers of xp for levelups. So my idea was to track the levelup and the xp with ATCP and save it to a table level[x]. Where x is the level and level[x] the value of xp needed for it.
What did i do?
Here is a part of my script:
OnPluginSaveState it shall save all variables of the table (for x = 1 to 120) as variables called "level1", "level2", ... "level120" in addition with the values.
OnPluginInstall it shall read all variables and put it back in the table. But the save function doesnt work. I cant find the saved variables anywhere.
Edit: save_state is "y"
i've a little problem saving a table over quit. I already read a few posts about this problem. But i didn't fully understand it.
In Avalon Mud, they don't provide exact numbers of xp for levelups. So my idea was to track the levelup and the xp with ATCP and save it to a table level[x]. Where x is the level and level[x] the value of xp needed for it.
What did i do?
Here is a part of my script:
function OnPluginInstall ()
levelwerte = {}
for i = 1, 120, 1 do
levelwerte[i] = tonumber(GetPluginVariable("f4a727cb3b8ebdccd4f0af42", "level"..i))
if levelwerte[i] == nil then
levelwerte[i] = 0
end
end
end
function OnPluginSaveState ()
for i = 1, 120, 1 do
SetVariable("level"..i, tostring(levelwerte[i]))
end
end
OnPluginSaveState it shall save all variables of the table (for x = 1 to 120) as variables called "level1", "level2", ... "level120" in addition with the values.
OnPluginInstall it shall read all variables and put it back in the table. But the save function doesnt work. I cant find the saved variables anywhere.
Edit: save_state is "y"
<plugin
name="Levelup_Plugin"
id="f4a727cb3b8ebdccd4f0af42"
language="Lua"
save_state="y"
date_written="2012-12-03 20:17:00"
requires="4.71"
version="1.0"
>
</plugin>