Creating a Show/Hide Element


#1

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


#2

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#


#3

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.


#4

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]

My apologies.


#5

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


#6

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


#7

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.


#8

@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!


#9

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) To be able to read the scripting, How To See Other Games’ Code 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.


#10

@Shawn_Patrick_Reed

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