room description and 'look at room'

GiannisG
Hello people,

One of my testers complained that by typing 'look at room' you don't get the room description, as you do with simple 'look.'

I agree with him that it makes sense for a player to "look around" and to "look at room" or "look at ___" (room name), however I don't know how to implement these options, without much fuss.

(How come a room object doesn't have a 'look at' description?)

Any help welcome. Thanks in advance.

G.

jaynabonne
You can create your own "look at room" command and just have it call the function ShowRoomDescription()

GiannisG
Cool! Thanks!

Darkweaver
I actually had a related question and I don't want to clog the forum up with threads, so....

How do I create a "look" command when the player does something?

For example, when you turn on a lamp, I want the player to also automatically "look" after it's turned on. How do I go about doing this?

jaynabonne
Just call "ShowRoomDescription()" in your "turn on" verb handler after it's turned on.

Darkweaver
jaynabonne wrote:Just call "ShowRoomDescription()" in your "turn on" verb handler after it's turned on.

I'm really new at this. I know where you're talking about in the verbs tab and I can pull down and see the script, but I don't know where to put "ShowRoomDescription()" in it.

jaynabonne
Actually, this might be better. Is your lamp a "switchable" object? (Check it under the Features tab for the lamp. Make sure "Switchable: object can be switched on and off" is checked.)

Then on its Switchable tab, find "After switching on the object". Click "Add new script", and under "Scripts", choose "Call function" and click OK.

Then in that script line, put ShowRoomDescription in the box after "Call function".

I think that will do it.

(When I tried this, the "switch lamp on" command didn't work. When I looked at the object in Code View, there was an extra empty "turnon" string attribute that I had to delete. That may have been a leftover from my previous muckings. Just a note in case it happens to you.)

Darkweaver
jaynabonne wrote:Actually, this might be better. Is your lamp a "switchable" object? (Check it under the Features tab for the lamp. Make sure "Switchable: object can be switched on and off" is checked.)

Then on its Switchable tab, find "After switching on the object". Click "Add new script", and under "Scripts", choose "Call function" and click OK.

Then in that script line, put ShowRoomDescription in the box after "Call function".

I think that will do it.

(When I tried this, the "switch lamp on" command didn't work. When I looked at the object in Code View, there was an extra empty "turnon" string attribute that I had to delete. That may have been a leftover from my previous muckings. Just a note in case it happens to you.)

Well, I just made my lamp a container. :lol: Works exactly how I want it so I'm pretty stoked as it works perfectly. In fact, anyone having trouble making a portable lamp I can definitely lend a hand on that. Heh.

But, now I just need it to "look" whenever you turn it on (it's turned off at the beginning of the game).

So my lamp is a container now, with a "glow stone" (the light source) inside of it.

So, I just need the lamp when turned on to immediately "look" afterwards. There's got to be a ridiculously easy way to do that. :P

BTW, even though the lamp is a container, I added a "turn on" and "turn off" code (you can also open or close the lamp which has the same effect, since it is, well, a container). I explain this as the lamp having a sliding panel that reveals the glow stone within.

This is a pic of my lamp (in my demo game) code.

http://i.imgur.com/IQ79QoI.png

HegemonKhan
I've no idea how you'd do this in the GUI~Editor, but here's how you can do it in code:

for 'whatever' Object's 'whatever' Verb's script, just add this line, exactly as seen:

invoke (this.description)

or

invoke (this.look)

use whatever one (aka: 'look' or 'description' ) you want (and of course you set~wrote~scripted in your text~content for it to work)

---------

a Verb in code for an Object, looks like this:

the 'fight' tag ' <fight type="script">(scripts)</fight> ' is my 'orc_1' Object's Verb
(well, 'look' is also a verb too, or is it a command, meh)
(also, 'look' or is it 'lookat' ???, meh, is a default verb, for the GUI~Editor: so you just need to set it up as it exists already, you don't need to create~add it in, but if doing this in code, you'll have to write~code in your 'look~lookat' script ~ command ~ whatever it is, lol)

the ' <displayverbs type="listextend">(the new+extra verbs you want to add as buttons and hyperlinks of~for~on the 'orc_1' Object during game play, along with the default verbs such as 'drop' and etc)</displayverbs> ' does what I just explain it does.

if done in code, you got to write~code in the ' <verb></verb> ' Element blocks and also write~code in the ' <displayverbs></displayverbs> ', but if done in the GUI~Editor, it does these two things for you automatically, when you create (add) the verb of an object.

<object name="orc_1">
<inherit name="editor_object" />
<alias>orc</alias>
<fight type="script">
invoke (this.look)
</fight>
<look type="script">
msg ("Orcs are big, green, and mean.")
</look>
<displayverbs type="listextend">fight</displayverbs>
</object>

<verb name="fight">
<property>fight</property>
<pattern>fight</pattern>
<defaultexpression>You can't fight this thing.</defaultexpression>
</verb>

<verb name="look">
<property>look</property>
<pattern>look</pattern>
<defaultexpression>You can't look at this thing.</defaultexpression>
</verb>


if your object is a room, and you're using your 'portable lantern' Object's 'open~turn on' Verb: then use this line instead:

invoke (name_of_your_portable_lantern.description)

(and obviously write in your description for that room too)

-----

'this' is a special word~command~whatever it is technically (I forgot what Jay explained it as actually being, lol), that will use~get~become the Object that holds that script~verb, so if you're referencing a script for another object, then you can't use 'this', you'll have to write in that other Object's Name.

Darkweaver
Well, I'm going to have to admit I'm going to be so lost all around. You folks just have too much knowledge in this that it's way, way over my head. I love Quest but it seems I'm going to have to do a lot of this on my own since most of the replies are going way, way over my head. This is like Greek to me.

So my apologies but your reply just has me more confused. This is the code I see when I hit the "view code".

if (not Lamp.isopen) {
HelperOpenObject (Lamp)
msg ("The lamp emits an errie glow.")
}
else if (Lamp.isopen) {
msg ("The lamp is already opened.")
}


The one thing I love about Quest is how so much it can do but I'm becoming worried that it might not be for me now. I'm still having way too much fun messing around with it and I've been waiting for most of my life for a tool like this.

I dunno.... am I just too dumb for this?

privateer
Hi Darkweaver,

Don't be put off by confusing looking code. You can do lots of interesting things in the GUI editor, and you can certainly do what you asked.

I'm going to assume you have already experimented with the "Run a script" drop-down box, which gives you lots of options like "Print a message", "Show a picture", etc, which you can have happen when the player does something - like switch on a light, in your case.

About half way down the list of things you can do (at least on version 5.3 which I'm still using) you'll find one called "Call function". If you click on that you get a box wanting you to input what 'function' you want to run. For your purposes, entering:

ShowRoomDescription

in that box will do the trick (you don't need to worry about the other input box wanting parameters...I have no idea what that's for, and I'm guessing you don't want to be told yet anyway!)

Hope that helps!

HegemonKhan
change your code to this (if you want to do this via code, and ya ignore my previous code post if it confuses you, lol. It was the only way I could help, as I don't know how to help you through the GUI~editor, for this stuff you want):

if (not Lamp.isopen) {
HelperOpenObject (Lamp)
msg ("The lamp emits an errie glow.")
ShowRoomDescription
}
else if (Lamp.isopen) {
msg ("The lamp is already opened.")
}


or, Jay in his post, has it as ShowRoomDescription (), so try this code instead if the above doesn't work:

if (not Lamp.isopen) {
HelperOpenObject (Lamp)
msg ("The lamp emits an errie glow.")
ShowRoomDescription ()
}
else if (Lamp.isopen) {
msg ("The lamp is already opened.")
}

Darkweaver
Thank you, Privateer. That worked.

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

Support

Forums