which is the number of items in the inventory

  • #1, by andrea_visTuesday, 08. November 2022, 12:26 A year ago
    How to display the number of items that are in the inventory of a character?

    Specifically, some investigation games (e.g., the Case of the Golden Idol) display how many clues you collected. This helps to give a sense of progress, especially if this value is shown as a fraction of the total number of clues that can be collected. In other words, I am looking for the value of nRecordedClues in "v=nRecordedClues>/20" (where 20 is the total number of clues).

    Newbie

    11 Posts


  • #2, by afrlmeTuesday, 08. November 2022, 13:23 A year ago
    A'llo, you would need to use code to amount of items currently held in the active characters inventory.

    Values["nRecordedClues"].Int = #game.CurrentCharacter.Items

    I'm assuming you already know how to display the value in a display text/object text, etc? If not inside of the text you would write: <v=nRecordedClues>/20

    Imperator

    7278 Posts

  • #3, by andrea_visTuesday, 08. November 2022, 17:50 A year ago
    Many thanks for your prompt answer.
    You correctly assume that... I'm a newbie so I am stuck despite your answer smile

    This is what I did but it doesn't work (i.e., the text shows '?'). In the inventory of the character 1 I created a 'called by other action' action:
    1) the action first executes the script (Execute script 'Values["nRecordedClues"].Int = #game.CurrentCharacter.Items') 
    2) the second line of the action is a Display text where the text is <v=nRecordedClues>

    I am sure that I am doing something very silly (i.e., some errors in the syntax), but I can't find it...

    Newbie

    11 Posts

  • #4, by afrlmeTuesday, 08. November 2022, 21:14 A year ago
    Are you including those apostrophes in your script, or are you just demonstrating that you used what's in between them?

    Anyway, I really would recommend joining our Discord server if you aren't already on it. It's much easier & faster for getting & providing help than on here.

    Imperator

    7278 Posts