define interactions globally

Started by san.daniele, Thu 23/05/2013 13:32:16

Previous topic - Next topic

san.daniele

I probably used wrong wording in the title, but here's what I'm looking for:

there are several things in my game that apply to every hotspot/object (actually, I guess that's the case in almost every game).

like using whatever inventory item on whatever object/hotspot.
I defined lots of them, but I wonder if there's a way to add something to the GlobalScript, that comes into action if I didn't specify anything else in the room script? the character would just say something like "nope" or "can't use that here".
(hope I made myself clear)

similar to the above: is there a way to make ALL objects unclickable? (I'm sure there is and it's a veeery basic thing to know. so the question should be: what's the code for it?) I only use hotspots for interactions and it's a little annoying to manually make each object unclickable.

Khris

There's a built-in function called unhandled_event for this (bottom of the page).

You can also create completely custom global controls by using Game.GetLocationType, the various .GetAtScreenXY functions, and rewriting on_mouse_click.

Making all objects unclickable:
Code: ags
function on_event(EventType event, int data) {
  if (event == eEventBeforeFadein) {
    int i;
    while (i < Room.ObjectCount) {
      object[i].Clickable = false;
      i++;
    }
  }
}

san.daniele

As so many times before: Khris saves the day.

Thanks a lot!

SMF spam blocked by CleanTalk