Page 1 of 1

boolean variable question ( SOLVED )

Posted: Sun Jul 06, 2014 9:37 pm
by bigbrodeur
Hi, I have look around the forum but canot find the answer to this.
What I wanna do is close a door when you step on a hidden pressure plate but only if you have stepped on a previous pressure plate before.
This part works fine, the problem is that I have a button that would put the variable to false and open the door so that it could be done again.
But after i press the button it seems the variable plate01 become false but will never become true again.
The door does not close after I press the button and stepped on those 2 plate.
Thank you for your help.

function plate01()
plate01 = true
end

function door01()
if plate01 == true then
prison_door_portcullis_67:close()
end
end

function resetlabyrinth()
plate01 = false
end

Re: boolean variable question

Posted: Sun Jul 06, 2014 9:39 pm
by Dr.Disaster
Did you set "activate once" for those plates?

Re: boolean variable question

Posted: Sun Jul 06, 2014 9:40 pm
by bigbrodeur
No, thats the first thing I checked.
Even if I press the button first, it wont work.
But if i step on those plate and dont press the button it work, its that button that is problematic.

Re: boolean variable question

Posted: Mon Jul 07, 2014 12:38 am
by Allanius2
bigbrodeur wrote:Hi, I have look around the forum but canot find the answer to this.
What I wanna do is close a door when you step on a hidden pressure plate but only if you have stepped on a previous pressure plate before.
This part works fine, the problem is that I have a button that would put the variable to false and open the door so that it could be done again.
But after i press the button it seems the variable plate01 become false but will never become true again.
The door does not close after I press the button and stepped on those 2 plate.
Thank you for your help.

function plate01()
plate01 = true
end

function door01()
if plate01 == true then
prison_door_portcullis_67:close()
end
end

function resetlabyrinth()
plate01 = false
end
I noticed that you have the function and the variable with the same name, change the name of one or the other and it should work. Be sure to include the door:open statement in the resetlabyrinth function. Good luck.

Re: boolean variable question

Posted: Mon Jul 07, 2014 1:23 am
by bigbrodeur
Yes it worked !!!!!!
Wow I didnt know function could not share the same name as variable.
Thank you allanius.
How can I changed the name of the topic to add SOLVED ?

Re: boolean variable question

Posted: Mon Jul 07, 2014 8:59 am
by antti
bigbrodeur wrote:Yes it worked !!!!!!
Wow I didnt know function could not share the same name as variable.
Thank you allanius.
How can I changed the name of the topic to add SOLVED ?
Nice 8-)
You can change the topic by pressing "edit" on your original post.