# Creating a Show/Hide Element

**URL:** <https://forum.choiceofgames.com/t/creating-a-show-hide-element/15135>\
**Category:** Game Development\
**Created:** [February 17, 2016, 1:31pm UTC](https://forum.choiceofgames.com/t/creating-a-show-hide-element/15135 "2016-02-17T13:31:27Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joseph\_R\_Pearson](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@Joseph\_R\_Pearson](https://forum.choiceofgames.com/u/Joseph_R_Pearson)\
**Post date:** [February 17, 2016, 1:31pm UTC](https://forum.choiceofgames.com/t/creating-a-show-hide-element/15135/1 "2016-02-17T13:31:27Z")

</div>

Hi there.

I’m trying to get a show/hide button to work in ChoiceScript so that I can minimise the amount of mandatory information on the page, whilst still giving the gamer the option to read more.

Unfortunately I can’t figure out how to get it to work. Any help would be appreciated.

Kindly,

Jo

---

<div class="post-metadata">

**Author:** ![dreamdragonhatchling](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/dreamdragonhatchling/32/3473_2.png) [@dreamdragonhatchling](https://forum.choiceofgames.com/u/dreamdragonhatchling)\
**Post date:** [February 17, 2016, 8:39pm UTC](https://forum.choiceofgames.com/t/creating-a-show-hide-element/15135/2 "2016-02-17T20:39:00Z")

</div>

You mean using  
\*if (true) #Option A  
\*selectable\_if (true) #Option B  
?  
Show your code, otherwise, no one will know what to deal with and try experimenting here: [https://dl.dropboxusercontent.com/u/7840892/CJW/choicescript/tools/IDE/main.html#](https://dl.dropboxusercontent.com/u/7840892/CJW/choicescript/tools/IDE/main.html#)

---

<div class="post-metadata">

**Author:** ![Just\_Because](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/just_because/32/8462_2.png) [@Just\_Because](https://forum.choiceofgames.com/u/Just_Because)\
**Post date:** [February 17, 2016, 8:56pm UTC](https://forum.choiceofgames.com/t/creating-a-show-hide-element/15135/3 "2016-02-17T20:56:09Z")

</div>

Hey - Just a tip, don’t sign your name at the end, it’s against the forum rules.

Also as @dreamdragonhatchling said, more information is needed. If you just want something like you ask a question of another player, then another and another it would be different code than having “earned” the ability to do something earlier.

---

<div class="post-metadata">

**Author:** ![Joseph\_R\_Pearson](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@Joseph\_R\_Pearson](https://forum.choiceofgames.com/u/Joseph_R_Pearson)\
**Post date:** [February 17, 2016, 9:14pm UTC](https://forum.choiceofgames.com/t/creating-a-show-hide-element/15135/4 "2016-02-17T21:14:50Z")

</div>

What I meant is essentially spoiler tags, so I could write:

blah blah blah

[spoilers][“Read More”]blah blah blah blah blah blah, blah blah blah blah![/spoilers]

> [@Just\_Because](#):
>
> Hey - Just a tip, don’t sign your name at the end, it’s against the forum rules.

My apologies.

---

<div class="post-metadata">

**Author:** ![Shawn\_Patrick\_Reed](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/shawn_patrick_reed/32/20691_2.png) [@Shawn\_Patrick\_Reed](https://forum.choiceofgames.com/u/Shawn_Patrick_Reed)\
**Post date:** [February 17, 2016, 9:32pm UTC](https://forum.choiceofgames.com/t/creating-a-show-hide-element/15135/5 "2016-02-17T21:32:26Z")

</div>

Do exactly what you just did, except remove the s- so it’s just [spoiler] [/spoiler]

---

<div class="post-metadata">

**Author:** ![Just\_Because](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/just_because/32/8462_2.png) [@Just\_Because](https://forum.choiceofgames.com/u/Just_Because)\
**Post date:** [February 17, 2016, 11:45pm UTC](https://forum.choiceofgames.com/t/creating-a-show-hide-element/15135/6 "2016-02-17T23:45:02Z")

</div>

But is that possible in a game? Like an actual game? I don’t think that would work…

---

<div class="post-metadata">

**Author:** ![Shawn\_Patrick\_Reed](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/shawn_patrick_reed/32/20691_2.png) [@Shawn\_Patrick\_Reed](https://forum.choiceofgames.com/u/Shawn_Patrick_Reed)\
**Post date:** [February 17, 2016, 11:54pm UTC](https://forum.choiceofgames.com/t/creating-a-show-hide-element/15135/7 "2016-02-17T23:54:33Z")

</div>

Ohh. I see what you’re trying to ask.  
No, but you can hide content within an \*if statement.

```
*if clearance = 1
  *set secret 1

Okay are you ready to hear this secret?
*if secret = 1
  This is a top-secret secret. Now you know!
*if secret = 0
  Unfortunately you don't have proper clearance. Tough luck.

```

The parts under the \*if statements will only display if the variable condition(s) is/are met. You could have multiple variables required for the content to display. You could, in theory, put a whole chapter of content, choices and all, under an \*if. Anything under that \*if won’t be visible at all unless the conditions for it are met, and you can put things like \*fake\_choice, \*set, and other \*if statements under \*if statements. Just make sure to get your spacing correctly lined up.

---

<div class="post-metadata">

**Author:** ![Joseph\_R\_Pearson](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@Joseph\_R\_Pearson](https://forum.choiceofgames.com/u/Joseph_R_Pearson)\
**Post date:** [February 18, 2016, 9:43am UTC](https://forum.choiceofgames.com/t/creating-a-show-hide-element/15135/8 "2016-02-18T09:43:29Z")

</div>

@Shawn_Patrick_Reed Thanks for your assistance, but I understand all of that already.

The context is that I’m using ChoiceScript to create a random character generator for a homebrew Pen and Paper RPG set in the far future (though I will likely reuse the code for another IF project). What I’m trying to achieve is to create a ‘Additional Information’ button in place of text. That way, I could avoid overloading the user with information up front, yet make it readily available if they ever want to know more. I was also trying to keep everything on the same page and avoid having to create a #More Information choice every time.

I should clarify that I’m not expecting anyone to write it for me, as there are inevitably going to be plenty of workarounds. I was just hoping that someone might have already written something it.

So I guess I’ll go away and figure out how to use buttons in ChoiceScript. I’ll post it here if/when I figure it out.

To everyone who posted: Thanks for all your help!

---

<div class="post-metadata">

**Author:** ![Shawn\_Patrick\_Reed](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/shawn_patrick_reed/32/20691_2.png) [@Shawn\_Patrick\_Reed](https://forum.choiceofgames.com/u/Shawn_Patrick_Reed)\
**Post date:** [February 18, 2016, 10:22am UTC](https://forum.choiceofgames.com/t/creating-a-show-hide-element/15135/9 "2016-02-18T10:22:26Z")

</div>

So… basically, what you’re after, is a codex? You can write one in to the stats screen, because the stats screen is always available from any point in the game, though doing so can be a little tricky, because you can’t write it in an external scene. I wrote one for my WIP that’s on extended hiatus, [Quill & Sword (WIP) - Sneak Peek pre-alpha (updated 7/7/15)](https://forum.choiceofgames.com/t/quill-sword-wip-sneak-peek-pre-alpha-updated-7-7-15/9828) To be able to read the scripting, [How To See Other Games' Code (current info posted in OP and Post 146 on 6/18/19)](https://forum.choiceofgames.com/t/how-to-see-other-games-code/1328) This may at least give you ideas on how to achieve coding in a codex and hiding certain elements of the codex until certain variables are acquired. Please note I didn’t actually finish filling mine in, but the skeleton is there to see.

---

<div class="post-metadata">

**Author:** ![Joseph\_R\_Pearson](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@Joseph\_R\_Pearson](https://forum.choiceofgames.com/u/Joseph_R_Pearson)\
**Post date:** [February 18, 2016, 4:39pm UTC](https://forum.choiceofgames.com/t/creating-a-show-hide-element/15135/10 "2016-02-18T16:39:09Z")

</div>

@Shawn_Patrick_Reed

I’m _ **also** _ looking to make codex. So this will be very helpful. Thank you!
