I want my character to say something whe I tell him to look at a hotspot but I can't seem to find the proper script command. Any help would be welcomed.
Try this:
player.Say("It's a hotspot.");
also, this really belongs in the Beginners Tech Forum.
I didn't mean the actual saying but how to activate it when he looks at the hotspot.
Have you worked through the beginner's tutorial (http://www.adventuregamestudio.co.uk/acintro3.htm)?
Yes, but the tutorial only teaches how to do it with the wizard. I'm trying to learn how to do it via scripting only.
It's the same process, but instead of choosing "Display a message" or whatever in the interaction editor, choose "Run script" and then press the "Edit script" button.
I know that. I don't think you understand me correctly. My problam is not making the chracter talk via scipt but to check if and when he looks/uses a hotspot (via script).
You mean you don't want to use the hotspot/object interaction editor?
Exactly! It's not that I have anything against it, I'm just looking for ways to improve my scripting capabilities.
To clarify (I hope):
The first part of the Interaction Editor - the part with Look at hotspot, Interact hotspot, Use inventory on hotspot, etc:
(http://www.adventuregamestudio.co.uk/images/intro3_2.jpg)
This bit, is how you set what happens when the player clicks on a hotspot, depending what mode they're using, and is used however you're setting the commands (scripting or the interaction editor commands).
I suppose you could script all that for yourself (with checks in on_mouse_click, and a whole host of custom functions, for example) but it's really not worth it.
The second part:
(http://www.adventuregamestudio.co.uk/images/intro3_3.jpg)
All you need from the drop-down menu is Run Script.
So basiclly you just saying that there isn't a specific script function for checking hotspot interaction (correct me if I'm wrong). Oh well... I guess I'll just have to give up on that one. TNX anyway
There's no IsPlayerLookingAtHotspot() command, if that's what you mean.
When you click on the interaction type (e.g. Look at hotspot, in the first image) a function is created in the room script (accessable by Ctrl-E, or the '{}' button), which you can edit. The name of the function isn't constant though, so it's best not to try creating them yourself (More Detail (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=5376.0) - about room edge functions, but the same applies to hotspots, objects, etc.). If you want to call the interaction from somewhere else, you'd use the Hotspot.RunInteraction() command (e.g. hPicture.RunInteraction (eModeLookat);) - check the manual (http://www.adventuregamestudio.co.uk/manual/Hotspot.RunInteraction.htm) for more information.
And yes, this probably does belong in Beginner's Tech.
Quote from: Ashen on Sun 13/11/2005 18:57:52
There's no IsPlayerLookingAtHotspot() command, if that's what you mean.
That's exactly what i meant. Thanks again fot your help.
Actually, Ashen is wrong. You can do Hotspot.GetAtScreenXY(mouse.x, mouse.y) and if it is null, you are not looking at a hotspot, otherwise you are (and the function returns the pointer to that hotspot). You can also use IsIneractionAvailable to tell if a hotspot has an interaction, and you can use CallRoomScript with a aparameter to call a room-based funatiojn which can be codede to be hotspot specific. So you can entirely bypass the ineraction editor if you want, but it takes quite a lot of programming.
QuoteThere's no IsPlayerLookingAtHotspot() command, if that's what you mean.
QuoteActually, Ashen is wrong. You can do Hotspot.GetAtScreenXY(mouse.x, mouse.y)
Yes, sorry - bad example. I meant, there're no in-built functions that return whether an interaction is being run - I used 'Looking' as that's what Ricardo originally mentioned, but
IsPlayerUsing/TalkingTo/UsingInventoryOn/PickingUpHotspot() would all be the same.
EDIT: (As
I was a bit confused by that, and I know what I meant to say)
As, in, you can't do:
if (IsPlayerLookingAtHotspot(hBigDoor) == 1) Display("That's a big door!"); // i.e 'Look at hotspot "BigDoor"'
if (IsPlayerUsingHotspot(hBigDoor) == 1) Display("The big door is locked."); // i.e. 'Use hotspot "BigDoor"'
//etc
Although you could probably create these functions, or similar, if you really wanted to.
The rest of what SSH said is what I meant by "checks in
on_mouse_click and a whole host of custom functions" - he's just better at the details that I was.
Naturally, though, if you're going to take that route, you hardly need to use AGS' interface and can feel free to check out other engines which are 100% script-oriented.
Thanks everybody. As I said, the purpose of this question wasn't practical but educational... All I was looking for was another way to improve my scripting skills and you helped me a lot with that.
Thanks again