IsInteractionAvailible turns up as 1 when it should be 0!

Started by Ytterbium, Fri 23/01/2004 02:14:49

Previous topic - Next topic

Ytterbium

I've set up the middle mouse button to activate a list of non-standard actions (i.e. other than the normal cursor modes, these actions could be "eat," "give," etc.), but it's only supposed to activate the choices which there are interactions set up for. I also set up other cursor modes for them so I could set up interactions. So I've used:

if (IsInteractionAvailable(mouse.x, mouse.y, [the cursor mode]) == 1)

to distinguish them. However, when I middle-click my player character, all the choices show up even when there aren't interactions set up for all of them. This doesn't seem to happen with hotspots. What's going on?

Currently in production: Septigon

Scorpiorus

Keep in mind that all additional cursors trigger the any click event. Can you provide the exact code that distinguishes between different modes?

Ytterbium

Quote from: Scorpiorus on Sat 24/01/2004 00:20:46
Keep in mind that all additional cursors trigger the any click event.

That would be the problem. And since cursor mode 10 can only be triggered with this, I guess I'll be forced to have a misleading verb menu, unless someone can think of a workaround. I have the any click interaction set to use a conditional to only do something if the cursor mode used is 10, but I guess that doesn't distinguish IsInteractionAvailibles. CJ, if you read this, please correct that bug in the next version.

Here's the code by the way (I've only put two verbs in the menu, so it's not complete yet):

Quoteif (button==MIDDLE) {
   Midclick_x = mouse.x; //Sets the current cursor position to Midclick_x, so the menu remembers where you middleclicked.
   Midclick_y = mouse.y; //Same as above, except for the y value
  SetCursorMode(6); //Sets cursor to the pointer
  if (IsInteractionAvailable(mouse.x, mouse.y, 9) == 1) { //This should only happen if there is a cursormode 9 interaction, but NOOOOOOOOOO!
    GUIOn(GIVE); //Turns on the GIVE menu button
  }
if (IsInteractionAvailable(mouse.x, mouse.y, 10) == 1) { //Same as above
    GUIOn(PICK); //Turns on the PICKPOCKET menu button
  }
}

Currently in production: Septigon

Scorpiorus

QuoteI have the any click interaction set to use a conditional to only do something if the cursor mode used is 10, but I guess that doesn't distinguish IsInteractionAvailibles. CJ, if you read this, please correct that bug in the next version.
The thing is the IsInteractionAvailible() checks for actual interaction to be assigned for the specific character/object/etc. And checking for interaction with modes greater than 9 tests the same Any click interaction. Moreover, even the standart cursor modes too fire any click event, so if you have assigned one for the game object then IsInteractionAvailable will return 1 in any case (with whatever mode).

One of the workarounds would be to use one mode (ex: Usermode 9) for a set of different extra modes (eat, push, etc). There are some difficulties with the test function being used to gain what extra interactions are actually available but it can be done.

Alternativity, you can leave additional cursors for different extra modes but also create custom properties for each character/objetc/hotspot, like:
Enable eat
Enable give
Enable push
....

So, you can set desirable values for every object and check them to enable/disable appropriate actions.

SMF spam blocked by CleanTalk