Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: san.daniele on Wed 12/06/2013 19:26:07

Title: [solved] Confused about Hotspot != null
Post by: san.daniele on Wed 12/06/2013 19:26:07
I don't need any help, as I managed to make it work exactly how I want, but I'm a little confused.

The problem in a nutshell (slightly simplified)
I have only one hotspot in a room, called hLoad. Now I want to change the mousecursor when over that hotspot.

now this doesn't have any effect (in the room's rep_exec)
Code (AGS) Select
if (Hotspot.GetAtScreenXY(mouse.x, mouse.y) != null) mouse.UseModeGraphic(eModeUsermode1);
else mouse.UseDefaultGraphic();


while this works just fine:
Code (AGS) Select
if (Hotspot.GetAtScreenXY(mouse.x, mouse.y) == hLoad) mouse.UseModeGraphic(eModeUsermode1);
else mouse.UseDefaultGraphic();


I just can't find out what's going on and that bothers me. Why does != null not cover hLoad?
… what annoys me most is that this is probably a ridiculous basic thing and I'm making a fool out of myself by asking.
I tried some crazy theories like "maybe 'null' can only only be used with pointers" without getting any results.
Title: Re: Confused about Hotspot != null
Post by: DoorKnobHandle on Wed 12/06/2013 19:30:56
Read the manual is the simple answer!

Heh, this one also has had me stumped a lot whenever I was a bit out of the loop with AGS scripting. With hotspots, no hotspot is actually referenced to as hotspot[0], not null! I don't think Hotspot.GetAtScreenXY() can return null!
Title: Re: Confused about Hotspot != null
Post by: san.daniele on Wed 12/06/2013 19:38:35
*sigh*
I think I actually read about exactly that on another (maybe old) topic where CrimsonWizard mentioned that (or something along those lines).
*double-sigh with bumping my head into the wall*

thanks!