Beginners questions

Hello! :)

First of all: i'm no native english speaker, so excuse me, if i explain something badly.

I try my first steps with quest 5 and i encountered a challenge. I tried varios online posts and videos, but none explained to me, what i should do. Or maybe they did, but my english was to poor to understand.

This is what i am trying to make:

There is a well, where the character is supposed to get water. As the character is a small child, it can't reach the handle. I want to make it so, that the player first needs a ladder and second a bucket to get the water.
I tried to make a verb (get water) with a few ifs.
If he was no ladder (irrelevant if he has a bucket), it should say "you can't reach it".
If he has a ladder and no bucket, it should say "you reach the handle".
If he has a ladder and a bucket, it should say "you reach the handle, let down your bucket an get it filled".
Then it should remove the bucket from inventory and give the player a "bucket with water".

I can't get the second part to work correctly. At the moment all i can get is that the well is inaccessicle, if the player doesn't has a ladder. Is there a way i can flag the well "on/off", if a ladder was used with it (and in this part to remove the ladder from the game?).

Second question: How can i make it so, that after the ladder was placed by the well the description of the well changes to "a well with a ladder" when the player inspects it?

These questions might come as simple, but i really don't get it and there are very few tutorials especially in german. :D
Pictures where i find what would also be very welcome, but that would be only a sexy bonus.

All the best


This is the tutorial section for Quest.
http://docs.textadventures.co.uk/quest/tutorial/

I can't get the second part to work correctly. At the moment all i can get is that the well is inaccessicle, if the player doesn't has a ladder. Is there a way i can flag the well "on/off", if a ladder was used with it (and in this part to remove the ladder from the game?).

Create flag
Turn flag on
Turn flag off
I think it goes something like that, right? I just don't know the code for it.
I use a custom attribute.

Ladder.accessible = false
Ladder.accessible = true

Custom script.

if (ladder.accessible = true) {
  msg ("You climbed the ladder!")
  MoveObject (player, room)
}
else {
  msg ("Oh no! You can't get to the ladder!")
}

I do not know the answers to your other questions.


Thank you, but i read the tutorial section and couldn't find anything, that would help me (or that i couldn't understand).

I don't know where to put your code to see if it works. I'm at the very start of understandig all this. :D


What commands do you want the player to input?
Where the code goes will depend on how much detail the player has to give.

If typing "get water" will automatically put the ladder on the well, then the script for the get water verb would be something like:

if (not GetBoolean (this, "used_ladder")) {
  msg ("The well is too tall for you to reach the handle.")
  if (Got (ladder)) {
    msg ("You put the ladder up against the well, and climb up it.")
    this.used_ladder = true
    this.alias = "well with ladder"
  }
}
if (GetBoolean (this, "used_ladder")) {
  if (Got (bucket_with_water)) {
    msg ("Your bucket is already full of water.")
  }
  else if (Got (bucket)) {
    RemoveObject (bucket)
    AddToInventory (bucket_with_water)
    msg ("You fill your bucket with water.")
  }
  else {
    msg ("You play around with the handle a little, but it won't do much unless you can find a bucket.")
  }
}

If you want the player to think of using the ladder themself, you could make the script look more like:

if (not GetBoolean (this, "used_ladder")) {
  msg ("The well is too tall for you to reach!")
}
else if (Got (bucket_with_water)) {
  msg ("Your bucket is already full of water.")
}
else if (Got (bucket)) {
  RemoveObject (bucket)
  AddToInventory (bucket_with_water)
  msg ("You fill your bucket with water.")
}
else {
  msg ("You play around with the handle a little, but it won't do much unless you can find a bucket.")
}

In either case, you could allow the player to enter "use ladder" or "use ladder on well" by creating a script on the ladder's "Use/Give" tab.

If they're using the ladder on the well, the ladder's "use this on other object" or the well's "use other object on this" script would be:

well.used_ladder = true
well.alias = "well with ladder"
RemoveObject (ladder)
msg ("You put the ladder up against the well.")

If you're allowing "use ladder" as a command, then the script would need to check that you're in the right room:

if (ListContains (ScopeReachable(), well)) {
  well.used_ladder = true
  well.alias = "well with ladder"
  RemoveObject (this)
  msg ("You put the ladder up against the well.")
}

You could use any of these methods in combination; so that "use ladder" and "use ladder with well" can both work, even if entering "get water from well" would do it automatically. The principle of least surprise is a good maxim for text adventures; if there's more than one way a player might think of entering a command, they should all do something. So if I have a door that needs to be unlocked, I'll make the commands "unlock door" and "use key on door" do the same thing, even if "open door" would automatically unlock it if you have the key.

I hope that makes some sense.


Just test things out and see if they work.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums