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: Code for free position inventory  (Read 5169 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
Code for free position inventory
« on: October 21, 2003, 08:08:34 PM »

Yo!
   Okay, I'm an artist, not a coder, so I was wondering if anybody found or created a code to make that "free position inventory" that was discussed earlier?  Actually, I'm keeping with "item-in-the-cell" technique, in fact I'm working on 4 rows of 4 cells (16 items shown at a time) in an inventory background image that looks like an open backpack and need help!  Is there a way to display a screen centered inventory window without an "If" and "else" statement in code?   I've managed to rig the interface/menu/menu.script to have a button in the menu bar (ie, take, look at, talk...) to open the inventory window with an "If (menuObject = null..blah blah,...) Game.InventoryVisible = true" statement but cannot seem to close it.  I was hoping somebody could tell me the right code to tell the game to open the inventory window (even with using the "tab" button) and then close the window on right-click or anywhere clicked outside of the inventory window.    I've been trying to implement the "game.getinventorywindow" command but it doesn't seem to work.  Is there something that I'm missing?  Let me know--Thanks!  
: 70
-W
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re:Code for free position inventory
« Reply #1 on: October 22, 2003, 08:44:37 PM »

Yo!

Hiya! Sorry I didn't reply earlier, but I'm mostly offline this week.


  Okay, I'm an artist, not a coder, so I was wondering if anybody found or created a code to make that "free position inventory" that was discussed earlier?

Well, I don't know, I've heard McCoy was experimenting with the inventory. McCoy? Are you reading this? ;)
Maybe I'll try to implement the "free pos inv" when I have some time. But I suppose it will require a LOT of scripting.

Is there a way to display a screen centered inventory window without an "If" and "else" statement in code?

The position of the inventory is given by the "inventory box" definition file, which you've probably modified to add the backpack picture.
The definition file should contain comething like this:

Code: [Select]
WINDOW
{
  X = 240
  Y = 105
  WIDTH = 555
  HEIGHT = 532
  IMAGE = "inv_back.bmp"
}

So simply by changing the X, Y, WIDTH and HEIGHT you can define the exact position of the inventory. Or am I missing something here?

I've managed to rig the interface/menu/menu.script to have a button in the menu bar (ie, take, look at, talk...) to open the inventory window with an "If (menuObject = null..blah blah,...) Game.InventoryVisible = true" statement but cannot seem to close it.  I was hoping somebody could tell me the right code to tell the game to open the inventory window (even with using the "tab" button) and then close the window on right-click or anywhere clicked outside of the inventory window.

Ok, to close the inventory by clicking outside of it, just add EXCLUSIVE = TRUE somewhere to the inventory definition file. And to add a close button, you'll have to insert a button definition inside the code above. Something like this:

Code: [Select]
WINDOW
{
  X = 240
  Y = 105
  WIDTH = 555
  HEIGHT = 532
  IMAGE = "inv_back.bmp"
 
  ; close button
  BUTTON
  {
    NAME = "close"
    X = 0
    Y = 0
    IMAGE = "someimage.bmp"
  }
}

Of course, you'll have to change the position accordingly. All the window/button definition elements are described in the WME documentation.

To open/close inventory using a TAB key, you'll have to modify the game.script, namely the on "Keypress" part.

Add the following line to the "Keypress" handler:
Code: [Select]
if(Keyboard.KeyCode==VK_TAB) Game.InventoryVisible = !Game.InventoryVisible;


I know it may seem messy to you as a non-programmer, but fortunately these interface-related tasks are only done once :)
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:Code for free position inventory
« Reply #2 on: October 22, 2003, 09:02:58 PM »

 :D
Hey!  Wow!!  Thank you!!  I'm going to implement your advice and code samples ASAP! It's fun building a game when one is not confused!  Thanks again.

-Mr. Code-Illiterate
Logged

McCoy

  • The cocido eater
  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 365
  • Spurrrrrrring
    • View Profile
    • Spur Games
Re:Code for free position inventory
« Reply #3 on: October 25, 2003, 08:34:18 AM »


Well, I don't know, I've heard McCoy was experimenting with the inventory. McCoy? Are you reading this? ;)

Yeah, yeah I'm reading :P . But I finally gave up with the free pos inventory... There are more important things to do in Fred than that! Maybe when more basic things are done, I'll think about triying to do one... Dunno. Meanwhile... Lot of work to do!   :-\
Logged

Click here to sign my sig!
 

Page created in 0.043 seconds with 20 queries.