Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest WME version: WME 1.9.1 (January 1st, 2010) - download

Author Topic: Item highlight image in Inventory  (Read 1583 times)

0 Members and 1 Guest are viewing this topic.

Dan Peach

  • Regular poster
  • ***
  • Karma: 4
  • Offline Offline
  • Posts: 100
    • View Profile
    • Viperante - Game Development
Item highlight image in Inventory
« on: October 26, 2012, 05:11:15 PM »

Hi,

I'm trying to change the image of inventory items so that when the items are clicked, the image changes to a highlight image.

This is the code I'm trying to use, which I think should work, but just returns an "invalid image" placeholder thing.

Code: WME Script
  1. item.SetSprite("items\" + item + "\" + item + "_inv_highlight.sprite");

Any reason that shouldn't work?

Thanks.  :)

lof

  • Lurker
  • *
  • Karma: 4
  • Offline Offline
  • Posts: 19
  • A Leap Of Fate
    • View Profile
Re: Item highlight image in Inventory
« Reply #1 on: October 26, 2012, 05:57:11 PM »

i need to see the whole code, how do you define "item"?
try Game.Log debugging to see what "item" returns.
if its an entity you might want to try item.Name.
Logged

Dan Peach

  • Regular poster
  • ***
  • Karma: 4
  • Offline Offline
  • Posts: 100
    • View Profile
    • Viperante - Game Development
Re: Item highlight image in Inventory
« Reply #2 on: October 26, 2012, 06:46:18 PM »

Sorry, I should have said, "item" just holds the name of the selected inventory item. Everything else works fine with the selected item, so I don't think that's the problem. The problem just seems to be in the code I've quoted.  :)

Dan Peach

  • Regular poster
  • ***
  • Karma: 4
  • Offline Offline
  • Posts: 100
    • View Profile
    • Viperante - Game Development
Re: Item highlight image in Inventory
« Reply #3 on: October 26, 2012, 07:15:06 PM »

Ahhhhh, you were right. I just needed to use "item.Name" instead of just "item". All works now. Thanks. :)

lof

  • Lurker
  • *
  • Karma: 4
  • Offline Offline
  • Posts: 19
  • A Leap Of Fate
    • View Profile
Re: Item highlight image in Inventory
« Reply #4 on: October 26, 2012, 08:23:08 PM »

You're welcome :)
Logged
 

Page created in 0.179 seconds with 24 queries.