Possibility of making hidden variables until they're unlocked?

Sorry to sort of spam help topics here! :frowning: Um, but I just am wondering something here! I might not do it if it’s too complicated or whatever, but I was WONDERING if, since I have a list of magic spells in my stats screen for my new magic game, I was wondering whether I could like get them to display as “???” until you find the spellbook in the game which would set it to like *set magmaflare true, which would then turn the “???” in the stats screen into “Magma Flare”?

I mean is that POSSIBLE at all to do, and if it is do you think it’d be worth trying, or should I just leave the spells revealed for the player at all times but have them be greyed out until you flip the true choice switch? And how exactly would I do THAT, too? With like an *if magmaflare false or does it do it automatically?

Crap now I’m just confusing myself more… :frowning: I guess first off I have to ask how the spells list even works? Do I list every single spell in the STARTUP and the stats files, so when I go through the game it will “give them to you”? AGGGGHHHH. BRAIN HURTING.

Magmaflare
*if magmaflare
   Throw some magma as flares
*else
   ???
1 Like

Let’s see, do you want the spell name itself to be “???,” or just the description? If just the description, @Szaal’s fix will cover it. If you want the name to be “???” too, then you’d want the *if to appear before the name.

You could just start a topic called “vessynessy20’s help thread” and have it all it one place :thinking:

That sounds right, yes.

For that matter, if you just want to type up what you’d want your screen to look like when you know some spells but don’t know others, we could probably use that as a springboard to work out what code would produce the desired effect.

3 Likes

selectable_if for greyed out choices:

*choice
	*selectable_if (magmaflare) #Throw flares.
	
		You throw magma flares at the dummy.
	
	#Use your sword.

		You charge the dummy with your blade.

Okay um, thank you! I’m still really lost on how to make this work… :frowning:

In startup.txt I put *create magmaflare
In choicescript_stats.txt I put *selectable_if (magmaflare = “true”) #magmaflare This spell is usable by you! to confirm that you’ve unlocked its use in the narrative.

In the narrative, how you unlock it, I put it in a choice as:
choice
** #Learn Magma Flare.
*
** set magmaflare true*

But it’s giving me an error on startup.txt saying that “invalid create instruction. No value specified:magmaflare” Please what did I screw up here? :frowning:

1 Like

Okay, I think the thing is, you’ll to specify *create magmaflare false, so that the variable has a value when you create it… it can’t be empty. The game needs to know that you don’t know the spell at the beginning.

(By the way, if you want to type code on the forum, you can stick ` around text to make that bit of text show up as code, or you can type [code] and [\code] around the part you want to show up as code, and that way it’ll keep the formatting.)

Also, I don’t think you should have the quotation marks around “true.” (You would want the quotation marks for a text-based variable, like the example of “proficiency,” but not for a true/false one!)

I hope this fixes it! :slight_smile:

1 Like

Oh wow! That’s a really simple thing and I’m dumb for not realizing it… :blush: That fixed it! Thanks again TSSL! :slight_smile: Of course, I guess I might’ve just assumed that leaving it blank COUNTED as it being false, but no I actually did have to specify that it was false…DERR. Wow. :slight_smile:

Thanks for the code tip! :slight_smile:

And okay, I’ll get rid of the quotes on that one and see how it works! :slight_smile:

It’s something I’ve forgotten several times myself :stuck_out_tongue:
Pretty much any variable, when you create it, you need to specify a value for it, whether true/false, a number, or a string of text (the latter of which would go in quotes… and can be blank, if you just use "").

The other thing is, for true/false variables, you can simply the check to be simply *if magmaflare or *if not(magmaflare). It’s a shortcut :grin:

1 Like

Crap. I went wrong somewhere again! It’s telling me invalid indent, expected at least one choice, on the line that has *selectable_if? But that IS a choice, and I formatted it like that on my other game it worked fine…

[code] *label spells

Here is a list of spells available to you at your present experience level.

*choice
*selectable_if (Expelliarmus = true) #Expelliarmus
This spell is usable by you!
#See stats.
*goto mainpage [\code]

Oh, right, the [code] and [\code] need to be on their own lines :sweat_smile:

Is the *selectable_if indented? If should be at the same level as #See stats. If not, that might be the problem.

1 Like
*choice
	*selectable_if (expelliarmus = true) #Expelliarmus
		This spell is usable by you!

No capital letters for vars. Plus, identation: use tab to level the code.

Okay now I added the indent it fixed THAT line’s problem, but now it’s saying the line right below it is saying “expected option starting with #”

Okay jeez. Now it’s giving me more stuff like that a line has to be “expected choice not goto?”

*choice
  *selectable_if (expelliarmus = true) #Expelliarmus
    This spell is usable by you!
    *goto mainpage
  #See stats.
  *goto mainpage

This is how it is now. YAY IT SHOWS UP HOW IT IS IN MY TEXT FILE NOW!!! :slight_smile: Now you can see EXACTLY how I got it!!!

1 Like

Is the *goto one indent further than the #See stats? If not, that should be.

You need a *goto below “This spell is usable by you!” so the code knows where to go after that.

You could also use *fake_choice instead of *choice, which does not require *goto.

Oh… you need / instead of \.

1 Like

Okay! You need another indent before the final *goto. Anything under a choice option needs one more indent than the choice itself.

1 Like

The one below #See stats?

1 Like

Yes, that one! Anything that you want to happen below a #choice option will always need one further indent than the choice option itself.

1 Like

OH MY GOSH IT’S PERFECTLY PERFECT NOW!!! :slight_smile: I LOVE YOU PLATONICALLY!!! :blush: Alsoooo I did your OTHER advice and actually changed the entire choice into that *fake_choice thing, and THAT fixed an error where it was telling me to not have a GOTO or something! :slight_smile: Now when I click the spell itself it takes me to the “This spell is usable by you” message below it, and then gives me the “see stats” option! :slight_smile: Which goes back to the top menu again! Which is really awesome. :slight_smile: It’s like a perfect loopy loop! :slight_smile:

2 Likes

Thanks so much for sticking with me and helping me iron out these dumb little issues of mine! :slight_smile: Probably most of it was due to it being 1 in the morning and I’m probably stupid tired, hence why I didn’t notice the last *goto being off…

1 Like

Something I wanna still add - use tab button for idents, it’s easier to keep track of than spaces.

*choice
	#Go to.
		*goto place

For 2nd line you press tab once, for third - twice.