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

Messages - YotamElal

#161
Beginners' Technical Questions / SOLVED :o)
Tue 15/03/2005 08:46:27
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??
#162
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


#164
how do I center text in a gui label?
I searched the help & forums & couldnt find how.....
#165
It's working and I have no idea what caused the problem & how it got solved.
#166
scorpiorus:
PERFECT!!!!!!!!!!!!!!!!!!!

but I didn't understande why you wrote this??

Quote
Keep in mind, however, to deselect the active inventory item you need a separate GUI button with the following code:

SetActiveInventory(-1); // deselect the current active inv
SetCursorMode(MODE_USE); // back to the Use mode



strazer: RunInventoryInteraction(game.inv_activated, GetCursorMode());
              Doesn't pickup at all...
#167
when I try to look at an inv item or use an inv item with another one,
the item gets picked up.
:o(


Code: ags

function on_mouse_click(int button) {
  if (IsGamePaused() == 1) {}
  else if (button==LEFT) { ProcessClick(mouse.x, mouse.y, GetCursorMode() ); }
  else if (button == LEFTINV) { SetActiveInventory(game.inv_activated);}
  else if (button == RIGHTINV) {
    DisableCursorMode(MODE_WALK);
    SetNextCursorMode();
    EnableCursorMode(MODE_WALK);
  }
  else {   // right-click, so cycle cursor
    SetNextCursorMode();
  }
}
#168
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.
#169
This is the example code in the help file.
I am currently using it.

if (button == LEFTINV)
  RunInventoryInteraction(game.inv_activated, GetCursorMode());


It does not  let me look at an inv item.
It does not  let me use an inv item with another inv item.
:o(


#170
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)

??
#171
It seems to complicated.. I'll pass
#172
monkey0506:
I wrote: monkey0506 gave me this code to use instead of the hotspots.

(What I ment is that your code worked perfectly instead of the hotspots,
and I posted after I deleted them and saw that the iconbar works fine)

THNX AGAIN 4 THE CODE


TerranRich:
Thanks...
Yes, we should all be nice and polite to eachother,
cause there is enough shit in the world & in our lifes!
:o)
#173
Beginners' Technical Questions / oops
Mon 07/03/2005 07:39:28
oops

now I see that SetGraphicalVariable works fine...


ignore my last post...
#174
you don't need to remake any variables.
and you don't need to use SetGlobalInt istead.

in cases that you have want to set a graphical variable within an
"if condition" in a script,

all you have to do is add SetGlobalInt(10, 1) to the script (where you want to set your graphical variable)
and outside the script a graphical condition (if 10 = 1)
            Set Global Variable (whatever to whatever)

thats how u can set a graphical variable from within a script...


#175
it works fine on inv items.

can i allso make it work on the empty inv space???
#176
if you want something to happen when character NPC is close to you.

use this script in the rep_ex:

if (character[EGO].x < character[NPC].x + 50) {
   if (character[EGO].x > character[NPC].x - 50) {
      Display("Here comes a death animation.");
}
}

That's if you want EGO to dye when NPC is 50 pixels near EGO
(before the characters colide).
#177
 ??? no.. ???
#178
Thats a problem cuz it is background speech so if main player talks at the same time it will change his font to.

:o(
#179
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();
  }
}
#180
Is there anyway to do this...
SetCharacterFont(NPC, 4); ?? ???????
SMF spam blocked by CleanTalk