Is there a command for selectable if combined with hide reuse?

What I want to do is, say the player stocks up on grenades, I want the choice option to be

*selectable_if AND hide_reuse

basically the player can select the option if he has a grenade available, but when the grenade failed to blow a hole in the reinforced wall, he will try something else with the same set of choice options, only hide the grenade option (because it was already tried)

How would I achieve this without copying and paste the entire options into a sub choice, anyone know ?

Thanks

I’d cheat and set it so the whole choice tree is hide reuse. Stealing the example from the wiki I’d do it as such.

Give me a few to fiddle with CJW’s IDE to see if there’s an alternative.

*hide_reuse
*choice
  *selectable_if (strength > 30) #Lift some weights.
    You pump iron to stay in shape.
    *finish

  *selectable_if (partner_name = "Jill") #Go jogging with Jill.
    You go jogging with Jill to stay in shape.
    *finish

  #Nuke some popcorn and watch TV.
    You do your impersonation of a Couch Potato.
    *finish

what if you only want one of the options to be hide reuse, and the other 2 to be reuse-able ? Still with all options as selectable if of course, but this is a smart way to cheat none the less.

I’ve fiddled with the IDE and I can’t make it work. A better coder than I will likely know if it’s possible. I can’t find anything on the forums or the wiki indicating one way or the other.

If those other options aren’t selectable if then you can use *allow_reuse.

You could also do it with if statements instead of selectable ifs. This does mean that the option won’t display unless you meet its conditions but it allows for a work around.

Thanks for the help @FairyGodfeather =) it’s not a big deal as I can always just copy and paste to make another sub choice in the choice, it just looks terrible but still doable, right now it’s more of a curiosity of seeing if there’s a possible way to make this work directly with 1 set of choice options.

Not sure how or if this works with *hide_reuse, but this:

*choice
  *if foo
    *selectable_if bar #Foobar
      This is foobar.

Works. (and if it doesn’t work with *hide_reuse, it can be dummied up with a *temp and *if)

Example: In Æon Sage, in the intro where you can get drunk, drunk characters have the option to do certain things that sober characters don’t. I wanted the choice to show up (to indicate that it’s an option on a second play through), so my code looks a little like this:

*label drunk_choice
*choice
  *if (drinks > 3) #You take the drink and kiss her.
    *goto wake_up_2
  *if ((drinks <= 3) and (drinks > 0))
    *selectable_if (1 = 0) #You're not drunk enough to[...]
      *comment intentionally unreachable
      *goto wake_up_1
  *if (drinks = 0)
    *selectable_if (1 = 0) #You haven't had anything to drink[...]
      *comment intentionally unreachable.
      *goto wake_up_1
  *if (drinks > 3) #You take the bottle from her and put it[...]
    *goto wake_up_1
  *if (drinks <= 3) #You take the bottle from her and put it down on the table.
    *goto wake_up_1

The second and third choice are the ones that show how to do this.

2 Likes

Thanks for the help, I get the idea but this routine isn’t looped, it’s only scanned once and it exits to wake_up_1. I’m asking for is a looped choice to “*hide_reuse” a “*selectable_if” condition. Not sure if you know what I mean.

Let me give an example:

Let’s say we have 3 choices, A, B, C

I want A and B to be reuseable with a selectable if condition and C to hide reuse with a selectable if conditon.

How about something like

*create grenades 1

*label wall
*choice
	*if grenades > 0
		*hide_reuse #Throw grenade
			The grenade bounces off the wall and fails to explode.
			*goto wall
	*hide_reuse #Use a sledgehammer
		It doesn't work
		*goto wall
	#Stare at the wall
		The wall is still there.
		*goto wall

That looks good, but I actually have 3 types of grenades lol, that’s why all of them needs a *selectable_if, I got Flash Grenade, Frag Grenade and EMP Grenade.

The selectable_if looks at the player inventory to see if they still have those type of grenades left.

So by what you’re suggesting, the option will not show up if the type of grenade reaches 0 rather than gray it out. Ya I could go that route too lol, but what if i want the option to show up as gray out ?

I’m making all types of grenade available for the player to choose because they’re allowed to use the wrong type of grenade on the enemy, for example, using a flash grenade on a robot will get the player killed.

lol sorry for making your life difficult, I’m just really curious to see if there is a way to do it.

You edited as I was typing.

I was thinking something like (With added code to decrease your grenade count when you throw them of course).

*label choices
*choice
	*selectable_if (flash>0)	#You throw a flash grenade
		Bang!
		*goto choices
	*selectable if (frag>1) #You throw a frag grenade 
		Bang!
		*goto choices
	*if (EMP>1)
		*hide_reuse	#Throw EMP Grenade
		The wall is still there.
		*goto choices

Alternatively you could do

*label choices
*choice
	*selectable_if (flash>0)	#You throw a flash grenade
		Bang!
		*goto choices
	*selectable if (frag>1) #You throw a frag grenade 
		Bang!
		*goto choices
	*hide_reuse	#Throw EMP Grenade
		*if (emp=0) 
			You have no EMP grenades to throw.
			*goto choices
		*if emp>0
			You throw the grenade and it doesn't work
			*goto choices

1 Like

But here’s what I suggest you do. Load up CJW’s IDE. https://dl.dropboxusercontent.com/u/7840892/CJW/choicescript/tools/IDE/main.html

Have a read of the choicescript files and the wiki. Have a read of the forum. Start experimenting. See if you can find a work around that works for you. If you can think of any games that do something similar to what you want go look at their code and see how they do it.

I learned choicescript through an awful lot of trial and error and a huge amount of help from CJW’s choicescript testers. While I can’t always do exactly what I want to, I can usually find a work around.

1 Like

Ok, thanks a lot @FairyGodfeather, I’ll take a look for sure!

Could you just make it two sections of code? Something along the lines of…

*label choice1
*choice
	*selectable_if (hammer) #You hit the wall with a hammer.
		The wall cracks, but doesn't fall.
		*goto choice1
	*selectable_if (strength > 20) #You punch the wall.
		Your knuckles hurt, but maybe that did a little damage.
		*goto choice1
	*selectable_if (grenades > 0) #You throw a grenade at the wall.
		It explodes, but when the dust clears, the wall remains intact.
		*label choice2
			*selectable_if (hammer) #You hit the wall with a hammer.
				The wall cracks, but doesn't fall.
				*goto choice2
			*selectable_if (strength > 20) #You punch the wall.
				Your knuckles hurt, but maybe that did a little damage.
				*goto choice2

Not the most elegant way to do it, but would that accomplish what you’re looking for? (I’m tired, so apologies if I completely missed an important point. XD)

It should work inline: Join Commands: *if and *selectable_if and *allow_reuse

1 Like

I noticed something very interesting today while testing, if you used a hide_reuse then dies and restart from the checkpoint, you can no longer highlight the option again, because it was already used last time… hmm, never thought of that, it was good to catch this. How do you fix this actually ? use a variable to reset the hide_reuse ?

As far as I know there’s no way to toggle a *hide_reuse choice back on after it’s been hit (without restarting the game from the beginning), so yea, you’d need to create a variable to show/hide it. (Unless someone can tell you if there’s something I’m overlooking.)

Wait, when I was testing my game, I found that if I used a *hide_reuse choice in a scene, went to a new scene, and then revisited that scene (my game has a non-linear setup), the option would be visible again.

Yeah the only proper implementation for clearing a hidden *hide_reuse choice is to reload the scene.

I see, no wonder this isn’t a problem for people who use a separate scene text file for checkpoint saves. I didn’t find a need to use a separate file, so I just included the save code at the bottom of startup.txt, which wouldn’t allow this hide_reuse to work the second time…

Hey if I may ask, is it possible to hide a choices until condition had been fulfill rather than have it visible when not selectable?