Can I include PHP or JavaScript?


I am new to cog but have a great game idea that I am organizing. I wanted to know if it’s possible to include some php or JS code in these scene txt files. Typically a PHP file needs to be named .php and although their are some work arounds I wanted to see if it’ll break anything? Or perhaps JavaScript/Jquery? I want to add some database entries to store game data, perhaps a leaderboard.


Okay, first, to clarify, as the question is not quite clear, so I think a lot of people are going to go back and forth on semantics, I’m gonna just answer the two obvious readings of the question. Second, Caveat: I’m not a lawyer, and don’t work for CoG, or any other company I mention, so any of this information may be wrong. (Always double check your info.)

Now, if you’re asking about is it possible: The answer is simply up to your own capabilities. As it stands, ChoiceScript has the *script command, that lets you run javascript, (I think) but beyond that it doesn’t handle anything else ‘out of the box’. However ChoiceScript’s code is extremely easy to view, and you can pull it apart and look at it any time, so if you are capable of pulling it off, then you can do it. It’s just that easy (with the exact level of ‘easy’ being defined by your own skill of course).

As for the other way to take the question, the ‘what about if/when I want to distribute it through Choice of Games?’, that’s, as Hikaru said, generally just going to be a flat no. To my knowledge this is because it takes a good bit more coding to get a game up onto Apple/Android/ect, and extra features, particularly those that Dan aren’t already aware of and made himself, increase that time well outside of ‘cost effective’ range. And to get the obvious question of ‘can’t I do it myself?’ out of the away ahead of time, the answer is technically yes, but you’ll need a license from, first, Choice of Games, and second, any platform you intend to distribute on, plus the skills to do that yourself.


This is probably going to sound really harsh, but if you knew enough PHP/Javascript to make those things I think you’d be able to look at the CS files and decide whether or not it would be possible to implement them yourself.

Long story short, yes - it is possible, but advisable? Maybe, maybe not.


@Weztcoazt If you mean, “Would Choice of Games still accept my story with modifications?”, the answer would most likely be no.

Since works with additional stat buttons were declined, and additional stat buttons being a modification to the HTML and JavaScript language, one would have to assume that it would not be accepted. As far as I’m aware, with all the new features added to ChoiceScript, you are only expected to change the text files provided.


My question was technical. As in, is there a way to insert code. I found some info on *script so that will help me get started. I’ll be hosting my own game so I am not worried about whether they will accept it or not. Thanks for your help.