Glad the above helped though, and that you were able to fix it quickly
[Solved] Save game blowing up with my custom dungeon
- JohnWordsworth
- Posts: 1397
- Joined: Fri Sep 14, 2012 4:19 pm
- Location: Devon, United Kingdom
- Contact:
Re: [Solved] Save game blowing up with my custom dungeon
For Lua, I skip between Notepad++ and Sublime Text here. I don't know if I would go as far to call them "IDEs" but they are good text editors with syntax highlighting. I'm not a big fan of Eclipse, so unless I work on something that turns out to be massive in terms of scripting, I think the text editors will do for me!
Glad the above helped though, and that you were able to fix it quickly
. With this in mind, I have noticed a few scripts kicking around the forums that might have this bug in...
Glad the above helped though, and that you were able to fix it quickly
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
Re: [Solved] Save game blowing up with my custom dungeon
What he said..JohnWordsworth wrote:For Lua, I skip between Notepad++ and Sublime Text here. I don't know if I would go as far to call them "IDEs" but they are good text editors with syntax highlighting. I'm not a big fan of Eclipse, so unless I work on something that turns out to be massive in terms of scripting, I think the text editors will do for me!
Links to my YouTube playlist of "tutorials" and to my forum thread.
Re: [Solved] Save game blowing up with my custom dungeon
Grimrock 1 & 2, more than 100k lines of code, have both been written using Sublime Text 2/3. It's a great text editor although I wish plugins could be written in Lua instead of Python 
Re: [Solved] Save game blowing up with my custom dungeon
The plug-ins are not in LUA because Python arrays correctly initialize at 0. /jestingpetri wrote:Grimrock 1 & 2, more than 100k lines of code, have both been written using Sublime Text 2/3. It's a great text editor although I wish plugins could be written in Lua instead of Python
Re: [Solved] Save game blowing up with my custom dungeon
Notepad++ here, but Sublime text sure looks cool, have to try it (haven't even heard of it before). Eclipse...never again
I have used Netbeans and IntelliJ IDEA for larger projects lately, when I need automatic code completion etc... Not for lua of course
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
- cloneObject viewtopic.php?f=22&t=8450
Re: [Solved] Save game blowing up with my custom dungeon
So happy! I found my one Lone Hostile line of code killing my mod!
There, on display for others to not make the same mistake.
Code: Select all
function puzzleL1Room6(o)
local str = string.sub(o.go.id, -1)
obj = findEntity("someEntity_" .. str)
--[[ code omitted ]]--
end
Re: [Solved] Save game blowing up with my custom dungeon
Just for clarification.
You can use for example counters in scripts. The following code WILL work if put in a script_entity, and keep the state of the counter between save/load.
Edit: I see now i was stating the obvious, as it is all explained here already.
You can use for example counters in scripts. The following code WILL work if put in a script_entity, and keep the state of the counter between save/load.
Edit: I see now i was stating the obvious, as it is all explained here already.
Code: Select all
counter=0
function btn()
counter= counter +1
hudPrint("The counter says "..counter)
end
Links to my YouTube playlist of "tutorials" and to my forum thread.
- cromcrom
- Posts: 549
- Joined: Tue Sep 11, 2012 7:16 am
- Location: Chateauroux in a socialist s#!$*&% formerly known as "France"
Re: [Solved] Save game blowing up with my custom dungeon
OMG I am right in the thickness of it

A trip of a thousand leagues starts with a step.
- Soaponarope
- Posts: 180
- Joined: Thu Oct 04, 2012 3:21 am
Re: [Solved] Save game blowing up with my custom dungeon
I'm having this problem with my dungeon and I just found the cause. It was a nice script I found from Lark to fix the wall lanterns.
I don't know how to fix the saving fail though.
Code: Select all
num = 0
bad = 2
while bad > 0 do
num = num + 1
obj = findEntity("dungeon_wall_lantern_" .. num)
if obj ~= nil then
val = obj:getWorldPosition()
val[2] = val[2] + .7
ix = (3 - (obj.facing % 2) * 2)
dx, dy = getForward(obj.facing)
val[ix] = val[ix] + .21 * (dx - dy)
obj:setWorldPosition(val)
else
bad = bad - 1
end
endRe: [Solved] Save game blowing up with my custom dungeon
I have found hunting down root cause of the save fails has been the hardest thing in modding Grimrock 2. The error you get tells you nothing. The problem can be almost anywhere and it is often VERY hard to see. If you have a lot of code, what I have done to find it is comment out code until you find it. The error will only occur if the erroneous code executes.
What causes the problem I believe is multiple similar issues. The main one is when a game object is stored in file scope and not locally. You can create as many basic LUA objects as you want in file scope but you have to ensure none contain game objects or the save will fail.
In the code below, you didn't share all of it. I don't see where/if you declared "obj" as local. findEntity() returns a GameObject so obj MUST be local or the save will fail.
What causes the problem I believe is multiple similar issues. The main one is when a game object is stored in file scope and not locally. You can create as many basic LUA objects as you want in file scope but you have to ensure none contain game objects or the save will fail.
In the code below, you didn't share all of it. I don't see where/if you declared "obj" as local. findEntity() returns a GameObject so obj MUST be local or the save will fail.