Page 1 of 1

[Solved] Way to test if objects are active?

Posted: Wed Oct 29, 2014 6:49 am
by DrMilesManners
Hello, I'm trying to make a riddle that is based off of certain pressure plates being active and a counter being at a certain value and when solved opens a door. First of all does anyone know what kind of object a pressure plate is? Like pressureplate1.pressure_plate:isActive() or pressureplate1.plate:isActive()? Secondly, is the way to test for objects being active done through the isActive() function or is there another function name?

At this point, I am using this code (X, Y, and Z being numerical values):

Code: Select all

function earthsequence()
	print(earth_counter.counter:getValue())
	if earth_counter.counter:getValue() == Z and answer_X.plate:isActive() and answer_Y.plate:isActive()
	then earth_door.door:open()
	else
	end
end

Re: Way to test if objects are active? [Lua scripting help]

Posted: Wed Oct 29, 2014 7:15 am
by sps999
I believe what you are looking for is:

Code: Select all

pressure_plate_1.floortrigger:isActivated()
There is a very nice topic that I don't believe has received enough attention over here:
viewtopic.php?f=22&t=7882

That thread contains a list of most of the names you'll need to reference, and is what's holding me over until AH releases the references themselves.

Re: Way to test if objects are active? [Lua scripting help]

Posted: Wed Oct 29, 2014 8:04 am
by DrMilesManners
So it's a "FloorTriggeredComponent" class and an "isActivated" function according to the post?
Edit:
(I'm asking because I might try adding custom floor components in the future, like a custom floor trap.)

Re: Way to test if objects are active? [Lua scripting help]

Posted: Wed Oct 29, 2014 5:08 pm
by DrMilesManners
Ok finally tested the code out and it works! Thanks for the help! Oh and that guy who wrote that post about the functions needs a cookie haha.