List of all stories by word length

*gosub_scene scene_name label_name

1 Like

@Jacic Right, like @Nocturnal_Stillness says, *gosub is useful whenever you have repeated text in multiple places, but then the continuation of the sequences are quite different. The repeated text could be in the same scene, or a difference scene…Like so, in the same scene, to use a short example:


Finding yourself once again in a daisy garden, you feel a distinct clench of hesitation.
*choice
  #Carry on boldly ahead to the rose garden.
    *gosub daisy_descrip
    whistling a jaunty tune. Eventually, you find yourself amongst the blood-red roses.
    *finish    
  #Head through the daisies, but go directly to the garden shed where we keep the weed killer.
    *gosub daisy_descrip
    hands and arms well close to your sides and scarf carefully tucked beneath your jacket. They'll not get you this time, not before you get to that weed killer.
    *finish
  #Go hide under the bed.
    It's a quick walk back up the gravel drive to your cottage. You proceed to the bed immediately, crawling beneath it.

    There's a spider under here. You name it Harry.
    *finish
*label daisy_descrip
The daisies are much like you remember them: white, lacy, and full of teeth. You keep to the path, 
*return

I find I use it a lot for descriptions that can appear in more than once place, or in short sequences that you can access from different paths (like NPC conversations).

To grab text from a difference scene, instead of from within the same scene, you’d want to code it like @RETowers has (plus a *return after the section in question).

Using *gosub is also nice when editing because then you’re only checking the same passage once, and only changing the same passage once, which is much quicker and also gives less room for errors. Trying to make consistent edits in 10 copy-pasted sections of code is more difficult (or I’ve found it so, anyway).

6 Likes

Ah now I get it, thanks everyone! I couldn’t for the life of me work out why gosubs were better for some things instead of goto’s. Probably because it’s rare I’ll have the same section available in multiple sections as just a snippit to then return I’ve never seen the need for it. But maybe I’ll try it out now that I get it :slight_smile:

1 Like

Hi, one question, is the *return ignored if I use a *goto to go to this label instead of a *gosub?

1 Like

@GoldenSilver No, you’ll get a bug: ā€˜we’ve already returned from the last gosub’

I’ve accidentally used goto instead of gosub before, and it took me a while to figure out what was causing the bug…

3 Likes

Hi. Ah I see, I haven’t tried using the *gosub yet, maybe I should have lol. I got like this big section of code for preset names that maybe could have used such a thing.

1 Like

I’ve not been religious about it, though XoR 2 will have less of it. For non-programmers like me and others we’ve heard from upthread, it takes effort and time to use functions like gosub and multireplace–both in figuring out how to use them in the first place, and then in being able to read and check the code that results. There’s a real inefficiency there for anyone who doesn’t take naturally to computer code, manifesting in games that take longer to finish.

And ChoiceScript is meant to be a language for folks like us. That was the point, right? There were already plenty of ways for people with more programming nous and experience to write IF. The new thing about CS was that anyone could use it, even if they didn’t understand a scrap of the underlying software. I’d be really wary about pushing CS authors toward using things they don’t understand, and I think an insistence on gosubs does that. You can write a great game without any of those coding efficiencies–as witness Community College Hero, or Choice of the Dragon.

I use lots of gosubs, these days, but there are still some areas where I went with a stretch of repeat text with slight variances–for those who’ve read XoR or its code, I’m thinking particularly of the introduction to the Ledge of Bees scene in Chapter Four, which then feeds into a bees gosub. The intro pops up in around five slightly different versions around the chapter, with variation in different bits of the para depending on what brings you to the ledge.

While I’m sure I could have done the job with gosubs, it would have reduced the legibility of the code to me, making it harder for me to confirm that each intro made sense in its context. So I resorted to good old cut and paste where I could read the variation in whole-paragraph form.

Rather than trying to force authors to code as efficiently as possible, I’m sympathetic with MeltingPenguins’ solution of just applying a discount rate to the published word count estimate when a game is really inefficiently coded. I’d be happy for XoR to be advertised as a smaller word count game; it would still be huge.

That way lies ā€œhow much of the word count is really code anyway?ā€ A lot more of the XoR wordcount sits in lines with an asterisk up front than in repeated words. :slight_smile:

6 Likes

I’m emphatically a non-programmer…I do really appreciate @CJW and others pushing me to be more energetic in experimenting with code, though; I personally find the *gosubs and choppy strings of *ifs much less confusing than a bunch of similar passages in multiple places, both as an editor and as a writer. I don’t copy-paste at all, because it breaks my head more than the *gosubs et al. Plus then I also don’t feel like I have a good handle on how much discrete text I have in a given scene.

I suspect in my case it’s musician brain; I’m used to D S al Coda and three staves going at once and all that. But maybe I’m not the only one? Certainly some people, as you say, do have a much easier time with repeated text, but other non-native coders might find efficient coding is actually easier on the brain (and the edits). So I’m glad we have voices for both.

6 Likes

Quick headsup from my side:
After a good night sleep (still headachy) I tried the @{(gender_child_count = ā€œpluralā€) have | has } thing and it worked.
Thank you.
(not daring to try more then three options, though)

EDIT: the command doesn’t show up correctly in firefox when playtesting. it works on safari and when you play via dashingdon, though

4 Likes

Absolutely, and sorry if I sounded like I was trying to speak for all non-native coders above… please read ā€œnon-programmers like meā€ as a subset of all non-programmers, not an assertion that all of them are like me. :slight_smile:

5 Likes

I agree, gosub may not be for everyone all the time. The two main uses being reduced bugs and increased readability, I could see someone unsure of the how or why – or someone just overzealous about it – ending up increasing bugs and reducing readability.

And trying to get an ā€œaccurateā€ word count seems like it should be the least of anybody’s concerns. I leave full pages of *comments in the code at the beginning of really snarly chapters. Not doing that just to be more accurate in the word count would be kind of crazy.

And, good point about code being a real source of inflation relative to what a reader expects to be called words. Apparently 22,000 of my words are in gosub lines, for example (using the grep and wc utilities to count). And a whopping 62,000 are in *if or *else lines.

5 Likes

Haa… glad you finally sorted it out.


Oh.

Maybe you’re using an outdated firefox? IDK whether this is the case, tho.

I love that your example scenes vary, but seem to always involve the killer flowers in some capacity.

4 Likes

I use safari. But a friend has the problem :confused:

Do you send a compiled .html file for your friend to run directly in their Firefox installation, or do you send the raw .txt files for your friend to render through their own ChoiceScript installation, or do they test your work through Dashingdon?

I ask because multireplace is a fairly new feature! It was added in May of this year. That’s 2017 if anyone in the distant future is returning to this topic.

If your friend is using an earlier ChoiceScript installation to render your .txt files, the multireplace option will never work for them. As a dedicated Firefox user myself, I’ve never experienced any trouble with multireplace that wasn’t entirely due to my own typos and errors.

However, if they’re testing your work through Dashingdon (or you’ve sent them a compiled .html file that functioned correctly on your own computer) the age of their ChoiceScript installation shouldn’t be a concern.

Now, it’s possible I’ve misunderstood the situation, and your friend is testing their own work rather than testing yours. In that case, Dashingdon should still render multireplace in their .txt files correctly. However, both compiling their own .html file and running the .txt files raw will produce the same result, which will depend on the age of their ChoiceScript installation. As I understand it, Dashingdon allows authors to upload either .txt files or .html files. It then renders .txt files with an up-to-date ChoiceScript installation, but does not update compiled .html files.

1 Like

They test with the txt file. I’ll have them know. Thanks :slight_smile:

2 Likes

O, @Minnow the great one :pray:t4:
May this humble peasant summarize your wisdom into a single sentence? :ear_of_rice:

ā€œYour friend’s ChoiceScript is probably outdated.ā€

:running_man:t4: :dash:

2 Likes

That’s certainly true for me, and leads to a lot less ā€œedit this mistake here, here, here, here, and here, [because you’ve now carried it over to five places because you don’t use *gosub.]ā€

5 Likes

I really do appreciate the cost of that, and the general benefits of gosubs–however long it took me to figure them out when they were first added to ChoiceScript. I get that every new code feature is there because it allows more efficiency in one way or another, even if I haven’t yet wrapped my brain around how some of them work. And as long as they’re not mandatory, I think they’re entirely positive; those who grasp them can use them.

The CoG contest (if I’m reading the rules rightly) has the right idea in treating efficiency as a qualifier on the length score, rather than scoring efficiency for its own sake. Absolutely, a really inefficient 125,000 word game should be scored as a 100,000 word game.

But if efficiency had its own dedicated 5% score, and a 300,000 word game that CoG might otherwise have published lost out because of the author’s penchant for cut-and-pastes, I would question whether the company had lost sight of a distinctive strength. Plenty of good authors are bad coders. ChoiceScript allows them to write a game, and CoG has prospered from selling them.

6 Likes

But if they removed that won’t it would be unfair to those who knows how to code and it only have a 5% score so the other person is a good writer as well and the whole reason of hosting any contest is to find someone who is best at everything related to the contest and I think handing choice script is something that a CoG author should know.

( Sorry if sounds like rambling. )