Scripting Crashes, VERY CONFUSED

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
JoeyGodard
Posts: 1
Joined: Fri Oct 24, 2014 5:50 am

Scripting Crashes, VERY CONFUSED

Post by JoeyGodard »

This is in reference to the Grimrock 2 editor.

So I'm very new to the Dungeon Editor, and I also have very little scripting experience. That said, I am a logical person and I can follow instructions well. I've been trying to get simple scripts to fire off when pulling levers/inserting items onto alcoves to open doors. Nothing complicated. I keep having problems with calling ID names it seems. I've tried to recreate the scripts below; while everything is named and connected properly, I keep getting "attempt to call method(whatever ID name) a nil value x. Am I missing something completely obvious?

---

function checkLevers()
if combination_lever_1.lever:isActivated() and not combination_lever_2.lever:isActivated() and combination_lever_3.lever:isActivated() then
combination_door.door:open()
else
combination_door.door:close()
end
end

---

and this:

function itemPuzzle()
-- iterate through all contained items on alcove, checking for a matching name
for i in itemPuzzleAlcove:containedItems() do
if i.name == "pitroot_bread" then
playSound("level_up")
break
end
end
end
User avatar
msyblade
Posts: 792
Joined: Fri Oct 12, 2012 4:40 am
Location: New Mexico, USA
Contact:

Re: Scripting Crashes, VERY CONFUSED

Post by msyblade »

No, you're on the right track. do not become frustrated, you are using old code on a new code game. Wait, be patient, the answers will come, you are simply in a hurry, before the answers are here.they are on the way. The solution makes so much more sense than becoming frustrated and leaving sensibility behind. The answers are on the way, slow down, take a breath. It's cool. Everything is going to be SO awesome, SO soon! Stick with us. This is happening NOW! Be professional and understanding, it is difficult,at this time, for your problems to be solved. . .we all feel this way. . .but such is the price of having an awesome indie dev, do their best, while WE complain. Sloooooow down, its coming. . . all of the mod answers, all of the questions, answered soon. I call it FOREVER, but these guys are awesome,I promise. Slow down, give them a chance. . .they will blow you and your expectations away. Patience and understanding is what's on the menu, for mow. Thanks again AH, We are so incredibly grateful, it is a frustration of PASSION, not ignorance. I hope you know this.
Last edited by msyblade on Fri Oct 24, 2014 3:16 pm, edited 1 time in total.
Currently conspiring with many modders on the "Legends of the Northern Realms"project.

"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
User avatar
Adrageron
Posts: 203
Joined: Thu Nov 08, 2012 1:22 pm

Re: Scripting Crashes, VERY CONFUSED

Post by Adrageron »

Just spyed some scripts in .dat file :ugeek: With this code you can check alcoves for specific items:

Code: Select all

function surfaceContains(surface, item)
	for _,i in surface:contents() do
		if i.go.name == item then return true end
	end
end

function checkAlcove(alcove)
	if surfaceContains( my_alcove.surface, "figure_skeleton") then
         my_door.door:open()		 
    else    
        my_door.door:close()
    end
end
Post Reply