Please login or register.

Login with username, password and session length
Advanced search  

News:

Forum rules - please read before posting, it can save you a lot of time.

Author Topic: Objects picked up are not showing in Inventory Box.  (Read 5012 times)

0 Members and 1 Guest are viewing this topic.

Cliff White

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 4
    • View Profile
Objects picked up are not showing in Inventory Box.
« on: May 25, 2021, 07:28:17 PM »

Hey All, I'm not sure what I'm missing here. I cannot seem to get any
taken inventory item to appear in the inventory box. After several days of
trying everything I could think of, I decided to start from scratch. But
even that didn't work.

 I started a new game and used all of the default items (default background and book item).

1. I added the book entity to the default Room.scene.
2. Then created the book.script.
3. I added the TakeItem action to the book.script in scenes ....

on "Take"
{
  actor.GoToObject(this);
  actor.TakeItem("book");
}

4. I verified that the book was referenced in the default items.items file and that
    the book.script file was present in the items directory.

5. I made no changes to the inventory.def file
 
6. When I run the program, everything seems to work as it's supposed to.
     When picked up, the book disappears from the screen, but does not appear
     in the inventory window and thus becomes unusable.

7.  There is no error reported in the log file.

Obviously, I'm leaving some step out. I just don't know what that step is.
Can somebody step me through the process on how to get an object to
appear in the inventory box?

Thank you!!!
Logged

Cliff White

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 4
    • View Profile
Re: Objects picked up are not showing in Inventory Box.
« Reply #1 on: May 25, 2021, 09:47:53 PM »

As usual, as soon as I post here for assistance, I stumble upon the solution.

In the book.script in scenes.... I changed this

actor.TakeItem("book");

to this

Game.TakeItem("book");

I don't know why this worked, but it did! and now I'm returning to coding my original game.
Logged

Mot

  • Occasional poster
  • **
  • Karma: 3
  • Offline Offline
  • Posts: 54
    • View Profile
Re: Objects picked up are not showing in Inventory Box.
« Reply #2 on: May 26, 2021, 03:16:33 PM »

Hey Cliff :)

It's great you found an answer to this puzzle !!

Half way down this page, you'll find more information relevant to this situation.

Quote from: metamorphium
there are two ways, how to approach inventory – Global (one inventory for the whole game) and Actor based – each actor has their own inventory
Logged
 

Page created in 0.025 seconds with 20 queries.