Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Sat 11/10/2003 11:11:53

Title: Inventory on right click
Post by: on Sat 11/10/2003 11:11:53
Is there a way to show a popup inventory GUI by right clicking? If so, how?
Title: Re:Inventory on right click
Post by: Scorpiorus on Sat 11/10/2003 11:56:01
Yes, you can tweak the on_mouse_click() function in the global script; for example:

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 {   // right-click, so cycle cursor
   //SetNextCursorMode();
   InventoryScreen();
 }
}

...on right click displays the built-in sierra style inventory dialog.

~Cheers
Title: Re:Inventory on right click
Post by: on Sun 12/10/2003 04:45:43
Thanks a lot!

But now I face another problem. Every time my character exits a room and goes to the next, he is facing the same direction he was in the previous room. However, some rooms have different angles. I don't know if FaceDirection would work because I don't know how it works with coordinates. What should I do?
Title: Re:Inventory on right click
Post by: ThunderStorm on Sun 12/10/2003 13:09:00
I don't know why FaceLocation wouldn't work. If you want the player to face left for example, the script line
FaceLocation(EGO, character[EGO].x - 10, character[EGO].y); should do the job.
Assuming your character's script name is EGO, of course.
Title: Re:Inventory on right click
Post by: on Sun 12/10/2003 22:24:14
Oh. Nevermind I get it now. Thanks!