Writing and Testing ChoiceScript on Android

Someone asked on the Discord whether it was possible to make a ChoiceScript work only using an Android phone. I was curious to see and I figured out how it can be done. You’ll need a bunch of apps but it’s definitely possible. Here’s a step by step guide (all from your phone or tablet):

  1. Download the ChoiceScript source by clicking the link on this page: https://www.choiceofgames.com/make-your-own-games/choicescript-intro/. This will download a .zip file.
  2. Install an app for extracting .zip files. I used one called RAR.
  3. In your unzipping app, go to your downloads folder and select the .zip you just downloaded and click the extract icon.
  4. You’ll need to install a decent text editor that can insert tabs. I used one called anWriter.
  5. You’ll need to install a web browser that can open local htmls. I used Firefox for this.
  6. Create or edit files with your text editor in the scenes folder like normal to create your game.
  7. Open the index file in your browser to test it.
    (This was tricky for me at first as there seemed no option for opening local files. So in RAR I opened Index.html in Firefox. It didn’t work until I gave Firefox permission to work with my storage. I gave that permission in my apps settings.)

If you’ve got any further questions on how I did this, do ask! It’s definitely easier to use a computer but I know that’s not an option for everyone.

21 Likes

I wonder if it’s possible to develop using one of those remote desktop apps?

Is there any way to write on android phone?
Also I’m not sure what category it fits. Please tell me if this doesn’t fit here.

Yes, you can as I mostly use tablet and phone to code. With a text editor is the easiest thing in the world. However, since the latest update of firefox, you won’t be able to test it on Android. But no problem at all just for testing use a Pc

1 Like

Yeah, that’s the hard thing. As I heard Chrome doesn’t somehow allow the testing.
I have Chromebook.

Well, Testing is not something you will do everyday. Even if you haven’t a pc you will probably access to one when you rely need to test it.

I change from pc to mobile devices everyday is easy to do.

I can confirm my solution from two years ago no longer appears to work, with Firefox no longer willing to properly open the local files that use javascript. I took some time to try various workarounds but I wasn’t able to figure a way forward. If you have access to the internet on your device, you can upload your project to a private server and then you can test in browser, but that’s a lot more work than just using a proper computer would be.

2 Likes

Exactly. I really think that. As it is what I do. And really testing is not something one has to do continuously. To play game on phone you always can do a private one on dashingdon for testing purposes

You could also try using the old ChoiceScript version with a HTML viewer app. That might work on Android phones and this way you could still test your code while writing without an internet connection.
(I know this thread is pretty old, but I figured someone might still be looking into that issue, since I’ve ran into it recently.)

7 Likes

Hi thanks for the help, if not, could you tell me where I can download the old version of the choicescript you mentioned?

Well, I can’t find any older versions on the web now. Because I first downloaded ChoiceScript in 2015 it wasn’t an issue, but since new writers can’t get it anymore, unfortunately, my advice would be of little help to them. I still have it though, so if you need it for testing, I could send you a copy or maybe @dashingdon might allow it to be downloaded from their site as well. I understand that any older versions might not function properly anymore and have less features, however if only for testing purposes and to be able to write on your phone, even without an Internet connection, it would be pretty useful.

You actually can get older versions of choicescript if you know how to use git. And you need a computer for that. :grimacing:

On the off chance that you get your hands on a computer, here’s a quick how-to:

  1. Install git
  2. Open the shell terminal (I recommend PowerShell on Windows).
  3. Using the shell, navigate to the folder where you want to download ChoiceScript
    If folders have space in their names, write the whole path between " ".
cd "C:\Users\username\Desktop\"
  1. Clone ChoiceScript source code using git command line on the terminal
git clone https://github.com/dfabulich/choicescript.git
  1. Navigate to the newly downloaded folder
cd choicescript
  1. Get the history log of commits (versions) of the source code
git log

This should print a sequence like this:

commit 045ae82d141c6e0bbb1d7a28425765f60fd135b8
Author: Dan Fabulich <dan@fabulich.com>
Date:   Sun Oct 18 13:29:31 2020 -0700

    Fix *purchase with quicktest and randomtest

commit 0f16c948829145fc47be6ef08d3052dc02e02a28
Author: Dan Fabulich <dan@fabulich.com>
Date:   Sat Oct 17 23:21:19 2020 -0700

    Add support for JSON named parameters on purchase button

commit 8002d246b254f314affa8169b9e01bdbc4dec447
Author: Dan Fabulich <dan@fabulich.com>
Date:   Sat Oct 17 23:20:38 2020 -0700

    whitespace

...

The long string of characters next to commit is the “name” of that version.
Press enter to reveal more of the history log.
Press q to exit.

  1. Find a version you want. Note that they have the date they were committed. For example, this is the last commit from 2015:
    2cc90f90e56c021be4054b4f358880a94183a9f9

  2. Use the especial git command checkout to magically revert back time:

git checkout 2cc90f90e56c021be4054b4f358880a94183a9f9
  1. Now the source code will revert itself back to that one version.

When you copy the source code to your mobile, make sure to leave out the hidden folder .git. Put simply, it has every version of every file that the source code ever had. It is overload you don’t need. It is hidden, it doesn’t show up normally. You have to enable hidden files. Also yes, it starts with a dot, but it’s not an extension file.



Not to mention those pesky bugs! :ant: :joy:

3 Likes

Ah, I see, I have to take my words back then.:sweat_smile: Great, that there’s is already a way. I’m nowhere near being that familiar with code, though, so you have my sincere gratitude for explaining it so simply.

Regarding the bugs, well, it’s the price one has to pay when using an outdated version. But if someone is just starting to learn ChoiceScript they’ll probably want to test each small change of the text just to be sure and if they only write on a tablet or phone then there’s no other way around it.:expressionless::joy:

1 Like

Even easier:

Find the commit you want at https://github.com/dfabulich/choicescript/commits/master, click it. Then select ‘Browse Files’ (top-right), you’ll be taken back to the ‘main page’ and can click ‘Code’ -> Download Zip, as normal (albeit now with a copy from the selected point).

2 Likes

I think I’m too addicted to the terminal :joy: I use it even when there’s an easier way. Didn’t even cross my mind to use GitHub itself. :joy:

1 Like

I figured, and that wins for me too, but most people here have probably never even heard of git (outside of GitHub).

1 Like

I know this might come a little late, and I am really not sure about this potential workaround.
I guess I will try out this possible solution and tell if it works, but the idea just came to me, we can use termux for many things and you can install git, python, and many other things from the app since it is a very complete terminal emulator.

For example you can even install software to create websites (although using the smartphone’s keyboard to program might be slightly uncomfortable). If you want to try I am guessing it would even allow the instalation of CSOG choicescript language and perhaps run smoothly.

After 30 minutes I have finally found a fix! All you need to do is install an outdated version of Firefox and then it will work!

Let’s not publicly recommend people use old versions of web browsers, with gaping security holes, in order to workaround an “issue” that only exists because of the efforts of modern browsers to keep people secure.

5 Likes

Use Kiwi Browser