Use anything on object
steve the gaming guy
27 Nov 2007, 17:28I'm churning out questions...must mean I'm busy on a game.
I want a custom response when you use any item on this one specific object.
For example, player types <use ball on bat>, "You can't use the ball" or <use cat on bat>, "You can't use the cat".
Where the description would use a variable of some sort. I started with "You can't use the #quest.thing#" and that did nothing. Then I found the following in the Help section...
So I made "You can't use the #quest.use.object.name#." Still doesn't work. In fact, every response has been "I can't see that here". What am I doing wrong?

I want a custom response when you use any item on this one specific object.
For example, player types <use ball on bat>, "You can't use the ball" or <use cat on bat>, "You can't use the cat".
Where the description would use a variable of some sort. I started with "You can't use the #quest.thing#" and that did nothing. Then I found the following in the Help section...
The Help section wrote:For use anything ... and use on anything ..., the game can find out what the other object is by reading the #quest.use.object.name# string variable. This will return the real (unaliased) name of the object.
So I made "You can't use the #quest.use.object.name#." Still doesn't work. In fact, every response has been "I can't see that here". What am I doing wrong?
Dr.Froth
27 Nov 2007, 20:30Here you go Steve. This is done with QDK and does exactly what you asked for.
Just compile that into QDK and run it. You will have all the instructions you need to conduct the test as well as be able to see what I have done in the QDK editor.
If you have any other questions I am always happy to help out.
' "Whack Test"
' Created with QDK Pro 4.02
!include <stdverbs.lib>
define game <Whack Test>
asl-version <400>
gametype singleplayer
start <Mars>
game author <drfroth>
game info <Created with QDK Pro 4.02>
end define
define options
debug on
panes on
end define
define room <Mars>
look <|n|nO.K. Take all of the items (sorry, I did not put in the take all command from the last example). When you have done so, go up to encounter the alien. Try to use everything except the sword on him. When you are ready, use the sword on the Blaxxeroup. (monster, creature, alien also works).|n|nThis will support drag and drop as well as "use fish on monster."|n|nGood Luck>
up <Outer Space>
define object <Fish>
take
prefix <the>
displaytype <Object>
article <it>
gender <it>
end define
define object <Mudpie>
take
prefix <the>
displaytype <Object>
article <it>
gender <it>
end define
define object <Loincloth>
take
prefix <the>
displaytype <Object>
article <it>
gender <it>
end define
define object <Sword>
take
prefix <the>
displaytype <Object>
article <it>
gender <it>
use {
if here <Blaxxeroup> then {
msg <You stab Blaxxeroup right in the mouth and save Mars. Yippie.>
playerwin } else msg <You do not need to use that here.>
}
end define
end define
define room <Outer Space>
look <Blaxxeroup the evil alien hovers above Mars. You must destory him.>
down <Mars>
define object <Blaxxeroup>
alt <monster;alien;beast;creature>
look <Blaxxeroup looks mighty angry. You better do something about this before he destroys Mars.>
take msg <You can only take him out... not take him.>
displaytype <Character>
article <him>
gender <he>
use <Sword> {
msg <You stab Blaxxeroup right in the mouth and save Mars. Yippie.>
playerwin
}
use anything msg <You can not use the #quest.use.object.name#.>
end define
end define
define text <win>
Alright... Hope this helps.
end define
Just compile that into QDK and run it. You will have all the instructions you need to conduct the test as well as be able to see what I have done in the QDK editor.
If you have any other questions I am always happy to help out.
steve the gaming guy
27 Nov 2007, 20:55Dang it... me and my bright ideas. I basically already have mine set up the same way yours is. Thank you, by the way.
I think something else that I've got hooked in is causing it to ignore it. I don't know why.
I thought it was a general game command that I was trying to get to work [ use #object# on #thing# ] or something along those lines. I removed that and it still doesn't seem to work. I noticed in your code, you had a "debug on" line. Does that help you in some way?
I'm tempted to email you the code with fear of you not being able to play the game when I'm done in the same light as if you had never seen it before. But at least you might be able to see if something else is buggying up the system. I do have some crazy stuff going on....for humor's sake. It's all about the jokes, man.
I think something else that I've got hooked in is causing it to ignore it. I don't know why.
I thought it was a general game command that I was trying to get to work [ use #object# on #thing# ] or something along those lines. I removed that and it still doesn't seem to work. I noticed in your code, you had a "debug on" line. Does that help you in some way?
I'm tempted to email you the code with fear of you not being able to play the game when I'm done in the same light as if you had never seen it before. But at least you might be able to see if something else is buggying up the system. I do have some crazy stuff going on....for humor's sake. It's all about the jokes, man.
Dr.Froth
27 Nov 2007, 21:16Sometimes the shortcuts we try to code in to keep us from having to copy and paste a few lines of code into several places end up creating more havoc and eating up more time in the end.
If things are not working quite like you think they should. Take everything on a case by case basis. Start with one object and do whatever it takes to make that one thing behave in the manner you are trying to achieve. Once you are successful try it on the next one. Then you can think about shortcuts, but if you still can not get it to happen just handle each object independently. In the end, results are the only thing that matters here.
Also, debugging will be simpler because you will only have problems with one or two of the objects.
This is especially true in a small game, like one the size for the christmas comp. You might as well give individual attention to everything in the game and save yourself some of the grief that blanket coding sometimes introduces.
That is my advice, for good or bad. I would, of course, be happy to examine your code for you at any time.
Good luck Steve
If things are not working quite like you think they should. Take everything on a case by case basis. Start with one object and do whatever it takes to make that one thing behave in the manner you are trying to achieve. Once you are successful try it on the next one. Then you can think about shortcuts, but if you still can not get it to happen just handle each object independently. In the end, results are the only thing that matters here.
Also, debugging will be simpler because you will only have problems with one or two of the objects.
This is especially true in a small game, like one the size for the christmas comp. You might as well give individual attention to everything in the game and save yourself some of the grief that blanket coding sometimes introduces.
That is my advice, for good or bad. I would, of course, be happy to examine your code for you at any time.
Good luck Steve
steve the gaming guy
27 Nov 2007, 21:29Well I came back to tell you I found the problem and then I saw your post.
I have a game command called "use #@object#" that looks at the property to see if the object I'm using is a weapon and then any item with the property of "scared" leaves the room. I had inquired about it in another post.
That command is causing my problems when I try to use an object on another object regardless of properties.
It's this code (same as posted in the other thread):
So basically, if it weren't for this, my original code using the "quest.use.object.name# would have worked and I wouldn't have posted this thread to begin with! Grrrrr.... but it's always fun to play with these and figure them out.
I have a game command called "use #@object#" that looks at the property to see if the object I'm using is a weapon and then any item with the property of "scared" leaves the room. I had inquired about it in another post.
That command is causing my problems when I try to use an object on another object regardless of properties.
It's this code (same as posted in the other thread):
command <use #@object#> if property <#object#; weapon> then {
for each object in <#quest.currentroom#> if property <#quest.thing#; scared> then {
msg <The crowd panics in fear and runs for their lives!>
move <#quest.thing#; inven>
show <block>
reveal <block>
}
}
else msg <You use your object or whatever would normally happen.>
end define
So basically, if it weren't for this, my original code using the "quest.use.object.name# would have worked and I wouldn't have posted this thread to begin with! Grrrrr.... but it's always fun to play with these and figure them out.
Dr.Froth
27 Nov 2007, 21:38I have nailed my self with a game command before. I feel your pain.
Glad you figured it out.
Glad you figured it out.
paul_one
28 Nov 2007, 21:25Dr.Froth wrote:Sometimes the shortcuts we try to code in to keep us from having to copy and paste a few lines of code into several places end up creating more havoc and eating up more time in the end.
That is so true!
Many a Quest-game has been cancelled due to the fact that I've got a nice way to do something - but it stops other things from working properly and you need to re-work that.
Steve, what if you use this just above the command you've put:
command <use #object# on #something#> exec <#quest.originalcommand#; norm>
(I hope I've done that correctly).
It should make Quest execute it and bypass any global commands (at least when I do it it skips all my library global commands).