Help: stats screen as an inventory list


#1

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

like i want it to say:
Items:


#2

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”?


#3

i meant to write more but i accidentally hit send lol

i want it to say:
items:

  • item 1
  • item 2

something like that


#4

You could do something like

Items:
*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.


#5

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…

*fake_choice
#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.


#6

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
	*return
*if (i_own#num) = ";"
	*set i_num +1
*goto numloop

And here’s my choicescript_stats.txt

« [b]Items[/b] » ${i_count} / ${i_num}
[n/]${i_list}
*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:


#7

@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:

Inventory:

*Item 1

*Item 2

*Item 3


#8

*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?


#9

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:


#10

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:
*line_break

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

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


#11

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