which is the number of items in the inventory

  • #1, by andrea_visTuesday, 08. November, 12:26 3 weeks 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

    8 Posts


  • #2, by afrlmeTuesday, 08. November, 13:23 3 weeks 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

    7211 Posts

  • #3, by andrea_visTuesday, 08. November, 17:50 3 weeks 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

    8 Posts

  • #4, by afrlmeTuesday, 08. November, 21:14 3 weeks 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

    7211 Posts

Write post