[SOLVED]Opening and Closing Doors Clash with Flag Set
XanMag
16 Jul 2016, 02:26Well... I've had this trouble before and I still don't understand it.
In the GUI, I have created a door object. I chose openable/closeable from the drop down list. Both boxes are ticked (can be open, can be closed). I have scripts for each scenario.
msg ("You grab the small metal loop and pull. The hinges groan in protest but the door opens revealing a dark staircase leading downward.")
SetObjectFlagOn (hinged door, "open")
MakeExitVisible (crypt exit)
HelperOpenObject (hinged door)
and
msg ("You gently ease the door shut.")
SetObjectFlagOff (hinged door, "open")
MakeExitInvisible (crypt exit)
HelperCloseObject (hinged door)
So, why, Dear God, do I get the 'You can't can't open it' response when I open it, close it, then open it a second time. It only won't open the second time I try to open it. =/
The Pixie
16 Jul 2016, 09:10The name of the flag to use is "isopen", not "open". The "open" attribute is used to determine if the object can be opened, so when you do SetObjectFlagOff (hinged door, "open")
you are setting it so it cannot be opened. And HelperOpenObject and HelperCloseObject handle setting "isopen" anyway, so the second line of both scripts can be deleted altogether and it should work.
XanMag
22 Jul 2016, 12:35Silly me. I was using the flag "open" on the door to change the objects description when looked at. So... all I did to fix was change the flag name from 'open' to 'hasbeenopened' and all is fabulous. I didn't consider the "open" flag clashing with the built -in in open/close scripts!
Thanks, Pix.
The Pixie
22 Jul 2016, 13:34I would get rid of your own and just use the built in one. It is already doing the work, you might as well use it.
XanMag
22 Jul 2016, 13:40Well, I was going to say that there wasn't an option in the GUI for if object is open, but... guess what... there is. About 2 years using this stuff and I'm still an idiot! lol
Thanks!