So now I’m at a point where the reader will have used a smoke grenade previously, but as long as he has at least one left, he should be able to choose the option
#Cast a smoke grenade at the assassin
But since I’m using booleans, I tried to use the code
*selectable_if (Smoke_grenades_4) or (Smoke_grenades_3) #Cast a smoke grenade at the assassin
but it came up with the error
line 102: Invalid expression at char 17 expected OPERATOR , was CLOSE_PARENTHESIS [)]
@Caddmuss
Because I’m setting it into an inventory, instead of tracking it by itself like a health stat or something. If there’s a way to set it as a numeric value while simultaneously putting it into an inventory, I’d love to hear it. Plus, half of the stuff you can have in your inventory, you don’t have initially.
I think most variables that are inventory-related deserve to be declared as global since you’re looking to use them repeatedly, either use *create or dump them into mygame.js which is a convenience of its own.
edit
Try setting a numeric variable and put something like this without *stat_chart in the stat txt file.
[b]Inventory[/b]
Grenades remaining: ${grenade} units
Maybe instead of booleans you can use *ifs. Because you now are declaring 6 different temp variables, and need to update them everytime you make a change. Instead, you could have a variable “smoke_grenades” with the number of grenades you own, and *if (smoke_grenades=5) “you have 5 smoke grenades” etc. To me it’s easier to understand it like this.
Edit: You can then write *selectable_if (smoke_grenades>0). If you have one or more, you can use it. If you don’t have any, you can’t.
@Samuel_H_Young Right. I think it then calls for two variables, one for the item count and the other for whether it’s in there or not… unless someone else has a more efficient workaround to that.
edit (again, lol)
[b]Inventory[/b]
*if (grenade>0)
Grenade remaining: ${grenade} units
which wouldn’t display if the player doesn’t have any? And it gets rid of an extra boolean
@Caddmuss
This does seem like a better system, but I’ve already coded a significant portion of my book, with the booleans already used in numerous places. I’ll definitely keep this in mind for the future, though.
[b]Inventory[/b]
*if (grenade !=1)
You have ${grenade} grenades left
*if (grenade =1)
You have ${grenade} grenade left
Just to make the syntax correct! (you can also tweak the numbers and include (grenade = 0) then have no text if you want to “hide” that there are any grenades in your game)