Walking to object after interaction issue

Started by Psych0F0x, Sun 30/04/2006 10:21:54

Previous topic - Next topic

Psych0F0x

I searched everywhere but I couldn't find an answer to this problem:

When I interact with a thing, the character walks to the object first, but every other action is blocked(no cursor) until the character interacts with the object. I did the walking to object with the "walk to hotspot in look mode" thingy. I'm using a modified verb-coin from the MI3 template(which I haven't competely figured out yet).
I also just realised I could do the walking to hotspots manually and set it to eNoblock but is there an easier way?
Project currently in development: "The Outhouse"
Namus (my band) http://www.namusrock.com/

Ashen

Are you taling about Hotspots, or Objects? (Or both, since you use both terms.)

There's a couple of versions of non-blocking walk to scripts floating around, but I'm not sure how they'd fit into the MI3 template you're using. You could add the manual 'walk to' lines to on_mouse_click, which would at least be easier than having to set it for every hotspot/object/character individually. Perhaps this thread (which I think is a similar problem, if I'm understanding you right) could help?
I know what you're thinking ... Don't think that.

Psych0F0x

I'm talking about both, at first I didn't think that thread covered what I was talking about but I see it at the last posts. I can't really figure all those snippets of code out, I'm very new to this. I guess it could work by putting it in on_mouse_click, but I couldn't really get that to work.

What could I put in on_mouse_click so i'm able to click somewhere else while the character is already walking towards the hotspot/object with the intention of interacting/looking/talking/walking with it? And is it possible to get the walk-to coords of a hotspot/object?
Project currently in development: "The Outhouse"
Namus (my band) http://www.namusrock.com/

Scorpiorus

Quote from: Psych0F0x on Sun 30/04/2006 23:10:40What could I put in on_mouse_click so i'm able to click somewhere else while the character is already walking towards the hotspot/object with the intention of interacting/looking/talking/walking with it?

Well, Ashen's example for the other thread should work just fine. If you have some difficulties with integrating his scripts into yours, then just post complete scripts of your repeatedly_execute and on_mouse_click functions from the main global script, and we hopefully will be able to help embeding the necessary script in there.

QuoteAnd is it possible to get the walk-to coords of a hotspot/object?

As far as I know, objects don't have walk-to points; you can make them with a use of the custom properties, though.

As for hotspots, check Hotspot.WalkToX and Hotspot.WalkToY properties.

Psych0F0x

#4
Ok I guess it's better to post the code. I left the cursor over hotspot thing in incase there was something important in there(probably some junk in there too from fooling around with the verb coin) Another problem I have is that I can't use the verb-coin in my custom inventory, so any help with that is also very much appreciated.

Code: ags

#sectionstart repeatedly_execute  // DO NOT EDIT OR REMOVE THIS LINE
function repeatedly_execute() {

//  ******************** HOW TO MAKE CURSORS CHANGE OVER HOTSPOTS/OBJECTSA/CHARACTERS *******************************
//Using the GetLocationType function you don't have to write a code for every hotspot in the game and you get
//the cursor change also above objects and characters ( tou can modify it to change only on hotspots or objects,
//change it to TALK when above characters etc)
//Let's say your cursors are:
//0 WALK
//1 LOOK
//2 USE
//3 TALK
//4 TAKE // NOT USED
//5 CHANGED WALK
//6 CHANGED LOOK
//7 CHANGED USE
//8 CHANGED TALK
//9 WAIT
//Just put the following code in the GLOBAL SCRIPT'S REPEATEDLY EXECUTE function
string name;
GetLocationName(mouse.x,mouse.y,name); // Get the name of what's under the cursor
if (StrComp(name,"")==0) SetDefaultCursor(); // if blank ( or hotspot with no name
//'used for CHAR STANDS ON HOTSPOT') do nothing
else {
if (GetCursorMode()==0) { //if cursor is WALK
if (GetLocationType(mouse.x,mouse.y)>0) SetMouseCursor(1); // change cursor to CHANGED WALK
else SetDefaultCursor(); } // change back to WALK
}
//Verb Coin 
 if (IsGUIOn(2) == 0) { //is the GUI up? 
  if (clicked == 1) { //we check if someone clicked.. 
   if (IsButtonDown(LEFT) == 0) { //this executes if the button is released 
     if (timer < 7) { 
       timer=0; //reset the timer 
       clicked=0; //stop that checking 
       ProcessClick(mousex,mousey,0); 
       //if the button isn't held more than 7, you'll 
       //walk to the destination mousex,mousey... 
       } 
     } 
   if (IsButtonDown(LEFT) == 1) timer++; //While it's held, timer is increasing 
    
    
 if (timer >= 7) 
	{ //when you've held it for 7, the GUI pops 
     clicked=0; //guess what.. 
     timer=0; //and this? 
    if ((GetLocationType (mouse.x, mouse.y) != 0) || (GetInvAt (mouse.x, mouse.y) != -1)) 
		{ 
     SetGUIPosition(2,(guix - 6),(guiy - 20));  //selfexplanatory? Oh, our GUI is numero 2. 
     InterfaceOn(2); //turn the GUI on 
		}
else { //clicked 'nowhere', so...
      clicked=0; // stop checking
      timer=0; //reset timer
    }
	} 
} 
} 
   

  
 
 else { //what will be checked when the GUI is infact on
     clicked=0; //guess what.. 
    timer=0; //and this? 
if (IsButtonDown(LEFT) == 0) 
			  { //what will happen if you release da button?
				if (GetGUIAt(mouse.x,mouse.y) == 2) 
				  {
      //this function checks if the cursor
      //is over an GUI
					  int whatbutton;
					  whatbutton = GetGUIObjectAt(mouse.x,mouse.y);
					  InterfaceOff(2); //we'll turn the interface off
					  Wait(1); //To make sure that the GUI is gone
			    	if (whatbutton > -1) ProcessClick(mousex,mousey,whatbutton+1);
          //This is the great part. First we check which button. Then, since
          //the buttons is set in the default cursor modes values subracted
          //by 1, we'll add one and we'll get the appropriate cursor mode.
          //Since GetGUIObjectAt() returns -1 if it's not over an button, it
          //would execute in walkmode if you're still inside the GUI-area when
          //releasing it. So first we make sure that you released on
          //a button, ie. that the int whatbutton is bigger than -1
    clicked=0; //guess what.. 
    timer=0; //and this?
        }
     else InterfaceOff(2); //otherwise, we'll simply turn it off, without s.t. else
    clicked=0; //guess what.. 
    timer=0; //and this? 
     }
}


}



#sectionend repeatedly_execute  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart on_mouse_click  // DO NOT EDIT OR REMOVE THIS LINE
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==RIGHT) {
    if (GetCursorMode() == 4) SetCursorMode(0); //checks wether you use an inv.
 else { InterfaceOn(3); SetCursorMode(0); SetMouseCursor(0); }    
// else InventoryScreen();
                       //brings up the usual Sierra inventory..
                       //In the next versions, it'll simulate a CMI-like
                       //inventory...
    }
  else if (button==LEFT) {  // left-clicking code
  if (GetCursorMode() == 4) ProcessClick(mouse.x,mouse.y,4);
  else { //these codes check wether you use an inventory or not..
    clicked = 1; //we trigger the calculating

    mousex = mouse.x; //we set these params to store the exact location of
    mousey = mouse.y; //where you clicked...

    guix = mousex - 25; //and we set the whereabout's for the GUI... and to
    guiy = mousey - 25; //center the GUI, we'll remove 25 (see below)...

    if (guix < 0) guix = 0; if (guiy > 149) guiy = 149; 
    if (guiy < 0) guiy = 0; if (guix > 300) guix = 300;
      //Now we'll check these so the verbcoin won't appear to close to
      //the edges. If not altered, it may be impossible to select certain
      //commands! Why these numbers? Well, the GUI is exactly 50x50, which...

      //(NOTATE: the GUI is 50x50, not the graphic. That's why the GUI never will be
      //displayed without some space to the screen edge!!!)

      //...means that to center it by our clicks, it must be set to the mouse
      //coordinates - 25... AND, since AGS first coord. is (0,0), you
      //subtract 1 from the values. Also, as all other things, it spawns from
      //the top-right corner, so in the top and left side, well simply put it
      //close as possible ie. 0. On the other side, well take the largest value
      //(which is 319) and subtract 50 (the size of the GUI) and the equalent
      //from the bottom (199-50)
    }
    }
  }
#sectionend on_mouse_click  // DO NOT EDIT OR REMOVE THIS LINE

Project currently in development: "The Outhouse"
Namus (my band) http://www.namusrock.com/

Scorpiorus

QuoteAnother problem I have is that I can't use the verb-coin in my custom inventory, so any help with that is also very much appreciated.

Looking at the scripts and some comments, I believe this feature just isn't yet implemented:
Quote from: script//brings up the usual Sierra inventory..
//In the next versions, it'll simulate a CMI-like
//inventory...


Ah, and what version of AGS are you using?

Psych0F0x

Project currently in development: "The Outhouse"
Namus (my band) http://www.namusrock.com/

Scorpiorus

Ok, so the following script may contain some bits of ags2.71 syntax here and there:

add at the very top of the main global script:
Code: ags
// main global script file
bool GoneTo;
int mode;


repeatedly_execute():
Code: ags
#sectionstart repeatedly_executeÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function repeatedly_execute() {

// Walk-to, then run interaction
if (GoneTo == true && character[GetPlayerCharacter()].Moving == false)
{
Ã,  Ã,  ProcessClick (mousex, mousey, mode);
Ã,  Ã,  GoneTo = false;
}

//******************** HOW TO MAKE CURSORS CHANGE OVER HOTSPOTS/OBJECTSA/CHARACTERS *******************************
//Using the GetLocationType function you don't have to write a code for every hotspot in the game and you get
//the cursor change also above objects and characters ( tou can modify it to change only on hotspots or objects,
//change it to TALK when above characters etc)
//Let's say your cursors are:
//0 WALK
//1 LOOK
//2 USE
//3 TALK
//4 TAKE // NOT USED
//5 CHANGED WALK
//6 CHANGED LOOK
//7 CHANGED USE
//8 CHANGED TALK
//9 WAIT
//Just put the following code in the GLOBAL SCRIPT'S REPEATEDLY EXECUTE function
string name;
GetLocationName(mouse.x,mouse.y,name); // Get the name of what's under the cursor

if (StrComp(name,"")==0) SetDefaultCursor(); // if blank ( or hotspot with no name
//'used for CHAR STANDS ON HOTSPOT') do nothing
else
{
Ã,  Ã,  if (GetCursorMode()==0)
Ã,  Ã,  { //if cursor is WALK
Ã,  Ã,  Ã,  Ã,  if (GetLocationType(mouse.x,mouse.y)>0) SetMouseCursor(1); // change cursor to CHANGED WALK
Ã,  Ã,  Ã,  Ã,  else SetDefaultCursor();
Ã,  Ã,  } // change back to WALK
}


//Verb Coin 
if (IsGUIOn(2) == 0)
{ //is the GUI up? 
Ã,  Ã,  if (clicked == 1)
Ã,  Ã,  { //we check if someone clicked.. 
Ã,  Ã,  Ã,  Ã,  if (IsButtonDown(LEFT) == 0)
Ã,  Ã,  Ã,  Ã,  { //this executes if the button is released 
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  if (timer < 7)
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  { 
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  timer=0; //reset the timer 
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  clicked=0; //stop that checking 
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  ProcessClick(mousex,mousey,0); 
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  //if the button isn't held more than 7, you'll 
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  //walk to the destination mousex,mousey... 
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  } 
Ã,  Ã,  Ã,  Ã,  } 
Ã,  Ã,  Ã,  Ã,  
Ã,  Ã,  Ã,  Ã,  if (IsButtonDown(LEFT) == 1) timer++; //While it's held, timer is increasing 
Ã,  Ã,  
Ã,  Ã,  Ã,  Ã,  if (timer >= 7) 
Ã,  Ã,  Ã,  Ã,  { //when you've held it for 7, the GUI pops 
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  clicked=0; //guess what.. 
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  timer=0; //and this? 
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  if ((GetLocationType (mousex, mousey) != 0) || (GetInvAt (mousex, mousey) != -1)) 
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  { 
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  SetGUIPosition(2,(guix - 6),(guiy - 20));Ã,  //selfexplanatory? Oh, our GUI is numero 2. 
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  InterfaceOn(2); //turn the GUI on 
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  else
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  { //clicked 'nowhere', so...
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  clicked=0; // stop checking
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  timer=0; //reset timer
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  character[GetPlayerCharacter()].StopMoving(); 
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  Ã,  }

Ã,  Ã,  } 
} 
else
{ //what will be checked when the GUI is infact on
Ã,  Ã,  clicked=0; //guess what.. 
Ã,  Ã,  timer=0; //and this? 
Ã,  Ã,  
Ã,  Ã,  if (IsButtonDown(LEFT) == 0) 
Ã,  Ã,  { //what will happen if you release da button?
Ã,  Ã,  Ã,  Ã,  if (GetGUIAt(mouse.x,mouse.y) == 2) 
Ã,  Ã,  Ã,  Ã,  {
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  //this function checks if the cursor
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  //is over an GUI
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  int whatbutton;
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  whatbutton = GetGUIObjectAt(mouse.x,mouse.y);
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  InterfaceOff(2); //we'll turn the interface off
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Wait(1); //To make sure that the GUI is gone
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  if (whatbutton > -1)
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  {
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  mode = whatbutton + 1;
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  InventoryItem *item = InventoryItem.GetAtScreenXY(mousex, mousey);
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  if (item != null)
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  {
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  if (mode == eModeInteract)
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  {
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  player.ActiveInventory = item;
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  else
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  {
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  item.RunInteraction(mode);
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  else if (IsInteractionAvailable(mousex, mousey, mode) == 1)
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  {Ã,  
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  GoneTo = true;
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  ProcessClick(mousex, mousey, 0);
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  else
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  {
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  GoneTo = false;
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  character[GetPlayerCharacter()].StopMoving(); 
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  //This is the great part. First we check which button. Then, since
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  //the buttons is set in the default cursor modes values subracted
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  //by 1, we'll add one and we'll get the appropriate cursor mode.
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  //Since GetGUIObjectAt() returns -1 if it's not over an button, it
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  //would execute in walkmode if you're still inside the GUI-area when
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  //releasing it. So first we make sure that you released on
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  //a button, ie. that the int whatbutton is bigger than -1
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  clicked=0; //guess what.. 
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  timer=0; //and this?
Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  Ã,  else
Ã,  Ã,  Ã,  Ã,  {
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  InterfaceOff(2); //otherwise, we'll simply turn it off, without s.t. else
Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  Ã,  
Ã,  Ã,  Ã,  Ã,  clicked=0; //guess what.. 
Ã,  Ã,  Ã,  Ã,  timer=0; //and this? 
Ã,  Ã,  }
}

}
#sectionend repeatedly_executeÃ,  // DO NOT EDIT OR REMOVE THIS LINE


on_mouse_click(...):
Code: ags
#sectionstart on_mouse_clickÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function on_mouse_click(int button) {
Ã,  // called when a mouse button is clicked. button is either LEFT or RIGHT
Ã,  
if (button==LEFTINV)
{
Ã,  Ã,  if (GetCursorMode() == 4)
Ã,  Ã,  {
Ã,  Ã,  Ã,  Ã,  InterfaceOff(3);
Ã,  Ã,  Ã,  Ã,  inventory[game.inv_activated].RunInteraction(eModeUseinv);
Ã,  Ã,  }

}
Ã,  

if (button==RIGHT)
{
Ã,  Ã,  if (GetCursorMode() == 4)
Ã,  Ã,  {
Ã,  Ã,  Ã,  Ã,  player.ActiveInventory = null;
Ã,  Ã,  Ã,  Ã,  SetCursorMode(0); //checks wether you use an inv.
Ã,  Ã,  }
Ã,  Ã,  else
Ã,  Ã,  {
Ã,  Ã,  Ã,  Ã,  InterfaceOn(3);
Ã,  Ã,  Ã,  Ã,  //SetCursorMode(0);
Ã,  Ã,  Ã,  Ã,  //SetMouseCursor(0);
Ã,  Ã,  }
Ã,  Ã,  // else InventoryScreen();
Ã,  Ã,  //brings up the usual Sierra inventory..
Ã,  Ã,  //In the next versions, it'll simulate a CMI-like
Ã,  Ã,  //inventory...
}
else if (button==LEFT)
{Ã,  // left-clicking code
Ã,  Ã,  if (GetCursorMode() == 4)
Ã,  Ã,  {
Ã,  Ã,  Ã,  Ã,  mode = 4;
Ã,  Ã,  Ã,  Ã,  
Ã,  Ã,  Ã,  Ã,  mousex = mouse.x;
Ã,  Ã,  Ã,  Ã,  mousey = mouse.y;
Ã,  Ã,  Ã,  Ã,  
Ã,  Ã,  Ã,  Ã,  if (IsInteractionAvailable(mousex, mousey, mode) == 1)
Ã,  Ã,  Ã,  Ã,  {Ã,  
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  GoneTo = true;
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  ProcessClick(mousex, mousey, 0);
Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  Ã,  Ã,  else
Ã,  Ã,  Ã,  Ã,  {
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  GoneTo = false;
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  character[GetPlayerCharacter()].StopMoving(); 
Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  
Ã,  Ã,  }
Ã,  Ã,  else
Ã,  Ã,  { //these codes check wether you use an inventory or not..
Ã,  Ã,  Ã,  Ã,  clicked = 1; //we trigger the calculating

Ã,  Ã,  Ã,  Ã,  mousex = mouse.x; //we set these params to store the exact location of
Ã,  Ã,  Ã,  Ã,  mousey = mouse.y; //where you clicked...

Ã,  Ã,  Ã,  Ã,  guix = mousex - 25; //and we set the whereabout's for the GUI... and to
Ã,  Ã,  Ã,  Ã,  guiy = mousey - 25; //center the GUI, we'll remove 25 (see below)...

Ã,  Ã,  Ã,  Ã,  if (guix < 0) guix = 0; if (guiy > 149) guiy = 149; 
Ã,  Ã,  Ã,  Ã,  if (guiy < 0) guiy = 0; if (guix > 300) guix = 300;
Ã,  Ã,  Ã,  Ã,  //Now we'll check these so the verbcoin won't appear to close to
Ã,  Ã,  Ã,  Ã,  //the edges. If not altered, it may be impossible to select certain
Ã,  Ã,  Ã,  Ã,  //commands! Why these numbers? Well, the GUI is exactly 50x50, which...

Ã,  Ã,  Ã,  Ã,  //(NOTATE: the GUI is 50x50, not the graphic. That's why the GUI never will be
Ã,  Ã,  Ã,  Ã,  //displayed without some space to the screen edge!!!)

Ã,  Ã,  Ã,  Ã,  //...means that to center it by our clicks, it must be set to the mouse
Ã,  Ã,  Ã,  Ã,  //coordinates - 25... AND, since AGS first coord. is (0,0), you
Ã,  Ã,  Ã,  Ã,  //subtract 1 from the values. Also, as all other things, it spawns from
Ã,  Ã,  Ã,  Ã,  //the top-right corner, so in the top and left side, well simply put it
Ã,  Ã,  Ã,  Ã,  //close as possible ie. 0. On the other side, well take the largest value
Ã,  Ã,  Ã,  Ã,  //(which is 319) and subtract 50 (the size of the GUI) and the equalent
Ã,  Ã,  Ã,  Ã,  //from the bottom (199-50)
Ã,  Ã,  }
}

}
#sectionend on_mouse_clickÃ,  // DO NOT EDIT OR REMOVE THIS LINE


on_event() must be placed after on_mouse_click():
Code: ags
#sectionstart on_eventÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function on_event(EventType event, int data) {

Ã,  Ã,  if (event == eEventGUIMouseDown)
Ã,  Ã,  {
Ã,  Ã,  Ã,  Ã,  if (data == 3)
Ã,  Ã,  Ã,  Ã,  {
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  if (IsButtonDown(eMouseLeft)) on_mouse_click(eMouseLeft);
Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  else if (IsButtonDown(eMouseRight)) on_mouse_click(eMouseRight);
Ã,  Ã,  Ã,  Ã,  }
Ã,  Ã,  }
}
#sectionend on_eventÃ,  // DO NOT EDIT OR REMOVE THIS LINE


Also, for the code to work you have to tick the Handle inventory clicks in script option from the general settings.

And change VerbCoin GUI Z-order property to something like 100 so that it would be put over the inventory GUI.

I just quickly merged the scripts and haven't tested it much, so see if it works for you.

Psych0F0x

Wow thanks a lot! It's working, it has some bugs though but I'll just try and fool around a bit with it.
Project currently in development: "The Outhouse"
Namus (my band) http://www.namusrock.com/

SMF spam blocked by CleanTalk