Object and hotspot interaction problem[NOT SOLVED]

Started by He-Man, Sun 05/06/2005 17:04:20

Previous topic - Next topic

He-Man

hi there

I have a strange problem with my game:
In the last two rooms of my game there are a couple of objects that are very hard to intetact with. It's almost as if there is some hidden object in front of these obejcts that keeps the player from interacting with the objects. The player needs to click on the object exactly the right place to interact. I've tried everything but I can't figure out what's wrong. The strange thing is that this bug happens on both a object and a hotspot...
I'm using Proskito's MI2 tempate v.13, but I don't think that has anything to do with the problem...

If my description of the problem is unclear, please check out what I mean. Here's the game:
http://www.adventuregamestudio.co.uk/games.php?action=detail&id=554
The bug appears when trying to open the crate and using the hose...
(I'll post a walkthrough after posting this!)
EDIT:
A complete walkthrough can be found here:
http://www.5feetunder.com/game/sk-walkthrough.doc

If anyone has any idea what causes this bug and/or how to solve it please write back...

monkey0506

Have you checked that the cursor hotspot is where you think it is?  I know it sounds crazy, but that sounds like it could be the problem.

He-Man

The cursor hotspot is where it should be. And the strange thing is that up to the these last two rooms the cursor and everything else works like it should.
The status bar in the bottom of the screen that show the OVERHOTSPOT says the objects' names. But as you click on the objects nothing happens... The action doesn't even go back to 'walk to' as it normally do when you interact with "nothing"!
It makes no sense.

monkey0506

Well then perhaps you created an interaction for them, but then never defined it (i.e., left it blank).  Or possibly you have an unhandled_event parameter getting thrown, but not handled?

Akumayo

Sounds too confusing for me, I think you should just delete the room and ya know, start over from scratch :-\
"Power is not a means - it is an end."

He-Man

Monkey_05_06:
Thanks, but I think you might misunderstand me!
If you click on the hotspot or object the right place the interaction works as it should.
This means you'll have to keep clicking 'use crate' different places on the crate until you find the spot that triggers the interaction. BTW this spot is always the same place.
This is not because the hotspot is not there since the status bar says that the cursor is over the hotspot.
It like half the hotspot is somehow disabled.

Akumayo:
This might end up being my last solution to this problem. It would be so much easier if somebody knew what caused the problem. It's going to be quite a lot of work since the bug appears in more than one room...

Akumayo

come to think of it, I've had a problem similar to this before.  I had some walk behinds left over from another room, and when I re-did the room for another purpose, I forgot to wipe the walk-behinds, this made the objects invisable, but not unclickable.  I think, somewhere in your game options, you can reverse this, making objects visable, but not clickable.  In short, check your room for walk behinds left over or accidental, they could be your problem, but this sounds more serious than that........
"Power is not a means - it is an end."

He-Man

Thanks for the quick answer, but walkbehinds are not the problem.
One of the rooms doesn't even have walkbehinds...
I don't get it...

Akumayo

hmm....sounds like a deep problem, try deleting every object affected and then replacing each (copy their scripts to somewhere else for your sake before deleting)
"Power is not a means - it is an end."

Pumaman

What code do you have in your global script for activating the mouse clicks?

I notice you've got it so that he walks non-blocking to the destination and then runs the interaction, so presumably you've got some custom script for that.

Can you post it? It's likely to be some sort of issue with that.

He-Man

I've got this in the Script Header:

/**///Cancelable semi-blocking move-player-character functions:
/**/import function MovePlayerEx(int x, int y, int direct);
/**/import function MovePlayer(int x, int y);
/**/import function Go();



And this in global script:

/**/function MovePlayerEx(int x, int y, int direct){
/**/Ã,  //Move the player character to x,y coords, waiting until he/she gets there, but allowing to cancel the action
/**/Ã,  //by pressing a mouse button.
Ã,  Ã,  Ã,  int cursorspritenumber=33,
Ã,  Ã,  Ã,  Ã,  Ã,  blankcursorspritenumber=34;
/**/Ã,  ChangeCursorGraphic(7,cursorspritenumber);
/**/Ã,  GScancelable=0;
/**/Ã,  if (direct==0) MoveCharacter(GetPlayerCharacter(),x,y);
/**/Ã,  else MoveCharacterDirect(GetPlayerCharacter(),x,y);
/**/Ã,  // wait for release of mouse button
/**/Ã,  while (character[GetPlayerCharacter()].walking && ((IsButtonDown(LEFT)==1) || (IsButtonDown(RIGHT)==1))) {
/**/Ã,  Ã,  Wait(1);
/**/Ã,  Ã,  RefreshMouse();
/**/Ã,  Ã,  CheckDefaultAction();
/**/Ã,  }
/**/Ã,  // abort moving on new mouse down
/**/Ã,  while (character[GetPlayerCharacter()].walking){
/**/Ã,  Ã,  if (IsButtonDown(LEFT)==1 && (GetGUIAt(mouse.x,mouse.y)<0 || GetInvAt(mouse.x,mouse.y)>=0)) {
/**/Ã,  Ã,  Ã,  StopMoving(GetPlayerCharacter());
/**/Ã,  Ã,  Ã,  GScancelable=1;
/**/Ã,  Ã,  }
/**/Ã,  Ã,  else if (IsButtonDown(RIGHT)==1 && (GetGUIAt(mouse.x,mouse.y)<0 || GetInvAt(mouse.x,mouse.y)>=0)) {
/**/Ã,  Ã,  Ã,  StopMoving(GetPlayerCharacter());
/**/Ã,  Ã,  Ã,  GScancelable=2;
/**/Ã,  Ã,  }
/**/Ã,  Ã,  else {
/**/Ã,  Ã,  Ã,  Wait(1);
/**/Ã,  Ã,  Ã,  RefreshMouse();
/**/Ã,  Ã,  Ã,  CheckDefaultAction();
/**/Ã,  Ã,  }
/**/Ã,  }
/**/Ã,  ChangeCursorGraphic(7,blankcursorspritenumber);
/**/Ã,  if (GScancelable==0) return 1;
/**/Ã,  else return 0;
/**/}
/**/
/**/
/**/function MovePlayer(int x, int y){
/**/Ã,  //Move the player character to x,y coords, waiting until he/she gets there, but allowing to cancel the action
/**/Ã,  //by pressing a mouse button.
/**/return MovePlayerEx(x,y,0);
/**/}


/**/function Go(){
/**/ // Go to whatever the player clicked on. You can cancel the action, and returns 1 if the player has gone to it.
/**/Ã,  return GoTo(2);
/**/}

I hope this helps
NOTE: This script is not by me but Proskito. I don't understand everything in there...

Pumaman

What about the script for on_mouse_click, where you call MovePlayer from? The script you've posted looks ok.

He-Man

I'm not sure the problem is in the Global script because everything works as it should everywhere except for the last two rooms...
But I'm that good at scripting so maybe you're right. I hope so...


/**/function on_mouse_click(int button) {////////////////////////////////////On Mouse Click///////////////On Mouse Click
/**/  // called when a mouse button is clicked. button is either LEFT or RIGHT
/**/ int mrx=mouse.x+GetViewportX(), mry=mouse.y+GetViewportY();
/**/ GSloctype=GetLocationType(mouse.x,mouse.y);
/**/ if (GSloctype==1) GSlocid=GetHotspotAt(mouse.x,mouse.y);
/**/ else if (GSloctype==2) GSlocid=GetCharacterAt(mouse.x,mouse.y);
/**/ else if (GSloctype==3) GSlocid=GetObjectAt(mouse.x,mouse.y);
/**/ else if (GetInvAt(mouse.x, mouse.y)>=0) GSlocid=GetInvAt(mouse.x, mouse.y);
/**/ GetLocationName(mouse.x,mouse.y,GSlocname);
/**/ StrCopy(GSprevusedmode,GSusedmode);
/**/ StrCopy(GSusedmode,GSmode);
/**/ if (IsGamePaused() == 1) {
/**/    // Game is paused, so do nothing (ie. don't allow mouse click)
/**/  }
/**/  else if (IsGUIOn(MAPS)==1){// if map
/**/    if (button==LEFT){
/**/      if (IsInteractionAvailable(mouse.x,mouse.y,MODE_USE)) ProcessClick(mouse.x,mouse.y,MODE_USE);
/**/      else ProcessClick(mouse.x,mouse.y,MODE_WALK);
/**/    }
/**/  }//end if map
/**/  else if (button==LEFT) {
/**/       if (GlobalCondition(2) || GlobalCondition(3) || GlobalCondition(4)) SetMode("default");
/**/       else if (StrCaseComp(GSdefaultaction,"exit")==0){ //GSoffscreen==1){
/**/            SetLabelColor(ACTION,0,ActionLabelColorHighlighted);
/**/            WalkOffScreen();
/**/            SetMode("default");
/**/            }
/**/       else if (GetCursorMode()==9 || GetHotspotAt(mrx-GetViewportX(),mry-GetViewportY()==0)){
/**/          SetLabelColor(ACTION,0,ActionLabelColorHighlighted);
/**/          if (IsInteractionAvailable(mouse.x,mouse.y,9)) ProcessClick(mrx-GetViewportX(),mry-GetViewportY(),9);
/**/          else ProcessClick(mrx-GetViewportX(),mry-GetViewportY(),MODE_WALK);
/**/       }
/**/       else{
/**/        UpdateActionBar();
/**/        SetLabelColor(ACTION,0,ActionLabelColorHighlighted);
/**/        StrCopy(GSusedmode,GSmode);
/**/        GSagsusedmode=GetCursorMode();
/**/        if (AlwaysGoToHotspots==1 && GSdontgo==0){
/**/         if (Go()==1) ProcessClick(mrx-GetViewportX(),mry-GetViewportY(), GetCursorMode() );
/**/        }
/**/        else ProcessClick(mrx-GetViewportX(),mry-GetViewportY(), GetCursorMode() );
/**/        SetMode("default");
/**/       }
/**/  }//end if button left
/**/  else if (GSallowrightclick==1 && button == RIGHT){
/**/     if (StrCaseComp("none",GSdefaultaction)==0) {
/**/        SetMode("default");
/**/        SetLabelColor(ACTION,0,ActionLabelColorHighlighted);
/**/        if (GetCursorMode()==9) ProcessClick(mrx-GetViewportX(),mry-GetViewportY(),MODE_WALK);
/**/        else ProcessClick(mrx-GetViewportX(),mry-GetViewportY(), GetCursorMode() );
/**/     }
/**/     else if (StrCaseComp(GSdefaultaction,"exit")==0){
/**/        SetLabelColor(ACTION,0,ActionLabelColorHighlighted);
/**/        WalkOffScreen();
/**/        SetMode("default");
/**/     }
/**/     else {
/**/       SetMode(GSdefaultaction);
/**/       UpdateActionBar();
/**/       SetLabelColor(ACTION,0,ActionLabelColorHighlighted);
/**/       StrCopy(GSusedmode,GSmode);
/**/       GSagsusedmode=GetCursorMode();
/**/        if (AlwaysGoToHotspots==1 && GSdontgo==0){
/**/         if (Go()==1) ProcessClick(mrx-GetViewportX(),mry-GetViewportY(), GetCursorMode() );
/**/        }
/**/        else ProcessClick(mrx-GetViewportX(),mry-GetViewportY(), GetCursorMode() );
/**/       SetMode("default");
/**/    }
/**/  }
/**/  else if (button == LEFTINV){//left click in inventory
////////Mode Look at if walk or pick up modes selected when mouse on inventory
/**/    if (GlobalCondition(1)){
/**/       SetMode("look at");
/**/       StrCopy(GSusedmode,GSmode);
/**/       GSagsusedmode=GetCursorMode();
/**/       SetLabelColor(ACTION,0,ActionLabelColorHighlighted);
/**/       RunInventoryInteraction(GSlocid, MODE_LOOK);
/**/       SetMode("default");
/**/    }
////////////////////////////////////////////////
/**/    else if(GlobalCondition(2)==1){}
/**/    else{
/**/       StrCopy(GSusedmode,GSmode);
/**/     if (GetCursorMode()==2){
/**/       if (GScaninteractinv==1 && IsInventoryInteractionAvailable(GSlocid,MODE_USE)==1){
/**/         SetLabelColor(ACTION,0,ActionLabelColorHighlighted);
/**/         RunInventoryInteraction(GSlocid, MODE_USE);
/**/         SetMode("default");
/**/       }
/**/       else SetActiveInventory(GSlocid);
/**/     }
/**/     else {
/**/       GSagsusedmode=GetCursorMode();
/**/       SetLabelColor(ACTION,0,ActionLabelColorHighlighted);
/**/       RunInventoryInteraction(GSlocid, GetCursorMode());
/**/       SetMode("default");
/**/     }
/**/    }
/**/  }
/**/  else if (GSallowrightclick==1 && button == RIGHTINV){
/**/     if (StrComp("none",GSdefaultaction)==0) SetMode("default");
/**/     else{
/**/       SetMode(GSdefaultaction);
/**/       StrCopy(GSusedmode,GSmode);
/**/       GSagsusedmode=GetCursorMode();
/**/       if (GetCursorMode()==2){
/**/         if (GScaninteractinv==1 && IsInventoryInteractionAvailable(GSlocid,MODE_USE)==1){
/**/           UpdateActionBar();
/**/           SetLabelColor(ACTION,0,ActionLabelColorHighlighted);
/**/           RunInventoryInteraction(GSlocid, MODE_USE);
/**/           SetMode("default");
/**/           }
/**/         else SetActiveInventory(GSlocid);
/**/       }
/**/       else {
/**/       UpdateActionBar();
/**/       SetLabelColor(ACTION,0,ActionLabelColorHighlighted);
/**/       RunInventoryInteraction(game.inv_activated, GetCursorMode());
/**/       SetMode("default");
/**/       }
/**/     } 
/**/  }
/**/}
/**/


Pumaman

#13
You've got a misplaced bracket here:

/**/Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  SetMode("default");
/**/Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  }
/**/Ã,  Ã,  Ã,  Ã, else if (GetCursorMode()==9 || GetHotspotAt(mrx-GetViewportX(),mry-GetViewportY()==0)){
/**/Ã,  Ã,  Ã,  Ã,  Ã,  SetLabelColor(ACTION,0,ActionLabelColorHighlighted);
/**/Ã,  Ã,  Ã,  Ã,  Ã,  if (IsInteractionAvailable(mouse.x,mouse.y,9)) ProcessClick(mrx-GetViewportX(),mry-GetViewportY(),9);

what you probably mean is:

else if (GetCursorMode()==9 || GetHotspotAt(mrx-GetViewportX(),mry-GetViewportY())==0) {

the code that you have at the moment is always doing a GetHotspotAt of (mrx-GetViewportX(), 0) so whether it works depends on whether there happens to be a hotspot at the top of the screen at that X co-ordinate.

In the crate room, for instance, because there's the window hotspot directly above the create at the very top of the screen, it will only work if you click on an area of the crate that's not under the window.

He-Man

That did the trick. I've just tested my game and now it works!
Thank you very much Pumaman.
I would never have seen that one...

Word!

He-Man

Crap!
After testing my game in the crate room everything was swell.
But now I've found out that after editing my script the player can't interact with any objects. The player can look at objects but every other interaction reacts the same way as the crate did before.
The hotspots work as they should...
This is kind of wierd, please help me!

Pumaman

I don't have time to go through the script right now, but you could try putting Display() calls at various places in on_mouse_click, to try and work out what's going on.

SMF spam blocked by CleanTalk