if (GetBoolean(player, "water")) {
msg ("You drink the water.")
} else if (Got(empty water bottle)) {
msg ("Your bottle is empty.")
} else if (Got(full water bottle)) {
msg ("You drink the water.")
MoveObject (full water bottle, offstage)
MoveObject (empty water bottle, player)
} else {
msg("There's no water here")
}
if (not GetBoolean(player, "water")) {
msg ("There's no water here.")
}
else if (not Got(empty water bottle)) {
msg ("You don't have a bottle.")
}
else if (Got(full water bottle)) {
msg ("It's already full.")
}
else {
msg ("You fill the bottle.")
MoveObject (empty water bottle, offstage)
MoveObject (full water bottle, player)
}
if (GetBoolean(player, "water")) {
msg ("You drink the water.")
} else if (Got(empty water bottle)) {
msg ("Your bottle is empty.")
} else if (Got(full water bottle)) {
msg ("You drink the water.")
MoveObject (full water bottle, offstage)
MoveObject (empty water bottle, player)
}
if (Got(full water bottle)) {
if (GetBoolean(player, "water")) {
msg ("It's already full.")
}
}
if (Got(empty water bottle)) {
if (GetBoolean(player, "water")) {
msg ("You fill the bottle.")
MoveObject (empty water bottle, offstage)
MoveObject (full water bottle, player)
}
}
if (Got(empty water bottle)) {
if (not GetBoolean(player, "water")) {
msg ("There's no water here.")
}
}
else if (Got(empty water bottle)) {
if (not GetBoolean(player, "water")) {
msg ("There is no water here.")
}
}
else if (Got(full water bottle)) {
if (not GetBoolean(player, "water")) {
msg ("It's already full.")
}
}
else if (not Got(empty water bottle)) {
if (not GetBoolean(player, "water")) {
msg ("You don't have a bottle.")
}
}
else if (not Got(full water bottle)) {
if (not GetBoolean(player, "water")) {
msg ("You don't have a bottle.")
}
}
else if (not Got(empty water bottle)) {
if (GetBoolean(player, "water")) {
msg ("You don't have a bottle.")
}
}
else if (not Got(full water bottle)) {
if (GetBoolean(player, "water")) {
msg ("You don't have a bottle.")
}
}
msg ("<br/>The cool water glides downs your throat; not only refreshing you but it also makes you feel better. <br/>")
player.health = player.health + 3
RemoveObject (fresh_water)
if (RandomChance(50)) {
msg ("<br/>The warm, dirty water glides downs your throat making you gag a little; it's not very refreshing you but it did manage to quench some of your thirst. <br/>")
player.health = player.health + 5
RemoveObject (dirty_water)
}
else {
player.health = player.health - 5
msg ("<br/>After drinking the dirty water, you suddenly feel sick to your stomach. Moments later, your stomach turns which causes you to vomit! Ugh!! You feel worse now...<br/>")
RemoveObject (dirty_water)
}
if (Contains (small_sack,fresh_water)) {
msg ("<br/>You cannot store liquids in this small sack! <br/>")
RemoveObject (fresh_water)
}
else if (Contains (small_sack,dirty_water)) {
msg ("<br/>You cannot store liquids in this small sack! <br/>")
RemoveObject (dirty_water)
}
if (Contains (small_sack,fresh_water)) {
msg ("<br/>You cannot store liquids in this small sack! <br/>")
RemoveObject (fresh_water)
}
else if (Contains (small_sack,dirty_water)) {
msg ("<br/>You cannot store liquids in this small sack! <br/>")
RemoveObject (dirty_water)
}
MoveObject (fresh_water, waterskin)
if (Contains (waterskin,fresh_water)) {
msg ("It is already full. ")
}
else if (not waterskin.isopen) {
msg ("You must open the waterskin first!")
}
else if (not Got(waterskin)) {
msg ("You cannot hold onto this. ")
msg ("You drop it. ")
RemoveObject (fresh_water)
}
else if (Contains (waterskin,dirty_water)) {
msg ("It is already full. ")
}
MoveObject (fresh_water, small_bottle)
if (Contains (small_bottle,fresh_water)) {
msg ("It is already full. ")
}
else if (not Got(small_bottle)) {
msg ("You cannot hold onto this. ")
msg ("You drop it. ")
RemoveObject (fresh_water)
}
else if (Contains (small_bottle,dirty_water)) {
msg ("It is already full. ")
}
MoveObject (fresh_water, medium_bottle)
if (Contains (medium_bottle,fresh_water)) {
msg ("It is already full. ")
}
else if (not Got(medium_bottle)) {
msg ("You cannot hold onto this. ")
msg ("You drop it. ")
RemoveObject (fresh_water)
}
else if (Contains (medium_bottle,dirty_water)) {
msg ("It is already full. ")
}
MoveObject (fresh_water, large_bottle)
if (Contains (large_bottle,fresh_water)) {
msg ("It is already full. ")
}
else if (not Got(large_bottle)) {
msg ("You cannot hold onto this. ")
msg ("You drop it. ")
RemoveObject (fresh_water)
}
else if (Contains (large_bottle,dirty_water)) {
msg ("It is already full. ")
}
MoveObject (dirty_water, waterskin)
if (Contains (waterskin,fresh_water)) {
msg ("It is already full. ")
}
else if (not waterskin.isopen) {
msg ("You must open the waterskin first!")
}
else if (not Got(waterskin)) {
msg ("You cannot hold onto this. ")
msg ("You drop it. ")
RemoveObject (dirty_water)
}
else if (Contains (waterskin,fresh_water)) {
msg ("It is already full. ")
}
MoveObject (dirty_water, small_bottle)
if (Contains (small_bottle,dirty_water)) {
msg ("It is already full. ")
}
else if (not Got(small_bottle)) {
msg ("You cannot hold onto this. ")
msg ("You drop it. ")
RemoveObject (dirty_water)
}
else if (Contains (small_bottle,fresh_water)) {
msg ("It is already full. ")
}
MoveObject (dirty_water, medium_bottle)
if (Contains (medium_bottle,fresh_water)) {
msg ("It is already full. ")
}
else if (not Got(medium_bottle)) {
msg ("You cannot hold onto this. ")
msg ("You drop it. ")
RemoveObject (dirty_water)
}
else if (Contains (medium_bottle,fresh_water)) {
msg ("It is already full. ")
}
MoveObject (dirty_water, large_bottle)
if (Contains (large_bottle,dirty_water)) {
msg ("It is already full. ")
}
else if (not Got(large_bottle)) {
msg ("You cannot hold onto this. ")
msg ("You drop it. ")
RemoveObject (dirty_water)
}
else if (Contains (large_bottle,fresh_water)) {
msg ("It is already full. ")
}
OurJud wrote:
Seems to work, Pertex, but for one thing. If the player drops the bottle outside of a water source, 'drink' should return 'There's no water here', but with your script it returns a null.
if (GetBoolean(player, "water")) {
msg ("You drink the water.")
} else if (Got(empty water bottle)) {
msg ("Your bottle is empty.")
} else if (Got(full water bottle)) {
msg ("You drink the water.")
MoveObject (full water bottle, offstage)
MoveObject (empty water bottle, player)
} else {
msg("There's no water here")
}
if (not GetBoolean(player, "water")) {
msg ("There's no water here.")
}
else if (not Got(empty water bottle)) {
msg ("You don't have a bottle.")
}
else if (Got(full water bottle)) {
msg ("It's already full.")
}
else {
msg ("You fill the bottle.")
MoveObject (empty water bottle, offstage)
MoveObject (full water bottle, player)
}
Neonayon wrote:
Hope that helps!
------------------------------
If-Scripts
How I understand it is ...
If (this scenario) = blah blah
then (do this)
else if (this scenario) = blah blah
then (do this)
else (this scenario ((meaning none of the other scenarios have happened))) = blah blah
then (do this)
Does that clarify that?
Pertex wrote:"OurJud"
Seems to work, Pertex, but for one thing. If the player drops the bottle outside of a water source, 'drink' should return 'There's no water here', but with your script it returns a null.
THen this should work:
As for if-Scripts, what you say kind of make sense, but when I should use which is still a bit of a mystery. When I was trying to get my scripts to work and avoid double response outputs etc, I was just blindly tossing 'ifs' and 'else ifs' all over the place until it did what I wanted it to do.
Forgewright wrote:I saw a post earlier referring to the water container needing an diminishing integer to calculate the the amount of water in it. Your refill scripts only account for empty or full containers. If the container's integer is less than it's max integer shouldn't it be set to max again at a given "fill" command?
Neonayon wrote:As for if-Scripts, what you say kind of make sense, but when I should use which is still a bit of a mystery. When I was trying to get my scripts to work and avoid double response outputs etc, I was just blindly tossing 'ifs' and 'else ifs' all over the place until it did what I wanted it to do.
Another thing that helps me with the "IF" scripts is...
// Check water source in the current room (player.parent)
if (not GetBoolean(player.parent, "watersource")) {
msg("There is no water source here")
}
// Check container is not full
else if (full water bottle.parent = player) {
msg("You water bottle is full already")
}
// Check player has the empty container
else if (empty water bottle.parent = player) {
msg("You have no water bottle")
}
// Everything is okay, so fill the bottle
else {
msg("You fill your water bottle")
MoveObject (empty water bottle, offstage)
MoveObject (full water bottle, player)
}
Pertex wrote:HK: not completely true. It depends on what should happen in the script block of the if.If you have the same commands when water is true and canteen is false you need other if clauses
HegemonKhan wrote:ya, not quite the same, but the good news is, is that you seem to understand it quite well, hehe.