Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: lilinuyasha on Sun 20/07/2014 16:35:19

Title: ENabling hotspots through a dialog
Post by: lilinuyasha on Sun 20/07/2014 16:35:19
Hey there. it's been a long time since I've used AGS, and I've significantly decreased in my skill level.

I want a particular hotspot (hHotspot2[for all intents and purposes]) to be enabled only after I click on my character (cPinkie in script) with the hand. (IE Interact).

I've tried writing a hHotspot.enabled=true; command within the dialog (Properly tabbed of course) but it said something about an undefined token.
In order to try and get around this, i tried doing a Game.DoOnceOnly function to only do that dialog once, then enable the hotspot after. I kept getting some weird errors there, too. Currently, the hotspot is disabled (That much of the code works)but I want it to be enabled after dialog dTutorial2 finishes. I don't think a "Hasoptionbeenchosen" command would work since there's no option in the second dialog.

Anyways, if there's a way you could help me figure out how to run that dialog once, enable the hotspot for the rest of the game, and get me a girlfriend I'd greatly appreciate it.
Title: Re: ENabling hotspots through a dialog
Post by: AprilSkies on Sun 20/07/2014 17:12:32
If you need to enable it from a dialog, use the hotspot ID, not its name in the room.
if your hotspot ID is 1, use   hotspot[1].Enabled = true;
Title: Re: ENabling hotspots through a dialog
Post by: lilinuyasha on Sun 20/07/2014 17:25:46
I suppose I include the brackets as well?
Title: Re: ENabling hotspots through a dialog
Post by: AprilSkies on Sun 20/07/2014 17:41:47
Yes, as I wrote... atm i don't remember if hotspot[...] has the lower case, but i'm quite sure ys... anyway use the AGS smartness in completing words ;-)
Title: Re: ENabling hotspots through a dialog
Post by: lilinuyasha on Sun 20/07/2014 17:54:34
Thanks. I'll probably post a question in here about if/then statements later. I've forgotten everything ._.

[edit]

Yes, I remember my questions now. DoOnceOnly. How do I make clicking on a character run the dialog once? WHat's the proper syntax? I tried (If click on character Game.doOnceOnly(dTutorial2.start) but it gives me weird errors.
Title: Re: ENabling hotspots through a dialog
Post by: AprilSkies on Sun 20/07/2014 18:58:37
It happens because it's not that the way to use DoOnceOnly!

DoOnceOnly check if you already did something... relating the "check" to a "string".... it's easier to do than explain... so if you want to fire up a dialoge only once write:

if (Game.DoOnceOnly("Mickey_mouse")) dTutorial2.start;

"Mickey_mouse" is a word used to check if you did before ... it's like a variable... DON'T USE THE SAME WORD in other places in the game... so chose a weird word (LOL).. I Always use cartoons characters...

This way the dialogue is fired up only the first time.
Title: Re: ENabling hotspots through a dialog
Post by: Khris on Sun 20/07/2014 23:08:25
Ideally you should use a short sentence that describes the situation:

if (Game.DoOnceOnly("tutorial part 2")) dTutorial2.Start();

(I figure it is much easier to accidentally use a cartoon character twice. Also, please look up commands in the manual before asking how they are used.)