[solved] Confused about Hotspot != null

Started by san.daniele, Wed 12/06/2013 19:26:07

Previous topic - Next topic

san.daniele

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
	if (Hotspot.GetAtScreenXY(mouse.x, mouse.y) != null) mouse.UseModeGraphic(eModeUsermode1);
	else mouse.UseDefaultGraphic();


while this works just fine:
Code: AGS
	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.

DoorKnobHandle

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!

san.daniele

#2
*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!

SMF spam blocked by CleanTalk