Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: fovmester on Thu 26/05/2005 14:28:19

Title: Problem with properties when Open/Close door
Post by: fovmester on Thu 26/05/2005 14:28:19
I've made it so that the status-line gets a property whenever the mouse-pointer is over a hotspot (in this case a door). So if you have the Use-command it reads the hotspot's Use-property for the text to be displayed in the status-line. Use Door -> Open Door.

The problem is that when the door is opened I want the status-line to read Close door. But the Use-property of the door is "Open" from the start, and I can't change properties at run-time. I can think of several work-arounds. But I want something that is general and don't mean that I have to hard-code some test (to see if this particular door is open or not ) into the status-line-code. Because then I'll have to do it for every door in the game, which will make sloppy and unreadable code before long!

Has anyone tried doing the same thing as I, and come up with a good solution?
Title: Re: Problem with properties when Open/Close door
Post by: Ishmael on Thu 26/05/2005 14:33:41
You could make a state2 property, which is read whenever a global variable, that you'd set up for all objects that can be toggled, is read to in position 1, when it initially was in postition 0...

Add two properties, the global state ref number, and the state2, and set up an array like objstate[num] and if you set number 3 to the door you'd read objstate[3] and use the correct property based on what the var reads. Then you'll only have to hard-code the var reading process.
Title: Re: Problem with properties when Open/Close door
Post by: fovmester on Fri 27/05/2005 05:50:27
That's a great idea!  ;D Thanks a lot!