Buying a drink using ask/tell subjects

OurJud
Would I be able to use the ask/tell tab to set up a situation where the player could type, 'ask barman for [any name of drink]' and get a logical response like, 'He pours your drink and sets it down in front of you.'

I know I could do this with a command pattern, but it would only understand the commands I list. I would like to allow the player to say 'order [whatever] / buy [whatever] / ask barman for [whatever]' and not get the 'I don't understand that command.'

Thanks in advance.

Marzipan
Reread the tutorial section on custom commands.

Commands are what you need, because this is exactly the situation where #text# comes in handy. You can even have the bartender repeat back whatever the player ordered:

Print expression: "The bartender says, \"Sure thing man!\" and pours you a "+ text +"."

Of course it looks a little strange if the player tries to order a dozen Russian hookers or something, but if they put in a silly command they get a silly response, oh well. :P

OurJud
Thank you.

I was going to ask if you could have the barman repeat back your drink, but thought it would require of kinds of java shenanigans!

How come you're picking up this Quest so much quicker than me??

Marzipan
No problem, I haven't been in the mood to write much today but figuring this stuff out is at least making me feel like I'm being productive somehow. :)

And tbh, I may be new to Quest but I've fiddled around with ADRIFT on and off over the years (another system that's attractive in the same way Quest is since it doesn't require programming knowledge) and the way the logic of it all works is really similar in a lot of ways.

OurJud
I'm struggling to get the response I want.

The example tells you how to get the response 'You say "whatever", but nobody replies

But I want something like "A gin and tonic? Certainly sir."

In other words, just the barman's response in speech marks. I can't figure out the expression.

Oh, just noticed your example in your post. I think I can figure it from that.

And I thought wrong.

Marzipan
"\"A " + text + "? Certainly sir.\""

That one took some trial an error. All these random little punctuation marks that have to be precisely placed or else everything breaks are the bane of my existence.

e: I think the system is, there have to be quotation marks on either side of whatever you type, there have to be spaces and quotation marks on either side of the plus signs, and any normal quotation marks you want to show up for dialogue need those slash marks in front of them.

OurJud
You beat me to it, not surprisingly. That was starting to get on my paps!

Thanks again.

I probably had it at some point, but kept getting errors probably because of spaces (or lack of).

Marzipan
If only I could make this kind of progress on my own game. :(

HegemonKhan
the built-in 'ask' Function is a 'yes~no' question ONLY:

an example:

ask ("Would you like something to drink?") {
// you choose 'yes' or 'no'
// internally, the 'ask' Function converts:
// yes --> true
// no --> false
if (result = true) {
msg ("Ah, then what would you like to drink?")
} else if (result = false) {
msg ("Would you like something to eat instead then?")
}
}


so for a question with choices (a non-yes~no question):

such as in my above example: 'what would you like to drink?'

you got two (simplistic) options:

msg
get input

~OR~

show menu

an example using show menu:

ask ("Would you like something to drink?") {
if (result = true) {
show menu ("Ah, then what would you like to drink?", split ("water;soda;juice", ";"), false) {
invoke (result.drink)
}
} else if (result = false) {
ask ("Would you like something to eat instead then?") {
if (result = true) {
show menu ("Ah, then what would you like to eat?", split ("pizza;hamburger;salad", ";"), false) {
invoke (result.eat)
}
} else if (result = false) {
msg ("Okay, well if you get hungry and~or thirsty later, let me know.")
}
}
}
}


----------------------

to make the quotes be displayed in your msg:

\"

the back slash tells quest to display the quote to the right of it in your message

and this is part of the 'text', so it HAS to be within quotes, as well:

msg (" \"Hey, how are you doing?,\" your friend, " + npc1.alias + ", greets you.")

--------------

as for writing 'text' + Variable, there's a trick~secret to it:

break it into chunks!

(we're using Attributes for the Variable in this example, so: Object_name.Attribute_name)

the two chunks (separated by the pluses) :

" text "
+
Object_name.Attribute_name

or, if you prefer this look instead:

" text (including spaces) "
+ Object_name.Attribute_name +

---------------

an example:

player.alias = "HK"
player.gender_string = "male"
player.race = "human"
player.class = "warrior"

msg (player.alias + " is a " + player.gender_string + " " + player.race + " " + player.class + ".")
outputs: HK is a male human warrior.

the chunks:

player.alias
+
"(space) is (space) a (space)"
+
player.gender_string
+
"(space)"
+
player.race
+
"(space)"
+
player.class
+
"(dot~period: it's hard for my bad eyes to see it, lol)"

or, the alternative look:

player.alias +
"(space) is (space) a (space)"
+ player.gender_string +
"(space)"
+ player.race +
"(space)"
+ player.class +
"(dot~period: it's hard for my bad eyes to see it, lol)"

jaynabonne
Another way to do the response is to use the text processor. You can't reference the input text directly, but if you put in an object's attribute (e.g. on the game), then you can just print it out without all the string manipulation. Then you don't have to fight with the quotes and all that.

askdrink.png

OurJud
Thanks, Jay - always good to know alternatives. Maybe it's about time I started playing with variables, but the very word strikes fear into me.

HK, I think you're talking about something else when you talk about the 'ask' command. Marzipan and I are referring to the 'ask/tell' tab, which I think is a different thing altogether.

Marzipan, I'm surprised to hear you say your game's not developing. You've answered a fair few of my questions over the last few days so I imagined you flying through things. Unless the problem is simple writers' block, of course.

HegemonKhan
I am refering to the 'ask' built-in Verb~Command of the built-in 'Ask~Tell' Tab, which provides you with the built-in 'Ask' and 'Tell' Verbs~Commands.

---------

about Variables:

there's a bit of confusion in the term, as technically:

VARIABLES:
-> (1) 'Variables (Quest)' VARIABLES: Local (can't be used in other scripts, as it's not 'attached' to an Object, it's not 'saved', and thus it is not 'loadable' outside of its own script block)
-> (2) 'Attributes (Quest)' VARIABLES: Global (can be used in any~all other scripts, so long as the Object that holds the Attribute exists of course)

--------------------

Static:

msg ("Hi, HK.")
output is ALWAYS: Hi, HK.

Dynamic:

(algebraic substitution: using VARIABLES)

(Variable: x)
input: x = 10
y = x + 50
output: y = 60

(Variable: x)
input: x = 40
y = x + 50
output: y = 90

(the output depends upon the VARIABLE'S Value)

Variable: msg ("Hi, " + Variable_name + ".")

alias = "HK"
msg ("Hi, " + alias + ".")
output: Hi, HK.

alias = "OurJud"
msg ("Hi, " + alias + ".")
output: Hi, Ourjud.

text = "OurJud"
msg ("Hi, " + text + ".")
output: Hi, OurJud.

abcd = "OurJud"
msg ("Hi, " + abcd + ".")
output: Hi, OurJud.

Attribute: msg ("Hi, " + Object_name.Attribute_name + ".")

player.alias = "HK"
msg ("Hi, " + player.alias + ".")
output: Hi, HK.

player.alias = "OJ"
msg ("Hi, " + player.alias + ".")
output: Hi, OJ.

player.alias = "OurJud"
msg ("Hi, " + player.alias + ".")
output: Hi, OurJud.

npc1.alias = "orc"
msg ("Hi, " + npc1.alias + ".")
output: Hi, orc.

table1.description = "The table is made out of wood"
msg ("Hi, " + table1.description + ".")
output: Hi, The table is made out of wood.

-----------

Variable (Quest):

variable_name_string = Value_or_Expression

examples:

(recognize this built-in Variable?): result = Value_or_Expression
(another built-in Variable): value = Value_or_Expression
(recognize this built-in Variable?): #text# = text = Value_or_Expression
(recognize this built-in Variable?): #object# = object = Value_or_Expression
you_go_first = (false or true)
handled = (false or true)
count = Value_or_Expression
abcd = Value_or_Expression
1234 = Value_or_Expression
x = Value_or_Expression
y = Value_or_Expression
y = x
1 = Value_or_Expression
1 = x
list = split ("1;2;3", ";")
mylist = split ("a;b;c", ";")

Attributes (quest):

Object_name.Attribute_name = Value_or_Expression

player.alias = "HK"
npc1.alias = "orc"
player.head = helmet
player.strength = 100
player.damage = 389.53
player.equipped = split ("helmet;mail;guantlets;boots;grieves;pauldrons;sword;shield", ";")
orc.dead = false
player.flying = false

Marzipan
OurJud wrote:Unless the problem is simple writers' block, of course.


Yeah I'm just sick of coming up with new ways to describe trees basically. Mechanics-wise it's a really simple game. (Possibly that's one of the reasons I'm getting bored with it already...)

OurJud
Marzipan wrote:

"OurJud"

Unless the problem is simple writers' block, of course.



Yeah I'm just sick of coming up with new ways to describe trees basically.


I know exactly what you mean. I think I've exhausted every conceivable way there is to point out directions; 'To the north...', 'North leads to...'. 'To your north...', 'North takes you to...', 'On the north side...' :D

Out of interest, Marzipan, are you a chronic procrastinator?

HegemonKhan
if~when you complete even an uber rudimentary combat system (wink reference to noob coder HK's huge triumph), you will feel really proud and excited, as you 'attack' the orc, being able to see the damage done to it, and ultimately killing it, especially seeing critical damage done and~or from bonus damage due defending the turn before, hehe. Uber Rewarding! But most game making stuff is very very very very boring to do, not giving you much satisfaction as you craft it and as you play-test it, game making takes a super lot of dedication, much much of its creation aspects is very very very boring and un-rewarding. Combat is fun, so if~when you can complete some kind of combat system, even if only a small tiny bit of combat, it's very rewarding!

--------

Being a procrastinater is a great quality:

we don't foolishly rush into doing things, we think things out first, we rest up first so that we can perform at max ability, and etc... hehe ;)

OurJud
HegemonKhan wrote:Being a procrastinater is a great quality:

Not sure about that, HK. It means we never get anything done.

Silver
You get the procrastination done!

OurJud
Silver wrote:You get the procrastination done!

Well, yes. I read an article on chronic procrastination the other day, but it was only because I didn't want to do the dishes.

Marzipan
Chronic procrastinator? I have no idea what you're talking about I'm not a procra-- (eh, I'll come back and finish that sentence tomorrow ok) :P

Really though it's more that I just have to be 'in the zone' to get any significant amount of writing done. When I get home from work and I'm tired, or if I can't get privacy and a good stretch of uninterrupted free time, getting in the zone can be very difficult and it's actually waaay easier to just click around on forums or go archive binging on my favorite web comic or any other random thing that seems more attractive to my ADD addled brain at the moment. :D

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

Support

Forums