Problems with descriptions. "IF" may help? (Solved)

Geriperi
20 Aug 2016, 21:05

Hey, I am a noob in Quest and I'm having my first problems trying to make it work properly. I'll try to explain:

I wanted to describe a room and also explain that in this room is a box on the floor. Easy thing to do. But I want that, if people take the box, the description doesn't mention it the next time the player enters the room. Like this:

Nice room, there is a box on the flor.

take box

Woah, best box ever.

west
east

Nice room.

Can anyone help me here? Thanks! :)


hegemonkhan
20 Aug 2016, 22:02

I think this is discussed on some other thread/post a little ways back...

if I remember it...

(this post probably won't be too helpful if you're new to quest, and/or especially to coding)
(so, if you need help, let me know, and I'll try to help you do this stuff through the GUI~Editor in better detail)

it'd probably be best to uncheck the 'automatic room descriptions' option

and then add in your own scripts for controlling your room's 'description' (as a/changed to a: Script) Attribute, example in code for what the added scripts should be:

(replace my 'ROOM_NAME' with your room's name, and replace my 'BOX_NAME' with your box' name)

(or instead, you can replace my 'ROOM_NAME' with the special keyword/keycommand: this)

// 'ROOM_NAME' Room Object's 'description' (as a/changed to a: Script) Attribute:

if (Contains (ROOM_NAME, BOX_NAME)) {
  msg ("Nice room, there is a box on the floor.")
} else {
  msg ("Nice room.")
}

Watcher55
20 Aug 2016, 22:59

The other thing you can do is in the object setup, set the "In-room description" to " There is a {object:box} on the floor."

Then if the box isn't in the room, that text won't be shown, and if you drop it in another room, it will also be shown there.

To put line breaks in front of the text to separate it from the room description, use <br/> in the description.

Note this is somewhat less flexible than hegemonkhan's solution, as such in-room descriptions are added at the end only, not inside sentences.


XanMag
20 Aug 2016, 23:43

I assume you do not want the game to handle this automatically?

Nice room.
You can see a box.

Also, I assume, since you are asking the question, you know that you need to mark the 'Object List' in the Room Descriptions tab to zero if you intend to handle your objects in room manually. Just checking! =)


The Pixie
21 Aug 2016, 07:46

The text processor offers an alternative approach

Nice room{if BOX_NAME.parent=ROOM_NAME:, there is a box on the floor}.

Geriperi
21 Aug 2016, 20:51

Thanks guys! I'm actually new in both Quest and coding, so The Pixie offered me the simpliest way to deal with it. However I'm trying the rest of options anyway to get used to both code and Quest!