{CapFirst}

Heya all,

Another question that's been bugging me for a bit now. I prefer printing messages rather than having expressions when working in Quest, I find them easier - mostly.

One thing I tend to have to use expressions for is CapFirst as Quest doesn't recognise {CapFirst(player.gender)} or {CapFirst{player.gender}} in messages, through my current experience. Has anyone got a way to put this function into a message or am I doomed to expressions forever?

Thanks!


K.V.

Hello!

UPDATE:

See the answer here: http://textadventures.co.uk/forum/quest/topic/g1u-o_-ldkemnmiifa42aq/capfirst#da1b78ed-c5a1-475d-84b5-d5bd98646a6c

Click here to see some more complicated ways to pull off the same thing.

I don't think it matters if it's an expression or a message (but I may be mistaken (if I am, someone will most assuredly swoop in and save the day)).

There is a text processor, which translates code within curly braces { }.

I think this lists every option available: http://docs.textadventures.co.uk/quest/text_processor.html

NOTE: CapFirst is not listed. (Sorry!)


Are you only using it for player.gender? (Or was that just an example?)

You could make an attrbute:

player.capgender = CapFirst(player.gender)

Then, just use that attribute henceforth...

msg (player.capgender)

or

msg ("{player.capgender}")

or

msg ("" + player.capgender + "")

Each of these prints the same output

As long as player.capgender is set up (player.capgender = CapFirst(player.gender)), these all produce the same output:

Screenshot (GUI):

image

Script (Code View):

player.capgender = CapFirst(player.gender)
msg (player.capgender)
msg ("{player.capgender}")
msg ("{player.capgender}")
msg ("" + player.capgender + "")

Result:

image


K.V.

See the answer here: http://textadventures.co.uk/forum/quest/topic/g1u-o_-ldkemnmiifa42aq/capfirst#da1b78ed-c5a1-475d-84b5-d5bd98646a6c

Click here to view a couple of more ways to pull off the same thing.

This might help too:

image

Script: Code View:

msg ("" + CapFirst(player.gender) + " are reading this.")
player.capgender = CapFirst(player.gender)
msg ("{player.capgender} are reading this.")

image


Yeah, that's a neat idea. I could go the attribute route. It's generally that when I do expressions like that, I tend to just get so many errors about my quotation marks and especially when I'm doing large paragraphs of text where every his/her him/her and he/she needs to be some form of Lilt.possessive Lilt.gender etc, plus the other stuff. I think the issue is I'm pretty reliant on the GUI and need to learn to code more. I generally use the messages and rely on the curly brackets a lot for things like font, objects, commands, etc. But it's a good idea, I'll see if I can apply it.


As of 5.7 you can use any Quest code in an expression just by adding an equals sign.

{=CapFirst(player.gender)}

Thanks Pixie, saving me an eternity of time with this one!


K.V.

Ah...

I look, but I do not always see...


From the page I linked to in an above post:

{=code} This is a short cut for eval, and works just the same. The samples below show the potential, though by its nature this is rather less forgiving that the other commands available.

"You are in the {eval:player.parent.name}"
 -> "You are in the kitchen"
"You are in the {=player.parent.name}"
 -> "You are in the kitchen"
"You are in the {=CapFirst(player.parent.name)}"
 -> "You are in the Kitchen"
"There are {=ListCount(AllObjects())} objects"
-> "There are 6 objects"
"You look out the window: {=LookOutWindow}"
 -> "You look out the window: A figure is moving by the bushes"

And CapFirst is even one of the examples!

<bangs head on keyboard>


K.V.

It's generally that when I do expressions like that, I tend to just get so many errors about my quotation marks and especially when I'm doing large paragraphs of text where every his/her him/her and he/she needs to be some form of Lilt.possessive Lilt.gender etc, plus the other stuff.

Ha! You and me both!

Welcome to the club!!!


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

Support

Forums