LucasArts GUI Help Thread (NEW Scumm GUI Available!)

Started by TerranRich, Fri 01/08/2003 06:04:47

Previous topic - Next topic

Mr Flibble

Just a qucikie, how do I make a CMI like inventory, that I can open with a right click, use my left click activated pop-up verb GUI inside, then close by clicking outside the box?

At the moment I have a GUI with an inventory window.
I have buttons around the egdes so I can click on them to close it. When I pick things up they go into the inv, but I can't do anything with them. I want to be able to use my verb coin inside the inventory.

I'm not sure what script (if any) you'd like or need to see to help me out, so tell roughly what script you want and I'll copy it.
At the moment I have this:
Code: ags

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);   

To open the inventory.
Ah! There is no emoticon for what I'm feeling!

Scorpiorus

Handling clicks over GUIs requires additional script to be added. See Dorcan's tutorial on how to achieve that sort of thing:Ã,  http://www.digitalmindstudio.ch/script.php?id=1

I'm not, however, sure that the verb coin would work with the inventory items without an extra code added. What's the complete code of the on_mouse_click() function?

Mr Flibble

Something like this.

function on mouse click()
something//we checked if the mouse was clicked
timer >20 (?) //hold the left button for half a second

/////More stuff along those lines


else interfaceoff(2) // the VB
Ah! There is no emoticon for what I'm feeling!

Scorpiorus

The exact code would be very helpful. ;)

Mr Flibble

Code: ags

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);   
                       //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 (guix > 269) guix = 269;
    if (guiy < 0) guiy = 0; if (guiy > 149) guiy = 149;
      //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)
      }
    }
  }


Where Interface 3 is the inventory and interface 2 (if mentioned) is the verb coin.

In my game, I can pick up items and they appear in the inventory. Fair enough. But I can't interact with in any way. I can't even bring up the interface GUI. I think this might be caused by the interface being popup modal, or the line in the above code which tells the game to ignore clicks when game is paused. (Ie, Popup Modal)
Even if that is that problem, I'm not sure how to fix it.

What I'd like to be able to do, is to either click on an inventory item, have it appear as my cursor, then be able to click off the Inv screen off (already set up with buttons around the edges) and use the item on things in a room.

Either that, or hold the mouse down and have the verb coin appear.
I should probably make it clear I'd like to be able to do both, if possible.

If that doesn't make sense, basically I want a CMI like inv screen, where you could click and have the item as your cursor, or hold and have your verb coin appear.

Sorry for posting this so late. Thanks in advance for any help that anyone could give me.
Ah! There is no emoticon for what I'm feeling!

Scorpiorus

After Skimbleshanks became unfrozen I downloaded 2ma2's VerbCoin template to look into the implementation. As the author says there is no yet support for verbcoins for the inventory items and that's one of the TODOs for the next version. Unfortunately, due to how the on_mouse_click() event function works it would require to rewrite some parts in order for the inventory verbcoin to become possible.
As for making an item appear as the active one the following modification should do the trick:

1. On the general settings pane tick: Handle inventory clicks in script

2. Put the addition code within the on_mouse_click function:

function on_mouse_click(int button) {
   // called when a mouse button is clicked. button is either LEFT or RIGHT
   if (button==RIGHTINV) RunInventoryInteraction(game.inv_activated, MODE_LOOK);
   else if (button==LEFTINV) SetActiveInventory(game.inv_activated);


   if (IsGamePaused() == 1) {
      // Game is paused, so do nothing (ie. don't allow mouse click)
   }
   else if (button==RIGHT) {
   ...
   ...
   ...

monkey_05_06-beinglazy

Quote from: Kinoko on Tue 27/04/2004 15:55:57
Quote from: monkey_05_06 on Fri 02/04/2004 23:31:45
yes, well. i'm not sure why, but like I said, i tried creating an invisble object in its place, moving it, and recreating the object on a different object number but it didn't work... I feel so confused............... Ã,  Ã,  Ã,  Ã,  Ã, ... Ã,  Ã,  Ã,  .............. Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã, ........... Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  Ã,  ................. ....

If it is like my problem (and this one REALLY stumped me), have a look at the other hotspots you have in that room, and in particular, which ones are near the object that won't work. Do any of those hotspots/walk behinds etc go all the way to the edge of the room? That was what my problem was. For some reason, the engine just didn't like a hotspot being on any of the pixelks around the very edge of the room. It made everything near it act like a "walk to".

I hope that helps.

Well, I'm looking at it now... I have 0 hotspots in the room. 1 type of walkable area, all connected, which does touch the edge of the screen. 0 walk-behinds. 0 regions. OOps. Never mind. That is the wrong room. Haha. Yes, I do have 1 hotspot that touches the edge of the screen. WOW. THANK YOU. I know it's been a long time since you posted that message, but that's my fault for not looking. Now all I have to do is learn how to draw. And then I have a great template. And I'm making a Guybrush character using the SOMI Guybrush but putting him in his EMI clothes. That looks cool. THANK YOU!!! I LOVE YOU!!! In a non-sexual non-gay way.

Mr Flibble

Scorpius, I tried your code.
For what its worth, it worked, now I can pick up inv items under my mouse cursor.
Still 3 problems;
1. I can't use an item with a room or something in it
2. I can't use an item on another inv item
3. I still can't use the verb coin on inv items.

Can anyone fix any of these?
Should I maybe start this as a new thread to reach a wider audience?
Ah! There is no emoticon for what I'm feeling!

Edwin Xie

First of all, what is a Verb Coin Template?
Moving at superhigh speed getting to the planet called Earth. But it is boxed in white......thing.....

Mr Flibble

How simple do you want it?
Let me break it down into small sylable words.

"Verb"
Doing word, like "look" or "use"
"Coin"
Round object

Ergo "Verb Coin"
A small round object with action words on it.
This one is turned on with a mouse click, like the ones in Full Throttle and CMI.

"Template"
Refers to a game that someone has release with editor files as opensource for you to build you rgame around, to save the trouble of building your own, buggy interface.
Ah! There is no emoticon for what I'm feeling!

Scorpiorus

Quote from: Mr Flibble on Sat 12/06/2004 19:33:53Still 3 problems;
1. I can't use an item with a room or something in it
2. I can't use an item on another inv item
Ah, yeah, a little modification to the on_mouse_click function:

function on_mouse_click(int button) {
   // called when a mouse button is clicked. button is either LEFT or RIGHT

   if (button==RIGHTINV) RunInventoryInteraction(game.inv_activated, MODE_LOOK);
   else if (button==LEFTINV) {
      if (character[GetPlayerCharacter()].activeinv!=-1) RunInventoryInteraction(game.inv_activated, MODE_USEINV);
      else SetActiveInventory(game.inv_activated);
   }
   else if (button==LEFT) {
      if (character[GetPlayerCharacter()].activeinv!=-1) ProcessClick(mouse.x, mouse.y, MODE_USEINV);
   }
   else if (button==RIGHT) {
      if (character[GetPlayerCharacter()].activeinv!=-1) SetActiveInventory(-1);
   }


   if (IsGamePaused() == 1) {
      // Game is paused, so do nothing (ie. don't allow mouse click)
   }
   else if (button==RIGHT) {
   ...
   ...
   ...


Quote3. I still can't use the verb coin on inv items.
That one would result in more sagnificant changes around the whole script. Maybe rewriting the whole verbcoin pop up routine.

Estaog

This is the worst problem that keeps coming up:



See how the inventory is crushed in each other and how the last item is pushed out of the screen?

Any help?

Think about the kittens man!

http://members.aol.com/johnk0/godkills.jpg

Mr Flibble

Are all of the item sprites the same size?
I, of course, refer to the inventory object's sprite, not the room object.
Ah! There is no emoticon for what I'm feeling!

Estaog

Think about the kittens man!

http://members.aol.com/johnk0/godkills.jpg

Mr Flibble

So Scorpius, it is possible to use the verb coin on the inventory, just difficult?

I'm gonna go take a crack at it, but in the mean time, does anyone else know how to do this?
Ah! There is no emoticon for what I'm feeling!

Scorpiorus

#135
Quote from: Mr Flibble on Mon 21/06/2004 19:21:33So Scorpius, it is possible to use the verb coin on the inventory, just difficult?
It's not difficult but can be of some hassle since the on_mouse_click function isn't invoked on clicking on a GUI. Handling mouse clicks in script option doesn't help much since in that case the on_mouse_click is called after a mouse button was released whereas on standart LEFT and RIGHT events it's triggered when a button is pressed. So, you have to handle mouse clicks either via the repeatedly execute function or also with a help of the on_event's GUI_MDOWN event.

QuoteI'm gonna go take a crack at it, but in the mean time, does anyone else know how to do this?
Take a look in that thread for how a verbcoin working with inventory items can be implemented http://www.agsforums.com/yabb/index.php?topic=5799

Mr Flibble

Thanks Scorpius.
I'll try that, and hopefully it'll work. If not, I should be able to muddle through.
Ah! There is no emoticon for what I'm feeling!

OftenK

I noticed that, when using the default AGS inventory system, when you click an item, your cursor changes to that item. However, when you draw an inventory box on a custom GUI (not unlike the traditional Lucasarts format), when you click an item, it changes to the inventory cursor (which I never use, and never liked.) How can it I make it so when I click an item in my inventory box, the cursor changes to said item?

--OftenK

Scummbuddy

in the general settings pane, on the right side there is a selection for inventory items, with two checkboxes, click the first one accordingly to what you want.
- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

Mr_Threepwood

I searched around this site and did a glance over on general ags fan sites, trying to find a template for a lucasarts gui, since the coding looks too advanced for me to figure out at the moment.  Unfourtunitly all the links are dead so i cant find a template, does anyone know of a working link where i can get a working lucasarts template?
I am a mighty pirate

SMF spam blocked by CleanTalk