Removing the underscore _ when adding objects with more than one word to the inventory?

Alright so in the process of making an inventory system Ive run into a pretty ugly show stopper.
Some of the items I want players to have access to, have more than one word in their name ex: Baseball bat, Desert Eagle, Giant’s Club

I know that for stats like Cooking Skills you can get past this easily.

In the startup.txt you would simply type

*create cooking_skills

and then override it in the stats.txt

step one:
text cooking_skills

step two: add a space following the original and simply rewrite your new skill title
text cooking_skills Cooking Skills

and your “skill” would look smooth asf
but alas I’m trying to create an >Item< that is equally smooth and non-immersion breaking :disappointed:

Any help would be greatly appreciated.

Not sure I understand, do your items have their name as string values? Like:

*create desert_eagle "Desert Eagle"
1 Like

Nope I dont believe string values can be placed into another string value “folder”

the items are mostly weapons, food, stuff like that and are all mostly booleans so that they can be used and equiped with the *if command.

Hold up ill get a snippet of the code

*create inventory ""
*create hunting_knife false

my intention is to change the way it reads ===>in game
from hunting_knife to simply hunting knife without the underscore.

When you add or remove things to your inventory you can check your boolean variable to know if it’s true or false to add that item.

*if (hunting_knife)
	*set inventory &"Hunting knife "
*if (desert_eagle)
	*set inventory &"Desert Eagle "

And so on. The & is for concatenating things onto your inventory string variable.

Since this might be something you may have to do everytime the inventory changes, you could place it on a subroutine to always make the necessary updates to your inventory.

3 Likes

Ohhh damn that might actually work just fine. I’ll try it out and let you know. Much obliged either way.

You’re an absolute genius my friend. Thank you much. Think it’s time to take a break been staring at this computer screen for hours lmao

You might run into the problem where you have to add this checking in a lot of places (everytime you update the inventory).

A way to correct this is by using a *gosub to do this check. If you want to know how you can ask me later.

There are other ways to doing inventory also, I myself have one very different from yours, but you can PM me if you have questions about the *gosub or inventory.

1 Like

Question resolved!