Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - YotamElal

#21
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


#22
how do I center text in a gui label?
I searched the help & forums & couldnt find how.....
#23
In room3 in my game there are two hotspots that I use a inv on and the loseinventory isn't working????????? (REALLY WIERD)

code for hotspot 3 (if inv 10 was used)
Code: ags

MoveCharacterToHotspot(EGO, 3);
ObjectOn(8);
LoseInventory(10);  

object 8 turns on but inv 10 isn't lost???


code for hotspot4 (if inv 11 was used)
Code: ags

MoveCharacterToHotspot(EGO, 4);
ObjectOn(9);
LoseInventory(11);

object 9 turns on but inv 11 isn't lost???


Wierd...
I don't have any problems like that anyware else in my game.
#24
I set HandleInventoryClicks to 1,
so I can have a right button that cycles instead of looks.

I want the left button to work like it does as defualt.

Can I set HandleInventoryClicks only for right button,
Or can anyone post the script for the left button
(as if it was handled automatically)

??
#25
Y isn't this working???

function on_mouse_click(int button) {
  // called when a mouse button is clicked. button is either LEFT or RIGHT
 
  if (IsGamePaused() == 1) {
    // Game is paused, so do nothing (ie. don't allow mouse click)
  }
  else if (button==LEFT) {
    ProcessClick(mouse.x, mouse.y, GetCursorMode() );
}

  else if (button == RIGHTINV) {
    DisableCursorMode(MODE_WALK);
    SetNextCursorMode();
    EnableCursorMode(MODE_WALK);
  }
  else {   // right-click, so cycle cursor
    SetNextCursorMode();
  }
}
#26
Is there anyway to do this...
SetCharacterFont(NPC, 4); ?? ???????
#27
is there a script like GetObjectY but for a character.
I want to beable to hit the chracter only when he is bigger than y,150
#28
Help!

I loaded a room and all of the hotspot and walkable areas have disapeared!?
#29
how do I change the walkable area view?

When my character walks in the mud he wears shoes.
(ok till now)
later on the game he buys boots and he wears them when walking on the mud.
How do I change the walkablearea 1 view 11 to view 12??
#30
displayspeechbackground with speech sound in background

displayspeechbackground doesn't play the speech sound???
problem.

I want someone to say somthing every 60 seconds but I don't want to wait
...?
#31
I don't want my popup gui to pause the game.

?
#32
my text on/off script
    if (button == 9) {
   SetVoiceMode(2);
}
   if (button == 10) {
   SetVoiceMode(1);
}

I want one button for on & off.
I want the button to change to sprite on when on is pressed
and to change to sprite off when off pressed again...??
#33
    if (button == 9) {
SetVoiceMode(2);
}
   if (button == 10) {
SetVoiceMode(1);
}


?
#34
How can I make a NPC character walk around random in walkspace 1?

I have other walkable areas that are enabled for my player character.

? :o)
#35
I made a custom gui save
using:
The Greek AGS Community example http://atticwindow.adventuredevelopers.com/tutorials.php?id=1

I want to add script for
overwrite game

&
script for
delete saved game
#36
Is there a way to edit save/load gui?
#37
is there a script

if (character is on screen co-ordinates x,y){
#38
how do I display speech every 30 seconds???
#39

* can I have duplicates of a character?

* and how do I turn a character off in one room and on in another?


I'm already about 85% done making my game.
THE QUEST TO ZOOLOO

:o)
#40
Is there a way I can let the player use the mouse to drag an object in a certain area?
SMF spam blocked by CleanTalk