Please login or register.

Login with username, password and session length
Advanced search  

News:

This forum provides RSS feed. To query recent posts use this url. More...


Author Topic: Inventory Scrolling & Inspection  (Read 4736 times)

0 Members and 1 Guest are viewing this topic.

Wraith

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 21
  • I put the "EW" in "Newbie".
    • View Profile
    • Archetype Illustration & Design
Inventory Scrolling & Inspection
« on: March 10, 2004, 04:43:18 PM »

Ungh, another question! Okay, 2 questions.
First, I'm going back to refining my inventory menu and need to scroll up and down, and see that in the inventory definition there are two buttons already (">" & "<") but to what script are those buttons linked to? I am replacing them entirely with my own graphic buttons but cannot seem to find where the scroll code for them is located. I did notice that there are scroll buttons located in the load game window and traced their properties to the load game script. Do I need to write a script for the inventory buttons concerning the scrolling? If so, where?
Question #2: I want to be able to inspect the objects in my inventory and created a magnifying lens graphic to drag and click over the inventory items. I am going to place it's button off to the side on the inventory menu (under the scroll buttons). Where should I begin to code that? Is the magnifying lens a window (coded in the inventory definition) or an object already loaded into the inventory menu similar to the objects already there for interaction? My goal is that there will be a magnifying lens button that once it is clicked, a graphic (of the magnifying glass) will pop up above the button (OR turn into the mouse cursor itself) and thus be dragged along as the mouse moves over to an inventory object for click-interaction.
I'm really trying to work these things out and have made some really great strides, but alas, I'm only a graphic artist...sigh...
-W :-\
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re:Inventory Scrolling & Inspection
« Reply #1 on: March 10, 2004, 04:59:58 PM »

1) The inventory scrolling buttons work automatically providing their names are "prev" and "next". You don't need to script anything, just name them the right way and it should work.

2) I think the easiest way would be to create a dummy inventory item, with the magnifying glass image. If you click the button, you'll make this item selected (the mouse pointer will change) and you can click other items with it.

Something like:

Game.SelectedItem = "glass";


The bonus feature is, that the clicked objects will recieve an event with the name of your magnifying glass item so that you can easily handle it in their scripts.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Wraith

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 21
  • I put the "EW" in "Newbie".
    • View Profile
    • Archetype Illustration & Design
Re:Inventory Scrolling & Inspection
« Reply #2 on: March 10, 2004, 09:04:41 PM »

Thank you very much.  About the dummie inventory item (magnifying glass), quick question about the code:

Quote
Game.SelectedItem = "glass";

Where exactly am I putting that? Is it in the item.item file or does it need to be in a referenced "magnifyglass.script" file similar to the rest of the inventory objects?  I want to make sure that the magnifying glass does not reside inside the inventory boxes as the rest of the objects since it will originate over the Magnifying Glass Button, so in the item.item file, can I play with the x,y positions? Also, in the inventory.definition I've placed the magnifying glass button properties (x,y, image,etc.), is this correct? :D
Sorry so many questions....this a very challenging yet fun learning experience.
-W
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re:Inventory Scrolling & Inspection
« Reply #3 on: March 10, 2004, 09:38:49 PM »

Yes, you're on the right track :)

Ok, what you need to do step by step:

Add the "glass" item to the items.items file.

Code: [Select]
ITEM
{
   CURSOR_COMBINED = FALSE
   NAME = "glass"
   IMAGE = "not important"
   CURSOR = "some_image.png"
   CURSOR_HOVER = "some_other_image.png"
}

Create a button on the inventory window. If I understand it correctly, you already have it. Let's assume the button is called "glass_button". Its definition should be something like this (hidden inside the inventory definition file):

Code: [Select]
BUTTON
{
  NAME = "glass_button"
  PARENT_NOTIFY = TRUE
  IMAGE = "some_image_again.png"
  X = 100
  Y = 200
  ...
}


Now, in the script attached to the inventory window, add the following piece code:

Code: [Select]
on "glass_button"
{
  Game.SelectedItem = "glass";
}

This means, if the glass button is pressed, make our dummy item selected (the cursor changes).

And that's it! All you need to do now is to handle when the player clicks some regular inventory item with a magnifying glass selected.
In a script attached to each inventory item add the event handler:

Code: [Select]
on "glass"
{
  actor.Talk("Put an item description here.");
}
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Wraith

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 21
  • I put the "EW" in "Newbie".
    • View Profile
    • Archetype Illustration & Design
Re:Inventory Scrolling & Inspection
« Reply #4 on: March 11, 2004, 03:20:44 PM »

It all worked Beautifully! Thanks!
-W
 :D
Logged
 

Page created in 0.044 seconds with 20 queries.