Compound Verb Question part deux!
Anonymous
21 Mar 2004, 16:13I got my earlier problem of "ask mary to dance" to work. While doing so, I encountered a strange problem. When I referenced the object with #@AskTarget# to see if it had a dance verb defined it wouldn't work. But when I referred to the target as #AskTarget# to see if it had a verb defined everything worked. It doesn't make a lot of sense to me. Perhaps someone can tell me why #AskTarget# works when I would have thought #@AskTarget# would have worked better...
Here is the code sample for the command. This one works.... I bolded the area in question....
command <Ask #@AskTarget# to #AskRequest#> {
if ( #AskRequest# = ) then msg <ask #@AskTarget# what?> else {
if action <#AskTarget#; #AskRequest#> then doaction <#AskTarget#; #AskRequest#> else msg <#@AskTarget# doesn't know how to #AskRequest#!>}
}
This version does not work. I simply added the #@ to check if the object has the action defined.
command <Ask #@AskTarget# to #AskRequest#> {
if ( #AskRequest# = ) then msg <ask #@AskTarget# what?> else {
if action <#@AskTarget#; #AskRequest#> then doaction <#@AskTarget#; #AskRequest#> else msg <#@AskTarget# doesn't know how to #AskRequest#!>}
}
This seems strange to me. I thought it would be preferrable to refer to the object itself with the #@ to check for the existence of an action, but it didn't work for me.
Thanks for any advice.
-Radar
[/b]
Here is the code sample for the command. This one works.... I bolded the area in question....
command <Ask #@AskTarget# to #AskRequest#> {
if ( #AskRequest# = ) then msg <ask #@AskTarget# what?> else {
if action <#AskTarget#; #AskRequest#> then doaction <#AskTarget#; #AskRequest#> else msg <#@AskTarget# doesn't know how to #AskRequest#!>}
}
This version does not work. I simply added the #@ to check if the object has the action defined.
command <Ask #@AskTarget# to #AskRequest#> {
if ( #AskRequest# = ) then msg <ask #@AskTarget# what?> else {
if action <#@AskTarget#; #AskRequest#> then doaction <#@AskTarget#; #AskRequest#> else msg <#@AskTarget# doesn't know how to #AskRequest#!>}
}
This seems strange to me. I thought it would be preferrable to refer to the object itself with the #@ to check for the existence of an action, but it didn't work for me.
Thanks for any advice.
-Radar
[/b]
Alex
21 Mar 2004, 17:04The #@...# form is for the displayed object name. Never use it for actions or properties - you want to use the code name for those.
Let's imagine we have an object, which we'll display as "book" by setting its alias to "book". But in our code we call the object something like "fiction27".
When we have a command like "Read #@thing#", then we want the player to be able to type in "read book". Using the #@...# form allows us to do this, because we want it to work with the "book" alias.
However, when it comes to setting the properties of the object, it's "fiction27" we want to talk about, so we use "property <#thing#; hasbeenread>" etc.
If you were to use "property <#@thing# ... >" then Quest would be trying to set the property of the object with the code name "book" - which doesn't exist in our example here.
Let's imagine we have an object, which we'll display as "book" by setting its alias to "book". But in our code we call the object something like "fiction27".
When we have a command like "Read #@thing#", then we want the player to be able to type in "read book". Using the #@...# form allows us to do this, because we want it to work with the "book" alias.
However, when it comes to setting the properties of the object, it's "fiction27" we want to talk about, so we use "property <#thing#; hasbeenread>" etc.
If you were to use "property <#@thing# ... >" then Quest would be trying to set the property of the object with the code name "book" - which doesn't exist in our example here.
Anonymous
22 Mar 2004, 12:36Alex wrote:The #@...# form is for the displayed object name. Never use it for actions or properties - you want to use the code name for those.
Let's imagine we have an object, which we'll display as "book" by setting its alias to "book". But in our code we call the object something like "fiction27".
When we have a command like "Read #@thing#", then we want the player to be able to type in "read book". Using the #@...# form allows us to do this, because we want it to work with the "book" alias.
However, when it comes to setting the properties of the object, it's "fiction27" we want to talk about, so we use "property <#thing#; hasbeenread>" etc.
If you were to use "property <#@thing# ... >" then Quest would be trying to set the property of the object with the code name "book" - which doesn't exist in our example here.
thanks for the help Alex!
-Radar