to many events posted

Started by YotamElal, Tue 15/03/2005 06:37:59

Previous topic - Next topic

YotamElal

Ive added this code to my left mouse button click in global file....
In the game I use an inv item on a hotspot it gives me this error...
"to many events posted"

here is my mouse click code
Code: ags


#sectionstart on_mouse_click  // DO NOT EDIT OR REMOVE THIS LINE
function on_mouse_click(int button) {
  if (IsGamePaused() == 1) {}
  else if (button==LEFT) {
        int outs = GetGraphicalVariable("outside");
    	int cursy=GetCursorMode();
	int currentlocationo = GetObjectAt (mouse.x, mouse.y); 	
	int currentlocationh = GetHotspotAt (mouse.x, mouse.y);
	int currentlocationc = GetCharacterAt (mouse.x, mouse.y);

	if (GetLocationType(mouse.x, mouse.y)==3 && cursy!=0){
		if (outs==1 && GetObjectProperty(currentlocationo, "Talk") == 0) return;}
	else if (GetLocationType(mouse.x, mouse.y)==1 && cursy!=0){
		if (outs==1 && GetHotspotProperty(currentlocationh, "Talk") == 0) return;}

	if (currentlocationc >= 0) {
	  if (GetCharacterProperty(currentlocationc, "Talk") == 0 && cursy==3) {
	    DisplaySpeech(EGO, "Hello?");
	    Wait(40);
	    DisplaySpeech(EGO, "???"); }
	  else {	    
	    if (GetCharacterProperty(currentlocationc, "NothingToDo") == 0 && cursy==2) {
	                if (GetCharacterProperty(currentlocationc, "UseInteract") == 4 && cursy==2) {
			FollowCharacter(EGO, currentlocationc);
			Wait(80);
			DisplaySpeech(EGO,"I like how that feels.");
			FollowCharacter(EGO, -1);
			}
			else DisplaySpeech(EGO,"I don't know what to do with it."); }
		else if (GetCharacterProperty(currentlocationc, "NothingToSee") == 0 && cursy==1) {
			DisplaySpeech(EGO,"There's not much to look at."); }
		else if (GetCharacterProperty(currentlocationc, "NothingToSee") > 0 && cursy==1) {
			int WhatToSee = GetCharacterProperty(currentlocationc, "NothingToSee");
			RunInventoryInteraction(WhatToSee, MODE_LOOK);
			}
		else if (GetCharacterProperty(currentlocationc, "WhatToUse1") != player.activeinv && cursy==4){
			if (GetCharacterProperty(currentlocationc, "WhatToUse2") != player.activeinv && cursy==4){
				if (GetCharacterProperty(currentlocationc, "WhatToUse3") != player.activeinv && cursy==4){
				  if (GetCharacterProperty(currentlocationc, "WhatToUse4") != player.activeinv && cursy==4){
				    if (GetCharacterProperty(currentlocationc, "WhatToUse5") != player.activeinv && cursy==4){
				      if (GetCharacterProperty(currentlocationc, "WhatToUse6") != player.activeinv && cursy==4){
					if (GetCharacterProperty(currentlocationc, "WhatToUse7") != player.activeinv && cursy==4){
					   if (GetCharacterProperty(currentlocationc, "WhatToUse8") != player.activeinv && cursy==4){
						DisplaySpeech(EGO,"I don't know what to do with it.");
						}
					   else ProcessClick(mouse.x, mouse.y, GetCursorMode() );
					   }
					   else ProcessClick(mouse.x, mouse.y, GetCursorMode() );
					   }
					   else ProcessClick(mouse.x, mouse.y, GetCursorMode() );
					   }
					else ProcessClick(mouse.x, mouse.y, GetCursorMode() );
				    }
				    else ProcessClick(mouse.x, mouse.y, GetCursorMode() );
				  }
				  else ProcessClick(mouse.x, mouse.y, GetCursorMode() );
				}
				else ProcessClick(mouse.x, mouse.y, GetCursorMode() );
			}
			else ProcessClick(mouse.x, mouse.y, GetCursorMode() );
			}
		return;
		}
	if (currentlocationo == -1 && currentlocationh == 0 && cursy != 0) return;
	if (currentlocationo == -1){
	  
	  	int mtn = GetHotspotProperty(currentlocationh, "MoveToN");
	  	int uact = GetHotspotProperty(currentlocationh, "UseInteract");
		if ((GetHotspotProperty(currentlocationh, "MoveTo") != -1) && (cursy==2 || cursy==4 || cursy==1) && uact!=0) {
			if (mtn == -1) MoveCharacterToHotspot(EGO, currentlocationh);
			else if (mtn >= 0) MoveCharacterToHotspot(EGO, mtn);
			}
		else if ((GetHotspotProperty(currentlocationh, "MoveTo") == 1 && (cursy==2 || cursy==4 || cursy==1) && uact!=0)) {
			if (mtn == -1) MoveCharacterToHotspot(EGO, currentlocationh);
			else if (mtn >= 0) MoveCharacterToHotspot(EGO, mtn);
			}
		else if ((GetHotspotProperty(currentlocationh, "MoveTo") == 2 && (cursy==2 || cursy==4 || cursy==1) && uact!=0)) {
			if (mtn == -1) MoveCharacterToHotspot(EGO, currentlocationh);
			else if (mtn >= 0) MoveCharacterToHotspot(EGO, mtn);
			}
	
		if (GetHotspotProperty(currentlocationh, "NothingToDo") == 0 && cursy==2 && uact!=0) {
			if (GetHotspotProperty(currentlocationh, "UseInteract") == 4 && cursy==2) {
			MoveCharacterToHotspot(EGO, currentlocationh);
			DisplaySpeech(EGO,"I like how that feels.");
			}
			else DisplaySpeech(EGO,"I don't know what to do with it."); }
		else if (GetHotspotProperty(currentlocationh, "NothingToSee") == 0 && cursy==1 && uact!=0) {
			DisplaySpeech(EGO,"There's not much to look at."); }
		else if (GetHotspotProperty(currentlocationh, "NothingToSee") > 0 && cursy==1 && uact!=0) {
			int WhatToSee = GetHotspotProperty(currentlocationh, "NothingToSee");
			RunInventoryInteraction(WhatToSee, MODE_LOOK);
			}
	
		else if (GetHotspotProperty(currentlocationh, "ObjOn") != -1 && cursy==4 && uact!=0) {
		if (GetGraphicalVariable("oncloud") == 0) {
		  DisplaySpeech(EGO, "I can't reach.");
		  return; }
		int invitemtouse = GetHotspotProperty(currentlocationh, "WhatToUse1");
		int objtoshow = GetHotspotProperty(currentlocationh, "ObjOn");
		if (character[EGO].activeinv == invitemtouse) {
		  SetCharacterClickable(EGO, 0);
		  ProcessClick(mouse.x, mouse.y, GetCursorMode() );
		  ObjectOn(objtoshow);
		  LoseInventory(invitemtouse);
		  SetCharacterClickable(EGO, 1);
		  }
					
		else if (GetHotspotProperty(currentlocationh, "Talk") == 1 && cursy==4 && uact!=0 && (GetGraphicalVariable("oncloud") == 1)) {
		if ((GetHotspotProperty(currentlocationh, "WhatToUse2") == character[EGO].activeinv) || (GetHotspotProperty(currentlocationh, "WhatToUse3") == character[EGO].activeinv) ||
		(GetHotspotProperty(currentlocationh, "WhatToUse4") == character[EGO].activeinv) || (GetHotspotProperty(currentlocationh, "WhatToUse5") == character[EGO].activeinv) ||
		(GetHotspotProperty(currentlocationh, "WhatToUse6") == character[EGO].activeinv) || (GetHotspotProperty(currentlocationh, "WhatToUse7") == character[EGO].activeinv) ||
		(GetHotspotProperty(currentlocationh, "WhatToUse8") == character[EGO].activeinv)) {
		DisplaySpeech(EGO, "It doesn't fit.");
		return; }
		}
		}
	
	
	
		else if (GetHotspotProperty(currentlocationh, "WhatToUse1") != player.activeinv && cursy==4 && uact!=0){
			if (GetHotspotProperty(currentlocationh, "WhatToUse2") != player.activeinv && cursy==4){
				if (GetHotspotProperty(currentlocationh, "WhatToUse3") != player.activeinv && cursy==4){
				  if (GetHotspotProperty(currentlocationh, "WhatToUse4") != player.activeinv && cursy==4){
				    if (GetHotspotProperty(currentlocationh, "WhatToUse5") != player.activeinv && cursy==4){
				      if (GetHotspotProperty(currentlocationh, "WhatToUse6") != player.activeinv && cursy==4){
					if (GetHotspotProperty(currentlocationh, "WhatToUse7") != player.activeinv && cursy==4){
					   if (GetHotspotProperty(currentlocationh, "WhatToUse8") != player.activeinv && cursy==4){
						DisplaySpeech(EGO,"I don't know what to do with it.");
						}
					   else { SetCharacterClickable(EGO, 0);
						ProcessClick(mouse.x, mouse.y, GetCursorMode() );
						SetCharacterClickable(EGO, 1); }
					   }
					   else { SetCharacterClickable(EGO, 0);
						ProcessClick(mouse.x, mouse.y, GetCursorMode() );
						SetCharacterClickable(EGO, 1); }
					   }
					   else { SetCharacterClickable(EGO, 0);
						ProcessClick(mouse.x, mouse.y, GetCursorMode() );
						SetCharacterClickable(EGO, 1); }
					   }
					   else { SetCharacterClickable(EGO, 0);
						ProcessClick(mouse.x, mouse.y, GetCursorMode() );
						SetCharacterClickable(EGO, 1); }
				    }
					   else { SetCharacterClickable(EGO, 0);
						ProcessClick(mouse.x, mouse.y, GetCursorMode() );
						SetCharacterClickable(EGO, 1); }
				  }
					   else { SetCharacterClickable(EGO, 0);
						ProcessClick(mouse.x, mouse.y, GetCursorMode() );
						SetCharacterClickable(EGO, 1); }
				}
					   else { SetCharacterClickable(EGO, 0);
						ProcessClick(mouse.x, mouse.y, GetCursorMode() );
						SetCharacterClickable(EGO, 1); }
			}
					   else { SetCharacterClickable(EGO, 0);
						ProcessClick(mouse.x, mouse.y, GetCursorMode() );
						SetCharacterClickable(EGO, 1); }
		return;
		}
		//else ProcessClick(mouse.x, mouse.y, GetCursorMode() );
	
	else if (currentlocationo >= 0){
	  
	int mtn = GetObjectProperty(currentlocationo, "MoveToN");
	int uact = GetObjectProperty(currentlocationo, "UseInteract");
	if ((GetObjectProperty(currentlocationo, "MoveTo") != -1) && (cursy==2 || cursy==4 || cursy==1) && uact!=0) {
		if (GetObjectProperty(currentlocationo, "MoveTo") == 0) {
			if (mtn == -1) MoveCharacterToObject(EGO, currentlocationo);
			else if (mtn >= 0) MoveCharacterToObject(EGO, mtn);
			}
		else if ((GetObjectProperty(currentlocationo, "MoveTo") == 1 && (cursy==2 || cursy==4 || cursy==1) && uact!=0)) {
			if (mtn == -1) MoveCharacterToObject(EGO, currentlocationo);
			else if (mtn >= 0) MoveCharacterToObject(EGO, mtn);
			}
		else if ((GetObjectProperty(currentlocationo, "MoveTo") == 2 && (cursy==2 || cursy==4 || cursy==1) && uact!=0)) {
			if (mtn == -1) MoveCharacterToHotspot(EGO, currentlocationo);
			else if (mtn >= 0) MoveCharacterToHotspot(EGO, mtn);
			}
		}

	if (GetObjectProperty(currentlocationo, "NothingToDo") == 0 && cursy==2 && uact!=0) {
		if (GetObjectProperty(currentlocationo, "UseInteract") == 4 && cursy==2) {
		MoveCharacterToObject(EGO, currentlocationo);
		DisplaySpeech(EGO,"I like how that feels.");
		}
		else DisplaySpeech(EGO,"I don't know what to do with it."); }
//new properties
	else if (GetObjectProperty(currentlocationo, "NothingToDo") == 2 && cursy==2 && uact!=0) {
		int invitem = GetObjectProperty(currentlocationo, "NothingToSee");
		SetCharacterClickable(EGO, 0);
		ProcessClick(mouse.x, mouse.y, GetCursorMode() );
		ObjectOff(currentlocationo);
		AddInventory(invitem);
		SetActiveInventory(invitem);
		SetCharacterClickable(EGO, 1);
		}
	else if (GetObjectProperty(currentlocationo, "NothingToDo") == 3 && cursy==4 && uact!=0) {
		int invitemtouse = GetObjectProperty(currentlocationo, "WhatToUse1");
		int invitemtoget = GetObjectProperty(currentlocationo, "NothingToSee");
		if (character[EGO].activeinv == invitemtouse) {
		  SetCharacterClickable(EGO, 0);
		  ProcessClick(mouse.x, mouse.y, GetCursorMode() );
		  ObjectOff(currentlocationo);
		  AddInventory(invitemtoget);
		  SetActiveInventory(invitemtoget);
		  SetCharacterClickable(EGO, 1);
		  }
		}
	else if (GetObjectProperty(currentlocationo, "Talk") == 2 && cursy==4 && uact!=0) {
		if ((GetObjectProperty(currentlocationo, "WhatToUse1") == character[EGO].activeinv)) DisplaySpeech(EGO, "I don't want to dig here anymore.");
		return;
		}

//new properties
	else if (GetObjectProperty(currentlocationo, "NothingToSee") == 0 && cursy==1 && uact!=0) {
		DisplaySpeech(EGO,"Nothing special to see."); }
	else if (GetObjectProperty(currentlocationo, "NothingToSee") > 0 && cursy==1 && uact!=0) {
		int WhatToSee = GetObjectProperty(currentlocationo, "NothingToSee");
		RunInventoryInteraction(WhatToSee, MODE_LOOK);
		}
	else if (GetObjectProperty(currentlocationo, "WhatToUse1") != player.activeinv && cursy==4 && uact!=0){
		if (GetObjectProperty(currentlocationo, "WhatToUse2") != player.activeinv && cursy==4){
			if (GetObjectProperty(currentlocationo, "WhatToUse3") != player.activeinv && cursy==4){
				if (GetObjectProperty(currentlocationo, "WhatToUse4") != player.activeinv && cursy==4){
				    if (GetObjectProperty(currentlocationo, "WhatToUse5") != player.activeinv && cursy==4){
				      if (GetObjectProperty(currentlocationo, "WhatToUse6") != player.activeinv && cursy==4){
					if (GetObjectProperty(currentlocationo, "WhatToUse7") != player.activeinv && cursy==4){
					   if (GetObjectProperty(currentlocationo, "WhatToUse8") != player.activeinv && cursy==4){
						DisplaySpeech(EGO,"I don't know what to do with it.");
						}
					   else { SetCharacterClickable(EGO, 0);
						ProcessClick(mouse.x, mouse.y, GetCursorMode() ); 
						SetCharacterClickable(EGO, 1); }
					   }
					   else { SetCharacterClickable(EGO, 0);
						ProcessClick(mouse.x, mouse.y, GetCursorMode() );
						SetCharacterClickable(EGO, 1); }
					   }
					   else { SetCharacterClickable(EGO, 0);
						ProcessClick(mouse.x, mouse.y, GetCursorMode() );
						SetCharacterClickable(EGO, 1); }
					   }
					   else { SetCharacterClickable(EGO, 0);
						ProcessClick(mouse.x, mouse.y, GetCursorMode() );
						SetCharacterClickable(EGO, 1); }
				    }
				  else { SetCharacterClickable(EGO, 0);
				  ProcessClick(mouse.x, mouse.y, GetCursorMode() );
				  SetCharacterClickable(EGO, 1); }
				  }
				  else { SetCharacterClickable(EGO, 0);
				  ProcessClick(mouse.x, mouse.y, GetCursorMode() ); 
				  SetCharacterClickable(EGO, 1); }
			}
			else { SetCharacterClickable(EGO, 0);
			ProcessClick(mouse.x, mouse.y, GetCursorMode() ); 
			SetCharacterClickable(EGO, 1); }
		}

		   else { SetCharacterClickable(EGO, 0);
		ProcessClick(mouse.x, mouse.y, GetCursorMode() ); 
		SetCharacterClickable(EGO, 1); }
		}
}
	

else if    (button==LEFTINV) {
   if (GetCursorMode()==MODE_USE) SetActiveInventory(game.inv_activated);
   else if (GetCursorMode()==4) {
		  int cursy=GetCursorMode();
		  int currentlocationi = GetInvAt(mouse.x, mouse.y);
		  if (currentlocationi == player.activeinv) return;
		  if (GetInvProperty(currentlocationi, "WhatToUse1") != player.activeinv){
			if (GetInvProperty(currentlocationi, "WhatToUse2") != player.activeinv){
				if (GetInvProperty(currentlocationi, "WhatToUse3") != player.activeinv){
				  if (GetInvProperty(currentlocationi, "WhatToUse4") != player.activeinv){
				    if (GetInvProperty(currentlocationi, "WhatToUse5") != player.activeinv){
				      if (GetInvProperty(currentlocationi, "WhatToUse6") != player.activeinv){
					if (GetInvProperty(currentlocationi, "WhatToUse7") != player.activeinv){
					   if (GetInvProperty(currentlocationi, "WhatToUse8") != player.activeinv){
						DisplaySpeech(EGO,"I don't know how to use them together.");
						}
					   else RunInventoryInteraction(game.inv_activated, GetCursorMode());
					   }
					   else RunInventoryInteraction(game.inv_activated, GetCursorMode());
					   }
					   else RunInventoryInteraction(game.inv_activated, GetCursorMode());
					   }
					else RunInventoryInteraction(game.inv_activated, GetCursorMode());
				    }
				    else RunInventoryInteraction(game.inv_activated, GetCursorMode());
				  }
				  else RunInventoryInteraction(game.inv_activated, GetCursorMode());
				}
				else RunInventoryInteraction(game.inv_activated, GetCursorMode());
			}
		else RunInventoryInteraction(game.inv_activated, GetCursorMode());
		}
else RunInventoryInteraction(game.inv_activated, GetCursorMode());
}

  else if (button == RIGHTINV) {
    DisableCursorMode(MODE_WALK);
    SetNextCursorMode();
    EnableCursorMode(MODE_WALK);
}

  else {   // right-click, so cycle cursor
    SetNextCursorMode();
  }
}
#sectionend on_mouse_click  // DO NOT EDIT OR REMOVE THIS LINE



YotamElal

I solved the problem.

In the interaction of the hotspot I had a line:
MoveCharacterToHotspot(EGO, 6);

I removed that line and there is no error.???

So everything works fine now...
I wonder why (MoveCharacterToHotspot(EGO, 6);) gave that wierd error??

SMF spam blocked by CleanTalk