How do I use the pattern the player spoke?

Krammy
12 Jan 2014, 09:30
In my game, the player can either climb on, get on, or jump on any object.

Whichever thing they use I'd like it to change the response.

"You can't *climb on/get on/jump on* " + object.article + "."

Is there a phrase like object.article I could use to accomplish this? I'm sorry I'm still new to this.

jaynabonne
12 Jan 2014, 09:37
I'm assuming here that you're using a single verb/command with multiple possible matching phrases and you wish to know which phrase matched. (Otherwise, you'd have separate verbs, and you could just make each do what you want. :) ) To my knowledge, there isn't a way to extract out *which* phrase of a multi-phrase verb was matched. That information is lost.

What I would do is create separate verb/commands for each. You can still use a common handling function, but you'd be able to pass in the string that corresponds to which one was responsible.

I hope that makes sense.

Krammy
12 Jan 2014, 10:03
jaynabonne wrote:I'm assuming here that you're using a single verb/command with multiple possible matching phrases and you wish to know which phrase matched. (Otherwise, you'd have separate verbs, and you could just make each do what you want. :) ) To my knowledge, there isn't a way to extract out *which* phrase of a multi-phrase verb was matched. That information is lost.

What I would do is create separate verb/commands for each. You can still use a common handling function, but you'd be able to pass in the string that corresponds to which one was responsible.

I hope that makes sense.


So the answer is I can't? D:

I guess I'll just have to say "I can't do it." and be completely vague then.

jaynabonne
12 Jan 2014, 10:12
If you could provide an example of what you have set up and where you'd like to use the information about which verb/command been matched (I don't even know if you're using commands or verbs), then I'm sure someone could come up with a solution. If you have no code yet and you're just asking a general question, then if you give more information (again) about your setup (desktop version vs web version, for example), and how you'd like the commands/verbs to work, we could take it from there.

(I'm not a big one for "can't". :) )

Krammy
12 Jan 2014, 12:47
I'm using the desktop version as it has more features than the web version. I have a verb set up called "climb on; get on; jump on; stand on". When the player inputs one of those then the object name, I'd like it to say something like:

"I can't " + (climb on/get on/jump on/stand on) + " " + object.article + "."

Whichever one the player used. It sounds easy, but I don't know. S:

HegemonKhan
12 Jan 2014, 16:49
I'm surprised Jayna says that there's something that he can't do, lol. just kidding :D
(Is it impossible to code in some kind of parsing or whatever to do what you talked about, or can it be done, but it'd require an entire whole underlying engine code to be built in for it to be done? Just more curiosity of mine in what can be coded, and not, in my slow steps to try to understand more about coding and coding-logic)

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

aside from anything fancy Jayna can probably do, there's at least three basic ways for it to be done (you can choose which you'd like best, and then we can help you do it that way):

1. (as Jayna said) simply make~create (Add) a Verb for each: ie a "Climb~Get On", a "Jump On", and a "Stand On" Verb, so you'll have 3 Verb buttons and blue hyperlinks to click on.

"blah" Object -> Verb (Tab) -> Add -> (repeat this 3 times: and see below)

Added Verb: #1
Name: Climb~Get On
Script: Run as a script -> Add a script -> Print a message [EXPRESSION] "You climb on the " + this.alias + "." // (or: this.name, if you're didn't set the "alias" Attribute, ie didn't type something in the "Alias" box, under whatever Tab, I think it's the first ~left most~ Tab, whatever it is called)

// = these double forward slashes is the syntax~format~"coding" for when you're coding, to tell the game engine that this line is just a comment by you, and not coding for it to try to run, so when you see me using these "//" it's merely my comments to you

// "this" for within a Verb, can be used to "Get" the Object that the you added the Verb to, thus allowing you to also "Get" the Object's Attribute (for example): this.alias

// an example: "player" (Player Object) -> "Alias" Attribute: HK -> Verb (Tab) -> Add -> "Greetings" -> Print a message -> EXPRESSION -> "Hi, my name is " + this.alias + "." -> Output during game play: Hi, my name is HK. // or, if you used "this.name", then the output would be: Hi, my name is player.

Added Verb: #2
Name: Jump On
Script: Run as a script -> Add a script -> Print a message [EXPRESSION] "You jump on the " + this.alias + "."

Added Verb: #3
Name: Stand On
Script: Run as a script -> Add a script -> Print a message [EXPRESSION] "You stand on the " + this.alias + "."

2. Commands enable the user (person playing your game) to type in what they want to do, but it is otherwise the same as a Verb, we'd have to create 3 Commands for each of the actions~Scripts ("Climb~Get On", a "Jump On", and a "Stand On") that you want.

3. You can use the "show a menu" Script, which causes a pop-up menu window of choices, which we can use to select which of the 3 actions~Scripts ("Climb~Get On", a "Jump On", and a "Stand On") that you would like done.

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

if you want to use Commands or "show menu" Script instead, let me know, and I'll help you do those.

If you need any help or are confused at all with my post, let me know, and I'll try to be more clear or help you better.

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

P.S.

within the GUI~Editor, there's a toggle button to switch between "GUI~Editor mode" and "Code View mode" at the top of the screen, it's between the "play" and the "?~help" buttons, and it looks like a piece of note paper. When you're in the Code View mode, if you don't mind sharing your game code~game making, you can highlight your game code (or just a part of it), copy it, and then paste it here, within this "coding" (as it's otherwise messy if you don't):

[code.]paste your game code here[/code.]

but without the dots within the brackets

it looks like this:

Starting a new game, the default game code (well, I'm still using the older 540 version of quest, lol):

<asl version="540">
<include ref="English.aslx"/>
<include ref="Core.aslx"/>
<game name="Testing Game Stuff">
<gameid>d67ec73f-f879-4911-9d88-c02ea527c534</gameid>
<version>1.0</version>
<firstpublished>2013</firstpublished>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
</object>
</object>
</asl>


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

P.S.

writing out: Print a message -> EXPRESSIONS ->

In Code (easier~quicker to type for me, lol):

msg ("Hi, my name is " + player.alias + ". I'm a " + player.gender_string + player.age_string + player.class_string + ", with " + player.skin_color_string + " skin, " + player.eye_color_string + " eyes, and " + player.hair_color_string + " hair.")


it would look (output during game play) like this (A lot of these are custom ~self made-added and set-configured~ attributes that I add to my games):

Hi, my name is HK. I'm a male adult warrior, with white skin, blue eyes, and dark brown hair.

so, as you can see, very very very confusing... this is not easy to understand how to do it correctly... it took me a long long time, and I still have some trouble with it, lol. So, if you want to do this, let me or others help you with it.

----------

ya... computers are stupid, you have to write a lot more for it to understand what you want, lol:

we just type~say to each other:

I have brown hair.

to Code for a computer (well actually only this quest game software~program, anyways) to understand (this, as can be seen, is much longer than human to human communication, lol):

<object name="other_person">
<inherit name="editor_object" />
<alias>john</alias>
<attr name="greetings" type="script">
msg ("I have " + player.hair_color_string + "hair.")
</attr>
<displayverbs type="listextend">Greetings</displayverbs>
</object>

<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<alias>HK</alias>
<attr name="hair_color_string" type="string">brown</attr>
</object>

<verb>
<property>greetings</property>
<pattern>Greetings</pattern>
<defaultexpression>"You can't greet " + object.article + "."</defaultexpression>
</verb>