Help: stats screen as an inventory list

is it possible to format the stats screen into an inventory?

like i want it to say:

You’re going to have to elaborate on what you mean. Do you mean to make an inventory list, or just have the button say “Inventory” instead of “Show Stats”?

1 Like

i meant to write more but i accidentally hit send lol

i want it to say:

  • item 1
  • item 2

something like that

You could do something like

*if (item1=true)
    Item 1
*if (item2=true)
    Item 2

And so on. You’d have to create a variable for every item you need in the game, and set it to true once the player acquires the item.

An alternative if you have multiple types of things for each inventory item is to create a blank variable and set it once the player has it.

For example *create coat “”

You go shopping and buy…

#A blue jumper.
*set coat “blue jumper”

#A heavy black jacket
*set coat “black jacket”

Then put $!{coat} under your inventory list. It’ll be hidden until you set it.

As far as I’m aware you can’t have dot points unless you make them yourself with stars or inserting images.

Did you know that you can actually put the bullet character and Em Space into your text?

Yep, it’s perfectly valid to write

• ${item}

In your code.
This snippet contains one black bullet, one Em/En (don’t remember which one) dash, and the ${item} command.

Now that’s the layout, the real system can be pretty confusing if you’re new in coding.
So, I’ll just copy-paste my code here, in case you’re curious.

My startup.txt contains this snippet

*create i_count 0
*create i_num 0
*create i_list ""
*create i_own "a"

My subroutine.txt

*label invenlist
*set i_list ""
*temp num 1
*temp i_item ""
*temp i_name ""
*temp maxlength length(i_own)
*label scanloop
*set num +1
*if num > maxlength
	*goto itemkind
*if (i_own#num) != ";"
	*set i_item &(i_own#num)
	*goto scanloop
*if (i_own#num) = ";"
	*goto namefinder

*label namefinder
*if "${i_item}" = "i_matches"
	*set i_name "pack of matches"
*elseif "${i_item}" = "i_cigar"
	*set i_name "cigar@{(i_cigar = 1) |s}"
*elseif "${i_item}" = "i_hp"
	*set i_name "medkit@{(i_hp = 1) |s}"
*elseif "${i_item}" = "i_syringe"
	*set i_name "vaccine injection@{(i_syringe = 1) |s}"
*elseif "${i_item}" = "i_motivekey"
	*set i_name "Keybox"
*elseif "${i_item}" = "i_love"
	*set i_name "Supa-powah!"
*elseif "${i_item}" = "i_bottledrink"
	*set i_name "drinking bottle@{(i_bottledrink = 1) |s}"
*elseif "${i_item}" = "i_pebbles"
	*set i_name "pebble@{(i_pebbles = 1) |s}"
*goto jkl

*label jkl
*set i_list &"• ×${{i_item}} ${i_name}[n/]"
*set i_item ""
*set i_name ""
*goto scanloop

*label itemkind
*set i_num 0
*set num 1
*temp maxlength length(i_own)
*label numloop
*set num +1
*if num > maxlength
*if (i_own#num) = ";"
	*set i_num +1
*goto numloop

And here’s my choicescript_stats.txt

« [b]Items[/b] » ${i_count} / ${i_num}
*page_break Return
*goto stats

And this is my system in action.

If you have any question, feel free to ask. I’ll try to answer them as best as I can :sweat_smile:


@Szaal How do you get the items bulleted in your inventory without there being a huge space between each line? I find I either have to have everything on the same line, or else it puts a paragraph space between them looks weird. Kind of like this:


*Item 1

*Item 2

*Item 3

*line_break. Or [n/].
But still, that’s weird, though. You only get big paragraph if you intentionally space each bullets with an empty line, like pressing Enter button twice (or return if you’re mac).

Maybe you used a *stat_chart command, somehow?

Nah, I have to put an empty line, otherwise everything ends up on the same line together if I do something like this:
*item 1
*item 2

It’ll look like this in game:
*item 1 *item 2

Line break causes an even bigger space. I’ll try [n/] and see what that does. Thanks :slight_smile:

Recently i finished a Choicescript based adventure called the Well of Shadows. As a part of its stats screen I included a full inventory of everything the player character has. That inventory updates every time the player looks at the stats screen. The code to do so is as follows:

This toolkit currently includes:

*if dagger > 0
Dagger and Sheathe
*if shortsword > 0
Short Sword in Leather Scabbard
*if waterproofcloak > 0
Waterproof Cloak
*if torches > 0
Torches ({torches}) *line_break *if charges > 0 Flash Charges ({charges})
*if ropeandgrapple > 0
Rope and Grapple
*if compass > 0
Compass in Leather Case
*if entrenchingtool > 0
Entrenching Tool
*if rations > 0
Rations (${rations})
*if watercanteen > 0
Water Canteen
*if backpack > 0
*if dryclothes > 0
Set of Dry Clothes
*if gloves >0
Gloves, Thick Leather
*if flints >0
Flints in a Metal Box
*if coins >0
Coin Purse (50 silver coins)
Pencil and Notebook

With this code it will automatically adjust what items you have in your possession (and how many of them you have) and take out items that are either lost or discarded. What’s really cool is that it is available as a part of the stats screen and therefore always available to the player.

Each item has its own variable so they will have to be created for the inventory to work.

I notice that the forum here doesn’t like tab spaces. For it to work you will have to appropriately tab the code after each "if statement in the inventory list.

I hope this helps.

Wayne Densley

omg thank you guys so much!! i’m a little baby coder so this is all so helpful! thanks!!!