Help - New - How dou you make a shower and tub with water ..

Sonny
16 Jul 2007, 17:38
Hi, I just purchased Quest and have been doing most of the Tutorial with some success.

However I am stumped or puzzled which ever you prefer.

Ok heres what I want to do:

1) Create a Bathroom Sink
with--Water Spout, Hot Water Handle, Cold Water Handle
2) A Bathtub
with Water Spout, Hot Water Handle, Cold Water Handle, Bath/Shower Handle (to change where the water flows from, ie Upper Shower Head or lower Bath Faucet.)

3) A Shower with a Water Head.

4) When turning on the Bath water not have the sink water on or when turning on the Sink, not have the 'Bath or shower water turn on' (or 'kitchen water on' for that matter, so a water on water off is not working here for me.)

My dilema is:
1) I can make Hot and Cold Water but not 'warm'.
2) I can not make the Handle switch between the two (faucet/head) with
running water out of either one that the player has chosen. (in other
words do they want to take a shower or bath.)
3) How do I make a QDK script THAT:

have the script choose which combination the player has chosen.

....example: (player is at the bathtub object):
Player types something like:
* Hot Water On,
* Turn Cold Water on (now becomes warm water),
* Turn Shower handle on (switches water flow to shower head to take a
shower).

... THEN:

Look at:
* bATHTUB Faucet (shows water is off).
* Look shower head (warm water is coming from shower head).
(or) switch it back to Bathtub faucet with the water now coming from the Faucet not the head.
* Look at water and it shows it hot, cold or warm.

And the other Hot, Cold water variations (such as above but instead of warm it is hot or cold).

If you can help, please also include which Function i need to use (like a conditional, select case, advanced, Boolean, condition etcetera category(s) to run the script in as I am not yet there to know the difference yet.)

This would also teach me how to use multiple items/objects (in a sense) for other things as well so
"Thanks in advance"

Sonny

paul_one
17 Jul 2007, 15:12
Well, from first looks I'd do the following:

Have 3 objects.. Tap, Shower and Water (water is invisible).

Water can have the property "temperature".. Which will have the properties "-1", "0" or "+1". (cold, warm, hot). - starts off at 0..

When you turn the tap on, you add the value to the property (hot on is property + 1.. cold on is property + -1) and turning the taps off means you take away the value from the property (property - 1, property - -1).

I'd also have each object with an "active" boolean property, so it's either active, or not active. Switching the tap up to the shower de-activates the tap and activates the shower.

Anyone want to volunteer up an example before I make one tonight?

Sonny
17 Jul 2007, 18:21
First, Thank you for responding back.

Ok, I'm a little confused.

Temperature:
+1 = Hot
-1 = Cold
0 = Both waters Off
? = WARM ??? (how do i set it to warm?)

-->> My confusion her so to clarify,
you wrote:
1) "Water can have the property "temperature".. Which will have the properties "-1", "0" or "+1". (cold, warm, hot). - starts off at 0.."
-->>[A-- is 0 Warm of Off or both, I confused ???, also see below].
-->>[B-- Do I run script, click Modify, click property ??].

--->> You wrote (continued from 1A above):
"When you turn the tap on, you add the value to the property (hot on is property + 1.. cold on is property + -1) and turning the taps off means you take away the value from the property (property - 1, property - -1)."

2) "Have 3 objects.. Tap, Shower and Water (water is invisible). "
-->>[I assume you mean: "dont display in descriptions or object list"]

-->>So, I think your saying, but confused: ...
Cold Water: +1 (On), 0 (OFF) -1 (Off)
Hot Water +1 (On), 0 (Off), -1 (Off)

I somewhat understand what your saying but the Warm Water and Off part is what is confusing me.

...>>Think I understand this part.
I'd also have each object with an "active" boolean property, so it's either active, or not active. Switching the tap up to the shower de-activates the tap and activates the shower.

... Sorry to be ignorant at this but, I am trying to learn this and have gotten thru most of the manual and have been playing with the exercises as well. Did the glass Fill, Drink, Water on, running etc. and thought I'd try something like make a bathroom with a shower, a sink, etc with the water part, seemed easy at first. I have not started making a game as I am just trying to learn the program first. Sometimes words seem so simple to understand by those that know, but can be confusing to us that don't.

Sonny
17 Jul 2007, 22:39
Ok, let me try to make this simple for the technical folks ...lol.

How do I make "Warm water ?" from a seperate Cold and Hot water taps.

ie:
I have a Cold Water Tap on = Cold
Ihave a Hot Water Tap on = Hot
I want to be able to have both on and create = Warm and it gets reported back as warm water when checked or looked at!

Can anyone explain this simple task that is really messing with me.

I have tried doing a check water command property that does everything fine, except report its warm water.

I seem to be able to do two Functions together but not three.

paul_one
18 Jul 2007, 14:22
Here you go:

' Demonstruction to show hot/cold taps giving warm water.

define game <Hot Cold>
asl-version <400>
gametype singleplayer
start <start>
game version <1a>
game author <Tr0n²>

verb <turn off : turn_off> msg <You can't turn that.>
verb <turn on; turn : turn_on> msg <You can't turn that.>

end define

define room <start>
alias <Bathroom>
prefix <the>

define object <tap>
alias <Taps>
alt <hot tap;cold tap;taps;water;hot water;cold water>
prefix <the>

look {
msg <A pair of decorative handles surround the tap itself..|nYou feel quite pleased that you were able to buy them at half price!>
if not ( #tap:hot##tap:cold# = 00 ) then {
msg <You see |xn>
select case <#tap:hot##tap:cold#> {
case <01> _
msg <cold |xn>
case <11> _
msg <warm |xn>
case <10> _
msg <hot |xn>
}
msg <water flowing from the tap..>
}
else msg <The tap drips softly into the plug hole.>
}

action <turn_on> {
set string <turning.temp; $tap.turn.proc$>
if not ( #turning.temp# = BLANK ) then {
debug <$tap.turn(tap; #turning.temp#; 1)$>
}
}

action <turn_off> {
set string <turning.temp; $tap.turn.proc$>
if not ( #turning.temp# = BLANK ) then {
debug <$tap.turn(tap; #turning.temp#; 0)$>
}
}

properties <hot=0;cold=0>
end define
end define

define function <tap.turn.proc>
' process command to get the command and see if it's hot/cold
' and returns hot/cold/blank

set string <turning.ret; BLANK>
if ( $instr(#quest.command#;hot)$ > 1 ) then _
set string <turning.ret; hot>
if ( $instr(#quest.command#;cold)$ > 1 ) then _
set string <turning.ret; cold>
if ( #turning.ret# = BLANK ) then {
msg <Sorry - do you mean hot or cold water?>
enter <turning.ret>
select case <#turning.ret#> {
case <hot;cold> _
msg <Ok.>
case <warm> {
msg <Do *YOU* have a warm water tap?>
set string <turning.ret; BLANK>
}
case else {
msg <Sorry, a #turning.temp# tap isn't here!>
set string <turning.ret; BLANK>
}
}
}
return <#turning.ret#>
end define

define function <tap.turn>
' usage: $tap.turning(object; <hot/cold>; <1/0>)$

set string <tt.object; $parameter(1)$>
set string <tt.dir; $parameter(2)$>
set numeric <tt.onoff; $parameter(3)$>
if ( %tt.onoff% = 1 ) then _
set string <tt.on.off; on> _
else _
set string <tt.on.off; off>

if ( $objectproperty(#tt.object#; #tt.dir#)$ = %tt.onoff% ) then _
msg <You try to turn it some more, but nothing happens..> _
else {
msg <You turn the #tt.dir# tap #tt.on.off#.>
property <#tt.object#; #tt.dir#=%tt.onoff%>
}

end define


Cut and paste this into a text file.

I'll be uploading it into my demo's directory when I get home.
Quite alot of code for some simple error checking etc.

Sonny
18 Jul 2007, 16:59
Hi Tron,

That is awesome!!!, thank you very much.

I have played around with it and pretty much able to get it in my Bathroom design.

However...
there is still one thing still from my original message of how do I get the "Shower Tap water" or "Sink Tap Water" to display which is on correctly.

In other words when I turn on the shower and look at shower head the water is flowing from there and if I look at the sink faucet it is off an vice a versa unless I turned them both on.


Example:
Player wants to take a shower,
Turns on Shower Hot, Cold and makes warm.... all good
(but looks at sink and the sink faucet is now on and warm [or cold or hot]as well, *don't want that).

... and the reverse of the above for the Sink, when I turn on sink taps the Shower Faucet should not be on.

I don't think turning on the water in say a bathroom should turn the shower on, the bath tub on, the sink on and flush the toilet with warm water all at the same time ... lol.

Again,
this is not a game, but one exercise I am trying to do that started with the manual's Turn on/off water / Fill glass exercise that led me to this state of confusion, which, from your code looks like I bit off a little more than I can chew at the moment....aghh! ... but this might help others in the future here as well so I will keep plugging away at it and keep reporting back.

Anyway thank you again for your time on this.

paul_one
19 Jul 2007, 10:44
Well, if that was a bath tap, an almost identical one can be made for the sink tap:
define object <sinktaps>
alias <Sink Taps>
alt <hot tap;cold tap;taps;sink tap;sink taps;water;hot water;cold water;hot sink tap;cold sink tap>
prefix <the>

look {
msg <A pair of decorative handles surround the tap itself which match the bath..|nYou feel quite pleased that you were able to buy the bath taps at half price with these.>
if not ( #sinktaps:hot##sinktaps:cold# = 00 ) then {
msg <You see |xn>
select case <#sinktaps:hot##sinktaps:cold#> {
case <01> _
msg <cold |xn>
case <11> _
msg <warm |xn>
case <10> _
msg <hot |xn>
}
msg <water flowing from the tap..>
}
else msg <The tap drips softly into the plug hole.>
}

action <turn_on> {
set string <turning.temp; $tap.turn.proc$>
if not ( #turning.temp# = BLANK ) then {
debug <$tap.turn(sinktaps; #turning.temp#; 1)$>
}
}

action <turn_off> {
set string <turning.temp; $tap.turn.proc$>
if not ( #turning.temp# = BLANK ) then {
debug <$tap.turn(sinktaps; #turning.temp#; 0)$>
}
}

properties <hot=0;cold=0>
end define

Sonny
20 Jul 2007, 18:28
Thanks Tron,

That worked out exactly.

Thank You.!!!

Sonny

Sonny
23 Jul 2007, 10:53
Tron,

I have seemed to run into a problem with the script below.

verb <turn off : turn_off> msg <You can't turn that.>
verb <turn on; turn : turn_on> msg <You can't turn that.>

It seems that because I am using these Verbs above I can no longer turn anything else on. As an example I can turn on a TV or a Radio if I use SWITCH ON or some other configuration but I can not Turn the TV or Radio using the Turn On commands. (I've tried doing basic Turn On and Flag Set etc, but nothing works.)

When using Turn on TV or Radio it only returns "You can't turn that."

Help!

2) Also Two other question for anyone.

A) Do I need to do a custom command to take an object from and object. I can't seem to be able to take and Object from an Object now? (and if I can it doesn't show in the inventory).

B) What Code or script do I use for "Inventory" (like I want to put something into Inventory or remove from the Inventory) and no I'm talking in QDK not the player by typing Pick Up, INV etc

paul_one
24 Jul 2007, 11:36
Sonny wrote:Tron,

I have seemed to run into a problem with the script below.

verb <turn off : turn_off> msg <You can't turn that.>
verb <turn on; turn : turn_on> msg <You can't turn that.>

It seems that because I am using these Verbs above I can no longer turn anything else on. As an example I can turn on a TV or a Radio if I use SWITCH ON or some other configuration but I can not Turn the TV or Radio using the Turn On commands. (I've tried doing basic Turn On and Flag Set etc, but nothing works.)

That's probably because you're trying to use the custom command "turn on TV" or something similar.
.. Instead, give the TV the action "turn_on" - JUST like the taps. If they have actions like "turn_on" and "turn_off" then they will auto-magically work in the game from now on!

A) Do I need to do a custom command to take an object from and object. I can't seem to be able to take and Object from an Object now? (and if I can it doesn't show in the inventory).

Quest does support containers now, which should allow you to put objects in, and pull them out of, other objects.
- How are you putting an object into another?

B) What Code or script do I use for "Inventory" (like I want to put something into Inventory or remove from the Inventory) and no I'm talking in QDK not the player by typing Pick Up, INV etc

In QDK it's "put an object into the players inventory" I believe (something close to, no doubt).
In code, they're give <object> and drop <object>.

Sonny
24 Jul 2007, 22:04
Thanks Tron,
That worked.

I was using the verb "Turn On" and "Turn Off" but it did not work. Changing it to Turn_On and Turn_Off fixed the problem.

I havent tried the other suggestions yet but will do so this evening.

Thank You again.... You The Man!!!
Sonny