Using default object.prefix in an expression

GiannisG
Hiya,

Being very new in Quest, I have learnt loads of stuff through this forum and through the tutorials, of course. Thanks people!

So here is what I want to do, now: I want to change the default answer for unsuccessful take attempts ("You can't take that") into a more sophisticated "You don't want to carry a ___ around."

For example:
>take closet
You don't want to carry a closet around.

I have figured out how to change text in the Dynamic Templates>TakeUnsuccessful and I have typed my new text as an expression of: "You don't want to carry " +object.prefix+ " " +object.alias+ " " + "around."

The problem is that the expression prints a message that seems to completely ignore the default prefix of any object. This means that, unless I uncheck the "use default prefix" box and manually fill in a prefix of my own (in all of my objects), I get nothing as a prefix in the message above, thus: "You don't want to carry closet around."

Do I need to do this manual job? How come the default prefix appears in other cases, e.g. in "You can see..." description headers?

Thanks in advance!
G.

jaynabonne
I don't have the Quest core source available at the moment - I'll take a look when I get home, unless someone beats me to it.

A direction: there is a function called GetDisplayAlias which returns object.alias if it's set or the name otherwise. There may be something similar for a prefix or easily created if not.

GiannisG
Thanks jaynabone for the quick reply!

Well, I had the same issue with the alias, too, so I made sure (manually) that all my objects have an alias. Otherwise, I can't use object.alias either. (I can always do the same with the prefix. Boring...)

But you suggest the GetDisplayAlias (and something similar for prefix). How would that work with fiddling with a dynamic template, though? Can I call a function from the 'Text:' line of a template? I think I have tried it and it resulted in error.

(And it is still a mystery to me how the game uses the default prefix for room or inventory descriptions, but I can't.)

Thanks again,
G.

Pertex
There is a function GetDefaultPrefix in the language file english.aslx which can be used for this:

<dynamictemplate name="TakeUnsuccessful">"You can't take " + GetDefaultPrefix(object) + " " + GetDisplayAlias(object)+ "."</dynamictemplate>

GiannisG
Yes, that's it!

Thanks Pertex!

So, as a conclusion, I suppose it is better to use " GetDisplayAlias(object) " and " GetDefaultPrefix " than object.prefix and object.alias in all cases, right? Better, meaning that one does not have to manually fill in the "prefix" or "alias" part in the object description tab.

Cheers, guys.

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

Support

Forums