Choice Scripting and Clean Coding


#21

@FairyGodfeather - I do and oh my god this is going to make my life so much simpler and personalisation so much easier. I am literally sitting here cackling out loud because I can have the ridiculous things I want with no effort.

Mustache variable here I come…


#22

Wow, that’s fascinating :astonished: and not at all something I realized was possible. What’s it end up looking like when playing?

Oh, sorry, but really what I was asking was the other way around; when is there an advantage to using *choice rather than *fake_choice? What does *choice offer that *fake_choice doesn’t?

Anyway, it looks like the subsequent discussion with @Shawn_Patrick_Reed and @FairyGodfeather largely covers this topic, though I still feel somewhat lost as to what purpose *choice has as a separate tool :confused:


#23

*choice protects you from making errors that *fake_choice won’t, (and when they are used for their intended purposes, that makes code easier to read). It’s sorta like asking what use is a normal hammer when you have a sledgehammer. Sure you can nail something in with a sledgehammer, but it’s still the wrong tool.


#24

Unless this has changed since (and I’m not usually up with Choicescript changelogs), a *fake_choice won’t allow you to have *if or *else scripts underneath, so if you need to test a stat, *choice is the way to go. *Choice also allows *gosub which I don’t think *fake_choice does.*Choice also allows you to have conversations that don’t merge back in the end (which can be hard to do).

That being said, I very fondly remember the update which allowed *fake_choice to set changes to variables dreamy sigh. Most of my game conversations use *fake_choice


#25

So if I have a choice where all options except one lead to the same text, but that one option goes elsewhere, is it good style to use fake_choice with a single goto, or is it preferable to use choice with a bunch of gotos? Or is that where it’s fuzzy enough to be a matter of individual discretion?


#26

@P_Chikiamco *fake_choice allows *if scripts underneath. *fake_choice allows *gosub (or at least *gosub_scene which I use). *fake_choice can allow conversations that don’t merge back in the end (just use *goto).


#27

Huh, do they now? The times they are a-changing. Thanks for the info :slight_smile:


#28

XD You have learned my secrets! I no longer have a monopoly on these awesome techniques! XD

Seriously, though, *if being escapable is sooooo nice. Same with *fake_choice.


#29

Seriously, it’s halving my writing time, with much more customization options when it comes to building dialog. It is a revelation.


#30

It’s enough to make you wonder why they didn’t just remove the *goto requirement for *choices and spare us the trouble of typing “fake_” all the time for what is no longer in any way a fake choice.

As someone who began coding when fake_choice lacked most of the functionality it has now, I still reserve fake_choices for the genuinely fake ones. Apologies in advance to my editor. :slight_smile:


#31

Nominally that’s fuzzy, but it’s also worth thinking about people looking at your code (if you want that kind of help). Is it going to look intentional, or is it going to look like a mistake?


#32

How does the indentation on fake choice work (it all looks like one line on the wiki page in mobile)?

Is the text on the same line as the *choice part? Will it matter if I have a six or so layered nesteled choice?


#33

The indentation works the same, except you’re allowed to fall out of a *fake_choice in the same way you can fall out of an *if so long as there’s no *else. If you nest *fake_choices, you’ve pretty much lost the point the it because you can’t fall out of multiple *fake_choices.