Using hide_reuse and if

I’m having trouble with using the hide_reuse and the if command together.

What I want to do is make a particular option not appear if the item is in the player inventory.

i.e
*choice
#beer
a drink after a hard day’s work

	do you want to buy?
	*choice
	#Yes
		*set money - 20
	#No
		*goto_scene bar
#back outside

if the player has already taken a beer the ‘beer’ option should disappear.

1 Like
*choice
  *hide_reuse *if( beer = true )#beer
    a drink after a hard day’s work do you want to buy?
      *choice
        #Yes
          *set money - 20
        #No
          *goto_scene bar
  #back outside

This should work now.
Note: I have used spaces not tabs you may need to change that if you are using tabs.
Also you will need to add a beer variable, I recommend a temp variable.

When I’m faced with what seems like a complicated problem I tend to overthink it as you do. So what I do is go back to the basics and think of ways I can do this with simple commands.

*label 1
*choice
    #Go back.
        *ending
    *if a = false
        #Choice1.
            *ending
    *if b = false
        #Choice2.
            *ending

I hope this is what you were talking about about the choice disappearing.

Edit: Meant to reply&quote to the rinzygreye post but can’t do it anymore due to editing. The one with the picture of the example.

Now, I’m not an expert by any means, but I’d never name a variable the same as I’d use as an option, for example #ThisIsAnOption, since that creates massive confusion.

Also, I prefer to put “regular” # marked things as the first option in a *choice or *fake_choice, since for whatever reason it causes less problems.

(also, the reason why I use “= true” rather than “!= false” is because that too creates way less confusion in my opinion, since this is just a boolean rather than a string or anything like that)

Additionally, I’d put the *hide_reuse and the *if on the same row, since that seems to work better most of the time, as opposed to them being on separate rows, if it’s within a *choice, at least for me.

In any case, I may have misunderstood what you asked, but if not, I’d try this instead:

*choice
    #Go back.
        *goto_scene squadron
    *hide_reuse *if(forcelocker_mc = true) #LockpickSkillQuestion
           REST OF THE TEXT HERE FROM YOUR PICTURE EXAMPLE (although you need a *goto after the *set xp_mc-20 since you're using a "*choice")
           (also, if you want to change the variable forcelocker_mc if you buy the skill, you need to put "*set forcelocker_mc false" for it to work. Although, now that I re-read your post, the opposite logic should work. Meaning, you should use "false" in the *if here, rather than true, then set it to true here instead. Currently in your own example you're using "!= false" which means "if it's anything EXCEPT false"(in the context of a boolean variable this means "If this is true"))

If it helps, great, if not, then your problem might be more complicated.

2 Likes

Thank you this worked perfectly.

1 Like

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.