Using *temp to create usable items like “sword”

Hi,

I feel like an idiot for asking this question but I just can’t figure out how to use temp properly. The writing for me is easy but I’m technically challenged and loosing my mind. Have mercy.

I just want my character to acquire items and have those items reflect in the stat chart and be usable in the game if needed. I’m sure the answer is in the help sections somewhere and I just don’t understand it. I’m thinking *temp is involved here.
Thanks,
DrewWolf

2 Likes

If they’re going to persist between scenes, you wouldn’t use temp since that’s cleared from memory when CS switches scenes. What you’d want to do is have a variable called like, “weapon” (declared in startup.txt) and then set weapon to “ironsword” or “steelsword” or whatever.

3 Likes

Oooooooo. Gosh thank you much.what a quick response! And sorry for signing my name earlier. I just read the rules; I don’t want to be a pain. I just discovered choice games two weeks ago. Finally got the courage to give it a go. So many talented writers here its very intimidating.

4 Likes

Hi, and welcome! You may already know about it, but the wiki is a huge help. Also, if you ever want to peek at how other authors have coded their games for an example, there’s a guide here.

welcome aboard! Yeah, almost everything you’ll need is in the wiki but if you’ve got any questions that you can’t find answers to there, feel free to search the forums and then make a post if you need to. Really cool that you’re jumping in after just a couple weeks, best of luck!

2 Likes

Thank you soo much. I am lugging my way through the help sections now. Fingers crossed I can figure it out :joy:

1 Like

Thank you. To be honest I wasn’t sure people thought these kinds of games were cool. I used to read the Choose Your Own Adventure books when I was a boy. I had no idea there are books with stats online. Kinda blew my mind. I also think the inclusiveness priority is very cool. Actually has caused me to consider my own story and how I can make it more inclusive. So thanks for that Choice of Games and well done! Now back to grinding out this technical script stuff :weary:.

3 Likes

Sponge Bob… “ 3 hours later….”

I ended up using Boolean from a help page to create a flexible inventory. The more I see how these things are done the more I understand the underlying principles. Thank you all!

3 Likes

Booleans are a good idea so you can use the “selectable if” code for choices which only Work with the item

1 Like

Google the choicescript interactive tutorial. I found it the most helpful when I started out.

5 Likes

Oh beautiful thanks for that info. So much to learn! :exploding_head:

1 Like

So I had trouble with a straight Boolean true/false style inventory. The order of acquisition of item effected readout on the stats page. I read earlier that using 0 and 1 may work better. I also took Will’s advice and googled Inventory info which sent me backto a prior forum discussion! I used Samuel Youngs style of inventory which i think is used a game i have. Actually made me see that I could have 1,2,3 swords or herbs or widgets . Not sure I will need three widgets but why not leave that option open. :joy:

Thanks team

2 Likes

I don’t know your current progress so far, but I’d like to give my experience here if that’s okay.

To be frank, I’m not a programmer myself, so I don’t really know the words “Boolean”, “String”, etc. (at least I know what a “Variable” is).

For an item, let’s say it’s a sword, and there are 3 types of them: short sword, long sword, and claymore.

I differ them to one type a sword, and differ it to three. Then I use true and false and a string to give them a name. Well too long of an explanation is no good, here’s how I’d write it down.

Code
*create weapon_name ""
*create sword false
*create short_sword false
*create long_sword false
*create claymore false

Please choose your reward.
*choice
	#Short Sword
		*set sword true
		*set shor_sword true
		*set weapon_name "Short Sword"
		*goto acquire
	#Longsword
		*set sword true
		*set long_sword true
		*set weapon_name "Longsword"
		*goto acquire
	#Claymore
		*set sword true
		*set claymore true
		*set weapon_name "Claymore"
		*goto acquire

*label acquire
You've acquired the weapon ${sword_name}.

choicescript_stats
Weapon
*stat_chart
	text weapon_name

I think that’s simple and easy to call if you want to use a specific weapon. You can use *selectable_if or even *if on the *choice command.

1 Like

What? No, google “interactive choicescript tutorial”. Talking about this: ChoiceScript Guide

It sounds like you’re still unclear about many of the fundamentals of the markup language. This will run you through everything you need to know.

That made me laugh :joy:

1 Like

You’re absolutely right. I think my initial stat page item list had an indentation issue making each item conditional to the next. I think though whether you use True/False (Boolean) or (0 and 1) selectable_if should work and I will definitely need it. I also just downloaded notepad ++ to help me count lines when there is a problem. I think I’ve spent days on just the stats page :weary:. But I feel it’s important. I mean I constantly check stats when playing and like it when the author writes in the stat that was effected and the check quantity if i failed so i know what i needed to pass the stat check.

Right, I forgot to input the code for the stat page.
You can write it just like how you code a stat page normally.

Item
*stat_chart
    text weapon_name Weapon

I’ve been using Boolean since I found out about them, before I just write

*choice
    *selectable_if (sword_name = "Short Sword") #Quick draw.

Yeah, it’s too long and annoying.

Also, I recommend using either CSIDE or Sublime Text, as it’s easier to write using them.

2 Likes