New ChoiceScript: *create has changed, mygame.js is optional

In the latest version of ChoiceScript, available on Github, the *create command has changed; this could break your existing game.

IF YOU HAVE A WORKING MYGAME.JS FILE: You should be able to just delete all of your *create lines (they’re redundant with mygame.js) and be fully compatible with the latest version of ChoiceScript.

OTHERWISE: You’ll need to make sure your first scene file is called “startup.txt” and that all of your *create commands appear at the very beginning of that file.

Furthermore, whereas before you’d just use the command “*create leadership” to define a leadership variable, now *create requires you to specify a starting value for each variable you create, e.g. “*create leadership 50”.

In addition to changing *create, the new version of ChoiceScript introduces two new commands: *title and *scene_list. The *title command changes the on-screen title of the game, like this:

*title Choice of the Dragon

The *scene_list command allows you to declare the list of scenes in order, which you used to have to change in mygame.js

*scene_list
startup
animal
variables
gosub
ending

The *title, *scene_list, and *create commands may only be used at the very beginning of startup.txt. Here’s the example we provide with ChoiceScript: https://github.com/dfabulich/choicescript/blob/master/web/mygame/scenes/startup.txt

Please feel free to post to the ChoiceScript help forum if you have questions about these changes.

That certainly makes things more non-coder friendly. I imagine the idea is that people shouldn’t have to edit anything (index.html, mygame.js etc) but the text/choicescript files?

One suggestion I’d make in regards to that is a command to change the the text on the stats button, just the front side - so people can write “Stats” or “Inventory” or “Quest Log” or whatever suits their fancy (“Return to Game” can stay the same).
I’d also enquire as to whether it’s worth *temp requiring (or at least allowing) an initial value setting.

Other than that, good job - I think these will be very beneficial changes, and I look forward to more in the future (*goto_sceneref – pretty please?!).

EDIT: Thanks for the IE *input_number fix! Whenever that was done :slight_smile:

Will you change *temp as well?

EDIT.
Ninja’d, but whatever. Consider this a “is interested as well” to CJW’s comment.

I tried extracting the jzip, but was unable to. Kept getting an error message. :frowning: My download went OK though.

Ugh, disregard previous post. Not sure why I got the error message, but tried extracting it to my desktop this time and it worked OK.

Yes, *temp has also been updated to allow (but not require) a value. You don’t have to change anything, but if you’d like, you can now write “*temp winner true”.

Changing the stat button name is on my list; it’s a little tricky to integrate with our other platforms.

I have a plan for the “ref” commands: instead of having separate ref commands, you’d use quoted strings.

*goto “${friend}”
*goto_scene “${previous}”
*gosub “${weapon}”
*set “${weapon}_ammo” +5

One major gotcha with using references like this is that quicktest can’t guarantee the correctness of your code, but perhaps that’s worth it. A related idea is to be able to hint to quicktest that a variable can only take certain enumerated values (“alice” “bob” “carol”), and that a percentile stat must be numeric.

Well, back to work. :slight_smile:

^That would be marvellous! :smiley:
And thanks for the clarification about *temp.

I really like the update to the temp thanks it will make coding even simpler in this regard for me.

@lordirishdas it definitely does XD

@StanTheMan If you plan to Publish your game through CoG, you should always keep your game up to date.

Quick question - if we have a working mygame.js and no *create commands do we NEED to update…I imagine the answer is yes, it’s just, I’ve come so far…

Righto!

With the new revised *create command how do you do booleans?

I’ve tried

*create var false

but I get an error about there not being a var variable?

@Nocturnal_Stillness I updated the testers with the new version and they’re working fine with *create var false and *create var true:
https://dl.dropboxusercontent.com/u/7840892/CJW/choicescript/tools/online-cs-tester/mygame/input.html

@CJW

strange because I was getting a variable error. I’ll check it again

edit: no still getting errors, now saying scene_list is not a valid command. Getting a bit late now. So I’ll try again tomorrow.

Is there a way to still have a descriptive line below the name of the variable for a percentage stat?

Is *title supposed to change the title of the game on the starting screen? Because it changes it on the browser border but the starting screen is still My First ChoiceScript Game.

@Chrysoula - It should change both, you can see that with that link in my last post.

Hm, I wonder why it didn’t work for me. Will test further, assume it’s something in how I upgraded.