conditional look descriptions and scripts
djbriandamage
22 Feb 2013, 18:20This is my first Quest game (I'm using the web version) so please pardon a noobish question.
My game involves a ride in a limousine. Here's a basic pseudocode description of what I want.
[list]
[*]The privacy window is open by default. (this is a window that separates the driver from the passenger)[/*]
[*]Every turn that the player is inside the limo and the privacy window is open, the driver says something to the player.[/*]
[*]When the player closes the privacy window the exit is unlocked and the player may proceed.[/*]
[/list:u]
I tried setting the privacy window as a container because the UI lets me set it as open is closeable. I then made a turn script saying "if object is open 'privacy window' then print message 'The driver talks to you'". I also tried a conditional statement when you look out the door window saying "if privacy window is open then print 'you watch the world go by.' else 'The world is still because the car is stopped.'"
My problem is that the game acts as if the privacy window is open even when it is closed. I close the privacy window but the driver still talks to me every turn and when I look out the door window the scenery is still moving.
Can anyone please advise me? Did I make a mistake in configuring the privacy window as a container?
Thanks! Please let me know if I've neglected to share any important information.
My game involves a ride in a limousine. Here's a basic pseudocode description of what I want.
[list]
[*]The privacy window is open by default. (this is a window that separates the driver from the passenger)[/*]
[*]Every turn that the player is inside the limo and the privacy window is open, the driver says something to the player.[/*]
[*]When the player closes the privacy window the exit is unlocked and the player may proceed.[/*]
[/list:u]
I tried setting the privacy window as a container because the UI lets me set it as open is closeable. I then made a turn script saying "if object is open 'privacy window' then print message 'The driver talks to you'". I also tried a conditional statement when you look out the door window saying "if privacy window is open then print 'you watch the world go by.' else 'The world is still because the car is stopped.'"
My problem is that the game acts as if the privacy window is open even when it is closed. I close the privacy window but the driver still talks to me every turn and when I look out the door window the scenery is still moving.
Can anyone please advise me? Did I make a mistake in configuring the privacy window as a container?
Thanks! Please let me know if I've neglected to share any important information.

jaynabonne
22 Feb 2013, 20:49What would be most helpful is if you could post your file so far. Then we can get down to the nitty gritty details.

jaynabonne
22 Feb 2013, 20:53Sorry, you did say the web version... Is there a way we can see your code?
djbriandamage
23 Feb 2013, 05:32I don't see a way to export or save my code from the web version. Maybe I'll redo what I have in the local client and see if I have any luck.
Thanks for your reply.
Thanks for your reply.
sonic102
23 Feb 2013, 07:09-Is the container closable?
-Are you sure it is a container?
-Are there any close scripts that open it again?
-Is it in the limo?
-Is it visible?
These tiny mistakes everyone makes may contain the problem. It happens to everyone.
-Are you sure it is a container?
-Are there any close scripts that open it again?
-Is it in the limo?
-Is it visible?
These tiny mistakes everyone makes may contain the problem. It happens to everyone.
djbriandamage
12 Mar 2013, 18:39Sorry for my delayed reply. I saw your answer right away, sonic102, but was busy testing.
I've tried setting the object as a container, limited container, closed container, and openable/closeable container. There are no other scripts that open it again. It is in the limo and is visible. It can be closed but not opened, and it starts open.
Here's how I have it configured now:
I have two scripts. One runs when the window is closed, unlocking the room's only exit. That script works. The other is a turn script that says "if the window is open the chauffeur talks to you every turn, else he is silent" but the chauffeur talks every turn regardless of whether the window is open.
Looks like code view has been added to the web interface so here goes!
The first time you close the window (which is currently an openable/closeable container that starts open, cannot be opened, and can be closed) this script runs. I know it succeeds because it displays the message and unlocks the room's only exit:
The turn script evaluates whether the window is open and should display a message accordingly, but only the "window open" message displays, even after the script above succeeds. It's as if the game knows when the window "is now being closed" but doesn't recognize it in subsequent turns as "is closed".
Here is the output of a test run:
I've tried setting the object as a container, limited container, closed container, and openable/closeable container. There are no other scripts that open it again. It is in the limo and is visible. It can be closed but not opened, and it starts open.
Here's how I have it configured now:

I have two scripts. One runs when the window is closed, unlocking the room's only exit. That script works. The other is a turn script that says "if the window is open the chauffeur talks to you every turn, else he is silent" but the chauffeur talks every turn regardless of whether the window is open.
Looks like code view has been added to the web interface so here goes!
The first time you close the window (which is currently an openable/closeable container that starts open, cannot be opened, and can be closed) this script runs. I know it succeeds because it displays the message and unlocks the room's only exit:
firsttime {
UnlockExit (limodoor)
msg ("You have closed the privacy window.")
}
otherwise {
}
The turn script evaluates whether the window is open and should display a message accordingly, but only the "window open" message displays, even after the script above succeeds. It's as if the game knows when the window "is now being closed" but doesn't recognize it in subsequent turns as "is closed".
if (not privacy window.isopen) {
msg ("window closed, driver is silent")
}
else {
msg ("window open, driver yammers")
}
Here is the output of a test run:
You are in a limousine.
You can see a privacy window, a door and a chauffeur.
You can go north.
It's fancy.
window open, driver yammers
> look at privacy window
The window is open.
window open, driver yammers
> open privacy window
You can't open it.
window open, driver yammers
> n
That way is locked.
window open, driver yammers
> close privacy window
You have closed the privacy window.
window open, driver yammers
> look at privacy window
The window is open.
window open, driver yammers
> n
You swipe your platinum American Excess through the reader recessed in the car door (no tip) and exit without acknowledging the overfriendly driver. The limo pulls away and you face the restaurant.
You are outside a fancy restaurant.
TriangleGames
12 Mar 2013, 18:55I believe setting your own script for "when closing object" overrides the default, so you need to "manually" close the window as a part of the script.

jaynabonne
12 Mar 2013, 18:56It seems the close script replaces the default behavior. In other words, if you supply a close script, then you are responsible for doing the actual closing. Just add this line to your script:
this.isopen = false
and it should work.
(Edit: Basically, what TriangleGames said.
)
this.isopen = false
and it should work.
(Edit: Basically, what TriangleGames said.

djbriandamage
13 Mar 2013, 12:50Ah, thanks. That's kind of unexpected. Now the question is whether I can customize a script in this fashion using the web UI.

jaynabonne
13 Mar 2013, 13:08I slipped back into "script mode" and said "this", but you can easily use "privacy window" in the script just as well to set the attribute, with the "Set object flag" command.